boka003 |
23.02.2015. 00:15 |
PHP/Java Script - Pomoc oko racunanja cjene.
Pozdrav,
Vec par dana se borim sa jednim problemom koji nikako da prevazidjem.
Preko google seach sam nasao Vas forum pa sam odlucio ovdje da iznesem svoj problem.
Radi se o sljedecem sajtu: http://client.dizajnarena.com/order/game/1/cs
- Imam bag prilikom racunanja cjene na vise mjeseci.
Oprobacu biti sto kraci.
Ako izaberete server od 30 slotova, pa zatim izaberete 28 slotova, cjena ce biti 8.5 €, ukoliko izaberete placanje na 1 mjesec cjena ostaje naravno ista,no medjutim ako izaberete placanje na 2 mjeseca cjena opet ostaje ista ( sto nebi smjelo),ukoliko se izabere placanje i na 3 mjeseca cjena je opet ista.
Ovaj bag se desava na svim brojevima slotova sem: 12,24 i 32.
Vec nekoliko dana se borim sa ovim,ne nalazim nikakvo rjesenje pa sam odlucio da se konsultujem sa Vama, mozda neko ima koristan prjedlog.
Ispod saljem kod od 2 fajla koja su zaduzen za ovu funkciju.
PHP kod:
<?php if(!isset($access_security)){die("direktan pristup zabranjen");} ?>
<div
class="container_24" id="gameorder">
<div class="grid_24">
<div class="content_block">
<div class="block_title"><?php echo $game_title; ?></div>
</div>
<!-- end .content_block -->
<div class="clear"></div>
</div>
<!-- end .grid_24 -->
<div class="clear"></div>
<div class="grid_6">
<div class="content_block">
<img src="/files/images/gamecover/<?php echo $game_cover; ?>" alt="<?php echo $game_title; ?>" />
</div>
<!-- end .content_block -->
<div class="clear"></div>
<?php if($game_title_safe = $game_row['title_safe']): ?>
<div class="content_block">
<div class="block_title">Premium TEST IP</div>
80.65.85.103:1337
<div class="block_title">Lite TEST IP</div>
78.47.147.116:27015
</div>
<!-- end .content_block -->
<div class="clear"></div>
<?php endif; ?>
</div>
<!-- end .grid_6 -->
<div class="grid_11">
<div class="content_block">
<form class="fatform" method="POST" action="">
<?php if($game_title_safe = $game_row['title_safe']): ?>
<p>
<label for="location">Vrsta</label>
<select name="location" id="location" onChange="window.location.href = '/order/game/1/<?php echo $game_title_safe;?>&type=' + $('#location').val();">
<option value="lite">Lite</option>
<option <?php if($server_type=='premium'){echo 'selected="selected"';}?> value="premium">Premium</option>
</select>
</p>
<p>
<label for="slokacija">Lokacija Servera</label>
<select name="slokacija" id="slokacija">
<option value="Bosna i Hercegovina">Bosna i Hercegovina</option>
<option value="Srbija">Srbija</option>
<option value="Njemacka">Njemacka</option>
</select>
</p>
<p>
<label for="modservera">Mod Servera</label>
<select name="modservera" id="modservera">
<option value="Za ovu igru mi ne treba mod">Za ovu igru mi ne treba mod</option>
<option value="Public">Public</option>
<option value="Deathmatch">Deathmatch</option>
<option value="Deathrun">Deathrun</option>
<option value="GunGame">GunGame</option>
<option value="KreedZ">KreedZ</option>
<option value="HideNSeek">HideNeek</option>
<option value="War3FT">War3FT</option>
<option value="Knife Arena">Knife Arena</option>
<option value="Super Hero">Super Hero</option>
<option value="Surf">Surf</option>
<option value="Warcraf3">Warcraft3</option>
<option value="Paintball">Paintball</option>
<option value="Zmurka">Zmurka</option>
<option value="AWP">AWP</option>
<option value="De_dus2 ONLY">De_dus2 ONLY</option>
</select>
</p>
<?php endif; ?>
<p>
<?php if($game_title_safe == "cs"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
<option <?php if($post_slots=='22'){echo 'selected="selected"';}?> value="22">22 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='26'){echo 'selected="selected"';}?> value="26">26 slota</option>
<option <?php if($post_slots=='28'){echo 'selected="selected"';}?> value="28">28 slota</option>
<option <?php if($post_slots=='30'){echo 'selected="selected"';}?> value="30">30 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "css"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "csgo"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
<option <?php if($post_slots=='64'){echo 'selected="selected"';}?> value="64">64 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "cod2"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
<option <?php if($post_slots=='22'){echo 'selected="selected"';}?> value="22">22 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='26'){echo 'selected="selected"';}?> value="26">26 slota</option>
<option <?php if($post_slots=='28'){echo 'selected="selected"';}?> value="28">28 slota</option>
<option <?php if($post_slots=='30'){echo 'selected="selected"';}?> value="30">30 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "cod4"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
<option <?php if($post_slots=='22'){echo 'selected="selected"';}?> value="22">22 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='26'){echo 'selected="selected"';}?> value="26">26 slota</option>
<option <?php if($post_slots=='28'){echo 'selected="selected"';}?> value="28">28 slota</option>
<option <?php if($post_slots=='30'){echo 'selected="selected"';}?> value="30">30 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "tf2"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
<option <?php if($post_slots=='22'){echo 'selected="selected"';}?> value="22">22 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='26'){echo 'selected="selected"';}?> value="26">26 slota</option>
<option <?php if($post_slots=='28'){echo 'selected="selected"';}?> value="28">28 slota</option>
<option <?php if($post_slots=='30'){echo 'selected="selected"';}?> value="30">30 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "mc"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='6'){echo 'selected="selected"';}?> value="6">6 slota</option>
<option <?php if($post_slots=='8'){echo 'selected="selected"';}?> value="8">8 slota</option>
<option <?php if($post_slots=='10'){echo 'selected="selected"';}?> value="10">10 slota</option>
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "l4d2"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='8'){echo 'selected="selected"';}?> value="8">8 slota</option>
<option <?php if($post_slots=='10'){echo 'selected="selected"';}?> value="10">10 slota</option>
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "cspro"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='14'){echo 'selected="selected"';}?> value="14">14 slota</option>
<option <?php if($post_slots=='16'){echo 'selected="selected"';}?> value="16">16 slota</option>
<option <?php if($post_slots=='18'){echo 'selected="selected"';}?> value="18">18 slota</option>
<option <?php if($post_slots=='20'){echo 'selected="selected"';}?> value="20">20 slota</option>
<option <?php if($post_slots=='22'){echo 'selected="selected"';}?> value="22">22 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='26'){echo 'selected="selected"';}?> value="26">26 slota</option>
<option <?php if($post_slots=='28'){echo 'selected="selected"';}?> value="28">28 slota</option>
<option <?php if($post_slots=='30'){echo 'selected="selected"';}?> value="30">30 slota</option>
<option <?php if($post_slots=='32'){echo 'selected="selected"';}?> value="32">32 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "ts3"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='12'){echo 'selected="selected"';}?> value="12">12 slota</option>
<option <?php if($post_slots=='24'){echo 'selected="selected"';}?> value="24">24 slota</option>
<option <?php if($post_slots=='60'){echo 'selected="selected"';}?> value="60">60 slota</option>
<option <?php if($post_slots=='100'){echo 'selected="selected"';}?> value="100">100 slota</option>
<option <?php if($post_slots=='200'){echo 'selected="selected"';}?> value="200">200 slota</option>
</select>
<?php endif; ?>
<?php if($game_title_safe == "gta"): ?>
<label for="slots">Broj slotova</label>
<select name="slots" id="slots" onChange="javascript:calculate_price();">
<option <?php if($post_slots=='40'){echo 'selected="selected"';}?> value="40">40 slota</option>
<option <?php if($post_slots=='60'){echo 'selected="selected"';}?> value="60">60 slota</option>
<option <?php if($post_slots=='80'){echo 'selected="selected"';}?> value="80">80 slota</option>
<option <?php if($post_slots=='100'){echo 'selected="selected"';}?> value="100">100 slota</option>
<option <?php if($post_slots=='120'){echo 'selected="selected"';}?> value="120">120 slota</option>
<option <?php if($post_slots=='140'){echo 'selected="selected"';}?> value="140">140 slota</option>
<option <?php if($post_slots=='160'){echo 'selected="selected"';}?> value="160">160 slota</option>
<option <?php if($post_slots=='180'){echo 'selected="selected"';}?> value="180">180 slota</option>
<option <?php if($post_slots=='200'){echo 'selected="selected"';}?> value="200">200 slota</option>
</select>
<?php endif; ?>
</p>
<p>
<label for="period">Period</label>
<select name="period" id="period" onChange="javascript:calculate_price();">
<option value="1_month">1 mjesec</option>
<option <?php if($post_period=='2_months'){echo 'selected="selected"';}?> value="2_months">2 mjeseca (10% popust)</option>
<option <?php if($post_period=='3_months'){echo 'selected="selected"';}?> value="3_months">3 mjeseca (15% popust)</option>
</select>
</p>
<p>
<label for="ads">Reklama</label>
<select name="ads" id="ads"onChange="javascript:calculate_price();">
<option value="yes">PCG.ba u Nazivu servera</option>
<option <?php if($post_ads=='no'){echo 'selected="selected"';}?> value="no">Ne (+1 €)</option>
</select>
</p>
<p>
<label for="webhosting">WebHosting</label>
<select name="webhosting" id="webhosting" onChange="javascript:calculate_price() , $('#webhost').toggle('slow');">
<option value="no">Ne</option>
<option value="yes">Da (+1 €)</option>
</select>
</p>
<p id="webhost" style="display: none;">
<label for="domain">Domena</label>
<input style="width: 95px; margin-right: 7px" type="text" name="domain" id="domain" value="<?php echo htmlspecialchars($_POST['domain']); ?>" />
<select name="extension" id="extension" style="width: 90px;">
<option value=".pcg.ba">.pcg.ba</option>
<option value=".pcg.ba">.pcg-gamehosting.com</option>
</select>
</p>
<p>
<label for="total">Ukupna Cijena</label>
<input style="background: none; border: 0; color: #ef291b;" readonly="readonly" type="text" name="total" id="total" value="" />
</p>
<p>
<label for="server_name">Ime Servera</label>
<input type="text" name="server_name" id="server_name" />
</p>
<p id="final_comment">
<label for="final_comment">Dodatni komentar</label>
<textarea name="final_comment" rows="4" cols="25"><?php echo htmlspecialchars($_POST['final_comment']);?></textarea>
</p>
<p>
<?php
if(logged()){
echo '<input class="submit_button" type="submit" name="submit_game_order" value="Naruči" />';
} else {
echo '<input class="submit_button" type="submit" disabled="disabled" value="Moraš biti logovan da bi naručio" />';
}
?>
</p>
</form>
</div>
<!-- end .content_block -->
<div class="clear"></div>
</div>
<!-- end .grid_11 -->
<div class="grid_7">
<div class="content_block">
<div class="block_title">Trenutno u ponudi</div>
<ul id="sidebar_games">
<?php
$gamelist2_query = mysql_query("SELECT title,title_safe,icon,'1' AS type FROM games_standard UNION ALL SELECT title,title_safe,icon,'2' AS type FROM games_slots");
while($gamelist2_row = mysql_fetch_assoc($gamelist2_query)){
$gamelist2_title = $gamelist2_row['title'];
$gamelist2_title_safe = $gamelist2_row['title_safe'];
$gamelist2_icon = $gamelist2_row['icon'];
$gamelist2_type = $gamelist2_row['type'];
echo '<li><img class="ico" style="padding-right:8px;" src="/files/images/gameicons/'.$gamelist2_icon.'" alt="" /><a href="/order/game/'.$gamelist2_type.'/'.$gamelist2_title_safe.'">'.$gamelist2_title.'</a></li>';
}
?>
</ul>
</div>
<!-- end .content_block -->
<div class="clear"></div>
</div>
<!-- end .grid_7 -->
</div>
<script type="text/javascript">
function calculate_price(){
slots = $("#slots").val();
period = $("#period").val();
ads = $("#ads").val();
webhost = $("#webhosting").val();
if(period=='1_month'){
if(slots=='6'){total_price = '<?php echo $game_6_slots; ?>';}
if(slots=='8'){total_price = '<?php echo $game_8_slots; ?>';}
if(slots=='10'){total_price = '<?php echo $game_10_slots; ?>';}
if(slots=='12'){total_price = '<?php echo $game_12_slots; ?>';}
if(slots=='14'){total_price = '<?php echo $game_14_slots; ?>';}
if(slots=='16'){total_price = '<?php echo $game_16_slots; ?>';}
if(slots=='18'){total_price = '<?php echo $game_18_slots; ?>';}
if(slots=='20'){total_price = '<?php echo $game_20_slots; ?>';}
if(slots=='22'){total_price = '<?php echo $game_22_slots; ?>';}
if(slots=='24'){total_price = '<?php echo $game_24_slots; ?>';}
if(slots=='26'){total_price = '<?php echo $game_26_slots; ?>';}
if(slots=='28'){total_price = '<?php echo $game_28_slots; ?>';}
if(slots=='30'){total_price = '<?php echo $game_30_slots; ?>';}
if(slots=='32'){total_price = '<?php echo $game_32_slots; ?>';}
if(slots=='40'){total_price = '<?php echo $game_40_slots; ?>';}
if(slots=='60'){total_price = '<?php echo $game_60_slots; ?>';}
if(slots=='80'){total_price = '<?php echo $game_80_slots; ?>';}
if(slots=='100'){total_price = '<?php echo $game_100_slots; ?>';}
if(slots=='120'){total_price = '<?php echo $game_120_slots; ?>';}
if(slots=='140'){total_price = '<?php echo $game_140_slots; ?>';}
if(slots=='160'){total_price = '<?php echo $game_160_slots; ?>';}
if(slots=='180'){total_price = '<?php echo $game_180_slots; ?>';}
if(slots=='200'){total_price = '<?php echo $game_200_slots; ?>';}
}
if(period=='2_months'){
if(slots=='6'){total_price = '<?php echo ($game_6_slots * 2) - $game_6_slots_10_percent; ?>';}
if(slots=='8'){total_price = '<?php echo ($game_8_slots * 2) - $game_8_slots_10_percent; ?>';}
if(slots=='10'){total_price = '<?php echo ($game_10_slots * 2) - $game_10_slots_10_percent; ?>';}
if(slots=='12'){total_price = '<?php echo ($game_12_slots * 2) - $game_12_slots_10_percent; ?>';}
if(slots=='14'){total_price = '<?php echo ($game_14_slots * 2) - $game_14_slots_10_percent; ?>';}
if(slots=='16'){total_price = '<?php echo ($game_16_slots * 2) - $game_16_slots_10_percent; ?>';}
if(slots=='18'){total_price = '<?php echo ($game_18_slots * 2) - $game_18_slots_10_percent; ?>';}
if(slots=='20'){total_price = '<?php echo ($game_20_slots * 2) - $game_20_slots_10_percent; ?>';}
if(slots=='22'){total_price = '<?php echo ($game_22_slots * 2) - $game_22_slots_10_percent; ?>';}
if(slots=='24'){total_price = '<?php echo ($game_24_slots * 2) - $game_24_slots_10_percent; ?>';}
if(slots=='32'){total_price = '<?php echo ($game_32_slots * 2) - $game_32_slots_10_percent; ?>';}
if(slots=='40'){total_price = '<?php echo ($game_40_slots * 2) - $game_40_slots_10_percent; ?>';}
if(slots=='60'){total_price = '<?php echo ($game_60_slots * 2) - $game_60_slots_10_percent; ?>';}
if(slots=='80'){total_price = '<?php echo ($game_80_slots * 2) - $game_80_slots_10_percent; ?>';}
if(slots=='100'){total_price = '<?php echo ($game_100_slots * 2) - $game_100_slots_10_percent; ?>';}
if(slots=='120'){total_price = '<?php echo ($game_120_slots * 2) - $game_120_slots_10_percent; ?>';}
if(slots=='140'){total_price = '<?php echo ($game_140_slots * 2) - $game_140_slots_10_percent; ?>';}
if(slots=='160'){total_price = '<?php echo ($game_160_slots * 2) - $game_160_slots_10_percent; ?>';}
if(slots=='180'){total_price = '<?php echo ($game_180_slots * 2) - $game_180_slots_10_percent; ?>';}
if(slots=='200'){total_price = '<?php echo ($game_200_slots * 2) - $game_200_slots_10_percent; ?>';}
}
if(period=='3_months'){
if(slots=='6'){total_price = '<?php echo ($game_6_slots * 3) - $game_6_slots_15_percent; ?>';}
if(slots=='8'){total_price = '<?php echo ($game_8_slots * 3) - $game_8_slots_15_percent; ?>';}
if(slots=='10'){total_price = '<?php echo ($game_10_slots * 3) - $game_10_slots_15_percent; ?>';}
if(slots=='12'){total_price = '<?php echo ($game_12_slots * 3) - $game_12_slots_15_percent; ?>';}
if(slots=='14'){total_price = '<?php echo ($game_14_slots * 2) - $game_14_slots_15_percent; ?>';}
if(slots=='16'){total_price = '<?php echo ($game_16_slots * 3) - $game_16_slots_15_percent; ?>';}
if(slots=='18'){total_price = '<?php echo ($game_18_slots * 3) - $game_18_slots_15_percent; ?>';}
if(slots=='20'){total_price = '<?php echo ($game_20_slots * 3) - $game_20_slots_15_percent; ?>';}
if(slots=='22'){total_price = '<?php echo ($game_22_slots * 3) - $game_22_slots_15_percent; ?>';}
if(slots=='24'){total_price = '<?php echo ($game_24_slots * 3) - $game_24_slots_15_percent; ?>';}
if(slots=='32'){total_price = '<?php echo ($game_32_slots * 3) - $game_32_slots_15_percent; ?>';}
if(slots=='40'){total_price = '<?php echo ($game_40_slots * 3) - $game_40_slots_15_percent; ?>';}
if(slots=='60'){total_price = '<?php echo ($game_60_slots * 3) - $game_60_slots_15_percent; ?>';}
if(slots=='80'){total_price = '<?php echo ($game_80_slots * 3) - $game_80_slots_15_percent; ?>';}
if(slots=='100'){total_price = '<?php echo ($game_100_slots * 3) - $game_100_slots_15_percent; ?>';}
if(slots=='120'){total_price = '<?php echo ($game_120_slots * 3) - $game_120_slots_15_percent; ?>';}
if(slots=='140'){total_price = '<?php echo ($game_140_slots * 3) - $game_140_slots_15_percent; ?>';}
if(slots=='160'){total_price = '<?php echo ($game_160_slots * 3) - $game_160_slots_15_percent; ?>';}
if(slots=='180'){total_price = '<?php echo ($game_180_slots * 3) - $game_180_slots_15_percent; ?>';}
if(slots=='200'){total_price = '<?php echo ($game_200_slots * 3) - $game_200_slots_15_percent; ?>';}
}
if(ads=='no'){
total_price = Number(total_price) + 1;
total_price = total_price.toFixed(1);
}
if(webhost=='yes'){
total_price = Number(total_price) + 1;
total_price = total_price.toFixed(1);
}
$('#total').hide();
$('#total').val(total_price + '€');
$('#total').fadeIn('slow');
}
window.onload = calculate_price();
</script>
- I drugi fajl:
PHP kod:
<?php
if(!isset($access_security)){die("direktan pristup zabranjen");}
$game = mysql_real_escape_string($_GET['game']);
$game_query = mysql_query("SELECT * FROM games_standard WHERE title_safe='$game'");
if(mysql_num_rows($game_query)==0){
q7eb2a_redirect("/404");
} else {
$game_row = mysql_fetch_assoc($game_query);
$server_type = $_GET['type'];
if(empty($server_type)){$server_type = 'lite';}
$game_title = $game_row['title'];
$game_title_safe = $game_row['title_safe'];
$game_cover = $game_row['cover'];
if($server_type=='premium'){
$game_6_slots = $game_row['6_slots_premium'];
$game_8_slots = $game_row['8_slots_premium'];
$game_10_slots = $game_row['10_slots_premium'];
$game_12_slots = $game_row['12_slots_premium'];
$game_14_slots = $game_row['14_slots_premium'];
$game_16_slots = $game_row['16_slots_premium'];
$game_18_slots = $game_row['18_slots_premium'];
$game_20_slots = $game_row['20_slots_premium'];
$game_22_slots = $game_row['22_slots_premium'];
$game_24_slots = $game_row['24_slots_premium'];
$game_26_slots = $game_row['26_slots_premium'];
$game_28_slots = $game_row['28_slots_premium'];
$game_30_slots = $game_row['30_slots_premium'];
$game_32_slots = $game_row['32_slots_premium'];
$game_40_slots = $game_row['40_slots_premium'];
$game_44_slots = $game_row['44_slots_premium'];
$game_50_slots = $game_row['50_slots_premium'];
$game_52_slots = $game_row['52_slots_premium'];
$game_60_slots = $game_row['60_slots_premium'];
$game_64_slots = $game_row['64_slots_premium'];
$game_80_slots = $game_row['80_slots_premium'];
$game_100_slots = $game_row['100_slots_premium'];
$game_120_slots = $game_row['120_slots_premium'];
$game_128_slots = $game_row['128_slots_premium'];
$game_140_slots = $game_row['140_slots_premium'];
$game_160_slots = $game_row['160_slots_premium'];
$game_180_slots = $game_row['180_slots_premium'];
$game_200_slots = $game_row['200_slots_premium'];
$game_500_slots = $game_row['500_slots_premium'];
} else {
$game_6_slots = $game_row['6_slots_lite'];
$game_8_slots = $game_row['8_slots_lite'];
$game_10_slots = $game_row['10_slots_lite'];
$game_12_slots = $game_row['12_slots_lite'];
$game_14_slots = $game_row['14_slots_lite'];
$game_16_slots = $game_row['16_slots_lite'];
$game_18_slots = $game_row['18_slots_lite'];
$game_20_slots = $game_row['20_slots_lite'];
$game_22_slots = $game_row['22_slots_lite'];
$game_24_slots = $game_row['24_slots_lite'];
$game_26_slots = $game_row['26_slots_lite'];
$game_28_slots = $game_row['28_slots_lite'];
$game_30_slots = $game_row['30_slots_lite'];
$game_32_slots = $game_row['32_slots_lite'];
$game_40_slots = $game_row['40_slots_lite'];
$game_44_slots = $game_row['44_slots_lite'];
$game_50_slots = $game_row['50_slots_lite'];
$game_52_slots = $game_row['52_slots_lite'];
$game_60_slots = $game_row['60_slots_lite'];
$game_64_slots = $game_row['64_slots_lite'];
$game_80_slots = $game_row['80_slots_lite'];
$game_100_slots = $game_row['100_slots_lite'];
$game_120_slots = $game_row['120_slots_lite'];
$game_128_slots = $game_row['128_slots_lite'];
$game_140_slots = $game_row['140_slots_lite'];
$game_160_slots = $game_row['160_slots_lite'];
$game_180_slots = $game_row['180_slots_lite'];
$game_200_slots = $game_row['200_slots_lite'];
$game_500_slots = $game_row['500_slots_lite'];
}
// 10 %
$game_6_slots_10_percent = ($game_6_slots / 100) * 10;
$game_8_slots_10_percent = ($game_8_slots / 100) * 10;
$game_10_slots_10_percent = ($game_10_slots / 100) * 10;
$game_12_slots_10_percent = ($game_12_slots / 100) * 10;
$game_14_slots_10_percent = ($game_14_slots / 100) * 10;
$game_16_slots_10_percent = ($game_16_slots / 100) * 10;
$game_18_slots_10_percent = ($game_18_slots / 100) * 10;
$game_20_slots_10_percent = ($game_20_slots / 100) * 10;
$game_22_slots_10_percent = ($game_22_slots / 100) * 10;
$game_24_slots_10_percent = ($game_24_slots / 100) * 10;
$game_26_slots_10_percent = ($game_26_slots / 100) * 10;
$game_28_slots_10_percent = ($game_28_slots / 100) * 10;
$game_30_slots_10_percent = ($game_30_slots / 100) * 10;
$game_32_slots_10_percent = ($game_32_slots / 100) * 10;
$game_40_slots_10_percent = ($game_40_slots / 100) * 10;
$game_44_slots_10_percent = ($game_44_slots / 100) * 10;
$game_50_slots_10_percent = ($game_50_slots / 100) * 10;
$game_52_slots_10_percent = ($game_52_slots / 100) * 10;
$game_60_slots_10_percent = ($game_60_slots / 100) * 10;
$game_64_slots_10_percent = ($game_64_slots / 100) * 10;
$game_80_slots_10_percent = ($game_80_slots / 100) * 10;
$game_100_slots_10_percent = ($game_100_slots / 100) * 10;
$game_120_slots_10_percent = ($game_120_slots / 100) * 10;
$game_128_slots_10_percent = ($game_128_slots / 100) * 10;
$game_140_slots_10_percent = ($game_140_slots / 100) * 10;
$game_160_slots_10_percent = ($game_160_slots / 100) * 10;
$game_180_slots_10_percent = ($game_180_slots / 100) * 10;
$game_200_slots_10_percent = ($game_200_slots / 100) * 10;
$game_500_slots_10_percent = ($game_500_slots / 100) * 10;
// 15 %
$game_6_slots_15_percent = ($game_6_slots / 100) * 15;
$game_8_slots_15_percent = ($game_8_slots / 100) * 15;
$game_10_slots_15_percent = ($game_10_slots / 100) * 15;
$game_12_slots_15_percent = ($game_12_slots / 100) * 15;
$game_14_slots_15_percent = ($game_14_slots / 100) * 15;
$game_16_slots_15_percent = ($game_16_slots / 100) * 15;
$game_18_slots_15_percent = ($game_18_slots / 100) * 15;
$game_20_slots_15_percent = ($game_20_slots / 100) * 15;
$game_22_slots_15_percent = ($game_22_slots / 100) * 15;
$game_24_slots_15_percent = ($game_24_slots / 100) * 15;
$game_26_slots_15_percent = ($game_26_slots / 100) * 15;
$game_28_slots_15_percent = ($game_28_slots / 100) * 15;
$game_30_slots_15_percent = ($game_30_slots / 100) * 15;
$game_32_slots_15_percent = ($game_32_slots / 100) * 15;
$game_40_slots_15_percent = ($game_40_slots / 100) * 15;
$game_44_slots_15_percent = ($game_44_slots / 100) * 15;
$game_50_slots_15_percent = ($game_50_slots / 100) * 15;
$game_52_slots_15_percent = ($game_52_slots / 100) * 15;
$game_60_slots_15_percent = ($game_60_slots / 100) * 15;
$game_64_slots_15_percent = ($game_64_slots / 100) * 15;
$game_80_slots_15_percent = ($game_80_slots / 100) * 15;
$game_100_slots_15_percent = ($game_100_slots / 100) * 15;
$game_120_slots_15_percent = ($game_120_slots / 100) * 15;
$game_128_slots_15_percent = ($game_128_slots / 100) * 15;
$game_140_slots_15_percent = ($game_140_slots / 100) * 15;
$game_160_slots_15_percent = ($game_160_slots / 100) * 15;
$game_180_slots_15_percent = ($game_180_slots / 100) * 15;
$game_200_slots_15_percent = ($game_200_slots / 100) * 15;
$game_500_slots_15_percent = ($game_500_slots / 100) * 15;
$page_title = $game_title;
$submit_game_order = $_POST['submit_game_order'];
if($submit_game_order && logged()){
$post_server_name = mysql_real_escape_string($_POST['server_name']);
$post_location = mysql_real_escape_string($_POST['location']);
if($post_location!='premium'){$post_location='lite';}
$post_slots = mysql_real_escape_string($_POST['slots']);
$post_period = mysql_real_escape_string($_POST['period']);
$post_ads = mysql_real_escape_string($_POST['ads']);
$post_domain = mysql_real_escape_string($_POST['domain']);
$post_extension = mysql_real_escape_string($_POST['extension']);
$post_webhosting = mysql_real_escape_string($_POST['webhosting']);
$post_final_comment = mysql_real_escape_string(stripslashes($_POST['final_comment']));
if($post_period=='1_month'){
if($post_slots=='6'){$post_total_price = $game_6_slots;}
if($post_slots=='8'){$post_total_price = $game_8_slots;}
if($post_slots=='10'){$post_total_price = $game_10_slots;}
if($post_slots=='12'){$post_total_price = $game_12_slots;}
if($post_slots=='14'){$post_total_price = $game_14_slots;}
if($post_slots=='16'){$post_total_price = $game_16_slots;}
if($post_slots=='18'){$post_total_price = $game_18_slots;}
if($post_slots=='20'){$post_total_price = $game_20_slots;}
if($post_slots=='22'){$post_total_price = $game_22_slots;}
if($post_slots=='24'){$post_total_price = $game_24_slots;}
if($post_slots=='26'){$post_total_price = $game_26_slots;}
if($post_slots=='28'){$post_total_price = $game_28_slots;}
if($post_slots=='30'){$post_total_price = $game_30_slots;}
if($post_slots=='32'){$post_total_price = $game_32_slots;}
if($post_slots=='40'){$post_total_price = $game_40_slots;}
if($post_slots=='44'){$post_total_price = $game_44_slots;}
if($post_slots=='50'){$post_total_price = $game_50_slots;}
if($post_slots=='52'){$post_total_price = $game_52_slots;}
if($post_slots=='60'){$post_total_price = $game_60_slots;}
if($post_slots=='64'){$post_total_price = $game_64_slots;}
if($post_slots=='80'){$post_total_price = $game_80_slots;}
if($post_slots=='100'){$post_total_price = $game_100_slots;}
if($post_slots=='120'){$post_total_price = $game_120_slots;}
if($post_slots=='128'){$post_total_price = $game_128_slots;}
if($post_slots=='140'){$post_total_price = $game_140_slots;}
if($post_slots=='160'){$post_total_price = $game_160_slots;}
if($post_slots=='180'){$post_total_price = $game_180_slots;}
if($post_slots=='200'){$post_total_price = $game_200_slots;}
if($post_slots=='500'){$post_total_price = $game_500_slots;}
}
if($post_period=='2_months'){
if($post_slots=='6'){$post_total_price = ($game_6_slots * 2) - $game_6_slots_10_percent;}
if($post_slots=='8'){$post_total_price = ($game_8_slots * 2) - $game_8_slots_10_percent;}
if($post_slots=='10'){$post_total_price = ($game_10_slots * 2) - $game_10_slots_10_percent;}
if($post_slots=='12'){$post_total_price = ($game_12_slots * 2) - $game_12_slots_10_percent;}
if($post_slots=='14'){$post_total_price = ($game_14_slots * 2) - $game_14_slots_10_percent;}
if($post_slots=='16'){$post_total_price = ($game_16_slots * 2) - $game_16_slots_10_percent;}
if($post_slots=='18'){$post_total_price = ($game_18_slots * 2) - $game_18_slots_10_percent;}
if($post_slots=='20'){$post_total_price = ($game_20_slots * 2) - $game_20_slots_10_percent;}
if($post_slots=='22'){$post_total_price = ($game_22_slots * 2) - $game_22_slots_10_percent;}
if($post_slots=='24'){$post_total_price = ($game_24_slots * 2) - $game_24_slots_10_percent;}
if($post_slots=='26'){$post_total_price = ($game_26_slots * 2) - $game_26_slots_10_percent;}
if($post_slots=='28'){$post_total_price = ($game_28_slots * 2) - $game_28_slots_10_percent;}
if($post_slots=='30'){$post_total_price = ($game_30_slots * 2) - $game_30_slots_10_percent;}
if($post_slots=='32'){$post_total_price = ($game_32_slots * 2) - $game_32_slots_10_percent;}
if($post_slots=='40'){$post_total_price = ($game_40_slots * 2) - $game_40_slots_10_percent;}
if($post_slots=='44'){$post_total_price = ($game_44_slots * 2) - $game_44_slots_10_percent;}
if($post_slots=='50'){$post_total_price = ($game_50_slots * 2) - $game_50_slots_10_percent;}
if($post_slots=='52'){$post_total_price = ($game_52_slots * 2) - $game_52_slots_10_percent;}
if($post_slots=='60'){$post_total_price = ($game_60_slots * 2) - $game_60_slots_10_percent;}
if($post_slots=='64'){$post_total_price = ($game_64_slots * 2) - $game_64_slots_10_percent;}
if($post_slots=='80'){$post_total_price = ($game_80_slots * 2) - $game_80_slots_10_percent;}
if($post_slots=='100'){$post_total_price = ($game_100_slots * 2) - $game_100_slots_10_percent;}
if($post_slots=='120'){$post_total_price = ($game_120_slots * 2) - $game_120_slots_10_percent;}
if($post_slots=='128'){$post_total_price = ($game_128_slots * 2) - $game_128_slots_10_percent;}
if($post_slots=='140'){$post_total_price = ($game_140_slots * 2) - $game_140_slots_10_percent;}
if($post_slots=='160'){$post_total_price = ($game_160_slots * 2) - $game_160_slots_10_percent;}
if($post_slots=='180'){$post_total_price = ($game_180_slots * 2) - $game_180_slots_10_percent;}
if($post_slots=='200'){$post_total_price = ($game_200_slots * 2) - $game_200_slots_10_percent;}
if($post_slots=='500'){$post_total_price = ($game_500_slots * 2) - $game_500_slots_10_percent;}
}
if($post_period=='3_months'){
if($post_slots=='6'){$post_total_price = ($game_6_slots * 3) - $game_6_slots_15_percent;}
if($post_slots=='8'){$post_total_price = ($game_8_slots * 3) - $game_8_slots_15_percent;}
if($post_slots=='10'){$post_total_price = ($game_10_slots * 3) - $game_10_slots_15_percent;}
if($post_slots=='12'){$post_total_price = ($game_12_slots * 3) - $game_12_slots_15_percent;}
if($post_slots=='14'){$post_total_price = ($game_14_slots * 3) - $game_14_slots_15_percent;}
if($post_slots=='16'){$post_total_price = ($game_16_slots * 3) - $game_16_slots_15_percent;}
if($post_slots=='18'){$post_total_price = ($game_18_slots * 3) - $game_18_slots_15_percent;}
if($post_slots=='20'){$post_total_price = ($game_20_slots * 3) - $game_20_slots_15_percent;}
if($post_slots=='22'){$post_total_price = ($game_22_slots * 3) - $game_22_slots_15_percent;}
if($post_slots=='24'){$post_total_price = ($game_24_slots * 3) - $game_24_slots_15_percent;}
if($post_slots=='26'){$post_total_price = ($game_26_slots * 3) - $game_26_slots_15_percent;}
if($post_slots=='28'){$post_total_price = ($game_28_slots * 3) - $game_28_slots_15_percent;}
if($post_slots=='30'){$post_total_price = ($game_30_slots * 3) - $game_30_slots_15_percent;}
if($post_slots=='32'){$post_total_price = ($game_32_slots * 3) - $game_32_slots_15_percent;}
if($post_slots=='40'){$post_total_price = ($game_40_slots * 3) - $game_40_slots_15_percent;}
if($post_slots=='44'){$post_total_price = ($game_44_slots * 3) - $game_44_slots_15_percent;}
if($post_slots=='50'){$post_total_price = ($game_50_slots * 3) - $game_50_slots_15_percent;}
if($post_slots=='52'){$post_total_price = ($game_52_slots * 3) - $game_52_slots_15_percent;}
if($post_slots=='60'){$post_total_price = ($game_60_slots * 3) - $game_60_slots_15_percent;}
if($post_slots=='64'){$post_total_price = ($game_64_slots * 3) - $game_64_slots_15_percent;}
if($post_slots=='80'){$post_total_price = ($game_80_slots * 3) - $game_80_slots_15_percent;}
if($post_slots=='100'){$post_total_price = ($game_100_slots * 3) - $game_100_slots_15_percent;}
if($post_slots=='120'){$post_total_price = ($game_120_slots * 3) - $game_120_slots_15_percent;}
if($post_slots=='128'){$post_total_price = ($game_128_slots * 3) - $game_128_slots_15_percent;}
if($post_slots=='140'){$post_total_price = ($game_140_slots * 3) - $game_140_slots_15_percent;}
if($post_slots=='160'){$post_total_price = ($game_160_slots * 3) - $game_160_slots_15_percent;}
if($post_slots=='180'){$post_total_price = ($game_180_slots * 3) - $game_180_slots_15_percent;}
if($post_slots=='200'){$post_total_price = ($game_200_slots * 3) - $game_200_slots_15_percent;}
if($post_slots=='500'){$post_total_price = ($game_500_slots * 3) - $game_500_slots_15_percent;}
}
if($post_ads=='no'){$post_total_price = $post_total_price + 1;}
if($post_webhosting=='yes'){$post_total_price = $post_total_price + 1;}
Dosta je opsirno,ali se nadam da ce neko imati volje da pogleda i eventualno predozi neko rjesenje.
Veliko hvala.
Pozdrav,
|