
MobTown
Members-
Posts
28 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Events
Everything posted by MobTown
-
Re: Free 2 - Gym Hi, i was wondering how i would go about increasing the amount of will used per training session, i figured it would have something to do with the $will line, but when i try anything it just changes how many stats my users get. i have tried muliplying the line by 10, <?php $will = (max(0, $will - mt_rand(1, 3))*10); ?> and by 0.1, (effectively dividing) <?php $will = (max(0, $will - mt_rand(1, 3))*0.1); ?> What am i doing wrong? <?php for ($i = 0; $i < $value; $i++) { $gain += (mt_rand(1, 3) / mt_rand(500, 900) * mt_rand(500, 900) * (($will + 20) / 150))*0.08; $will = max(0, $will - mt_rand(1, 3)); } ?>
-
Re: Time :s i think this has worked, and thanks for your help... Time will tell :D
-
Re: Time :s That gets the time right, but keeps it in minutes, instead of saying 1hr it says 78 mins
-
A couple of weeks ago, i was asked to add to the usersonline.php how long people had been online for... i attempted to do this, but felt it was slightly out... now some people are telling me it doubles how long they have been online for... I just wondered what the easiest way to do this was.... i currently take a unix timestamp when they log in, and use the laston timestamp already taken $online=$r['laston']-$r['lastlogin']; $onunits="secs"; if ($online<0){$online='0';} if ($online>=60){$onunits="mins"; $online=(int)($online/60);} if ($online>=24){$onunits="hrs"; $online=(int)($online/24);} $online="$online$onunits"; can anyone help me spot where the error is?
-
Re: Your probablly sick of me already I found the problem... and boy how stupid do i feel... echo "<form name='train' id='train' action='gym2.php' method='post' style='padding:0;margin:0;'>"; I overwrote gym.php with the new file, and forget to change where it was submitting the data.
-
I know its huge, but it is over my head now.
MobTown replied to MobTown's topic in General Discussion
Re: I know its huge, but it is over my head now. thanks a lot... and it seems to be working at the moment... -
So yesterday i asked if there was a gym script anywhere and was redirected to a nice little script by Nyna... after putting it on my site i realised that the gain in stats for this gym was nearly five times as much as it was before... the code currently looks like this... <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); global $db, $h, $ir, $userid; if($ir['userid'] != 1) { die("Apologies, but the gym is currently closed."); } if($ir['verify'] < 1) { print "<head><meta http-equiv='REFRESH' content='0;url=captcha.php?url=gym'></head>"; } if ($ir['hospital']) { echo " You cannot access the gym whilst in hospital</p>"; $h->endpage(); exit; } $prefs = isset($_SESSION['gymprefs']) ? $_SESSION['gymprefs'] : array('what' => "all", 'expend' => "100%"); $what = $prefs['what']; $expend = $prefs['expend']; $message = false; $sql = sprintf("SELECT us.strength, us.agility, us.guard, us.labour, u.energy, u.will, u.jail FROM users u LEFT JOIN userstats us ON (u.userid = us.userid) WHERE (u.userid = %u)", $userid); $row = mysql_fetch_array(mysql_query($sql)); $formID = preg_replace("`^([0-9A-F]{8})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{4})([0-9A-F]{12})$`ms", "{\\1-\\2-\\3-\\4-\\5}", strtoupper(md5(serialize(array(session_id(), "Gym", null))))); if (isset($_POST['formID']) && is_string($_POST['formID']) && ($_POST['formID'] === $formID)) { $what = isset($_POST['what']) && is_string($_POST['what']) && preg_match("`^((all)|(strength)|(agility)|(guard)|(labour))$`ims", $_POST['what']) ? strtolower($_POST['what']) : $what; $expend = isset($_POST['expend']) && is_string($_POST['expend']) && preg_match("`^((100%)|(75%)|(50%)|(25%)|(value))$`ims", $_POST['expend']) ? strtolower($_POST['expend']) : $expend; $value = isset($_POST['value']) && is_string($_POST['value']) && preg_match("`^\d+$`ims", $_POST['value']) ? @intval($_POST['value']) : 0; $sql = sprintf("SELECT energy, will FROM users WHERE (userid = %u)", $userid); $rs = mysql_query($sql); $info = mysql_fetch_array($rs); $energy = $row['energy']; $will = $row['will']; switch ($expend) { case "100%": $value = $row['energy']; break; case "75%": $value = $row['energy'] * 0.75; break; case "50%": $value = $row['energy'] * 0.50; break; case "25%": $value = $row['energy'] * 0.25; break; default: break; } $value = floor($value); if ($value > $row['energy']) $message = "<span style='color:#C00;'>You don't have enough energy</span>"; else { $prefs = array('what' => $what, 'expend' => $expend); $gain = 0; $will = $row['will']; for ($i = 0; $i < $value; $i++) { $gain += (mt_rand(1, 3) / mt_rand(500, 900) * mt_rand(500, 900) * (($will + 20) / 150)); $will = max(0, $will - mt_rand(1, 3)); } if ($row['jail']) $gain *= 0.5; $row['will'] = floor($will); $row['energy'] -= $value; switch ($what) { case "all": $message = sprintf("<span style='color:#070;'>You gain %s in each of the main stats</span>", number_format($gain * 0.33, 0)); $row['strength'] += $gain * 0.33; $row['agility'] += $gain * 0.33; $row['guard'] += $gain * 0.33; $row['labour'] += $gain * 0; break; case "strength": $message = sprintf("<span style='color:#070;'>You gain %s in strength</span>", number_format($gain, 0)); $row['strength'] += $gain; break; case "agility": $message = sprintf("<span style='color:#070;'>You gain %s in agility</span>", number_format($gain, 0)); $row['agility'] += $gain; break; case "guard": $message = sprintf("<span style='color:#070;'>You gain %s in guard</span>", number_format($gain, 0)); $row['guard'] += $gain; break; case "labour": $message = sprintf("<span style='color:#070;'>You gain %s in labour</span>", number_format($gain, 0)); $row['labour'] += $gain; break; } $sql1 = sprintf("UPDATE userstats SET strength = %.6f, agility = %.6f, guard = %.6f, labour = %.6f WHERE (userid = %u)", $row['strength'], $row['agility'], $row['guard'], $row['labour'], $userid); $sql2 = sprintf("UPDATE users SET will = %u, energy = %d WHERE (userid = %u)", $row['will'], $row['energy'], $userid); mysql_query($sql1); mysql_query($sql2); } $_SESSION['gymprefs'] = $prefs; } echo sprintf(" <center><h3>%sGym</h3>", $ir['jail'] ? "Jail " : ""); if ($message) echo sprintf(" %s</p><a href=crystaltemple.php>Don't forget to visit the crystal temple for quick energy refills</a>", $message); echo "<form name='train' id='train' action='gym2.php' method='post' style='padding:0;margin:0;'>"; echo sprintf("<input type='hidden' name='formID' value='%s' />", $formID); echo " <table class=sample1 width=90%><tr><td> <table><tr><td><img src=images/gym1.jpg></td></tr></table> </td><td><table class=sample>"; echo "<tr>"; echo "<th style='width:50%;'>Train</th>"; echo "<th style='width:50%;'>Expend</th>"; echo "</tr>"; echo "<tr>"; echo "<td style='line-height:200%;'>"; echo sprintf("<input type='radio' name='what' id='what0' value='all' %sstyle='vertical-align:middle;' /><label for='what0' style='cursor:pointer;'>All (33%% energy in each)</label> ", $what === "all" ? "checked='checked' " : "", number_format($row['ranks']['total'])); echo sprintf("<input type='radio' name='what' id='what1' value='strength' %sstyle='vertical-align:middle;' /><label for='what1' style='cursor:pointer;'>Strength (%s)</label> ", $what === "strength" ? "checked='checked' " : "", number_format($row['strength']), number_format($row['ranks']['strength'])); echo sprintf("<input type='radio' name='what' id='what2' value='agility' %sstyle='vertical-align:middle;' /><label for='what2' style='cursor:pointer;'>Agility (%s)</label> ", $what === "agility" ? "checked='checked' " : "", number_format($row['agility']), number_format($row['ranks']['agility'])); echo sprintf("<input type='radio' name='what' id='what3' value='guard' %sstyle='vertical-align:middle;' /><label for='what3' style='cursor:pointer;'>Guard (%s)</label> ", $what === "guard" ? "checked='checked' " : "", number_format($row['guard']), number_format($row['ranks']['guard'])); echo sprintf("<input type='radio' name='what' id='what4' value='labour' %sstyle='vertical-align:middle;' /><label for='what4' style='cursor:pointer;'>Labour (%s)</label> ", $what === "labour" ? "checked='checked' " : "", number_format($row['labour']), number_format($row['ranks']['labour'])); echo "</td>"; echo "<td style='line-height:200%;'>"; echo sprintf("<input type='radio' name='expend' id='expend0' value='100%%' %sstyle='vertical-align:middle;' /><label for='expend0' style='cursor:pointer;'>100%% Energy</label> ", $expend === "100%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend1' value='75%%' %sstyle='vertical-align:middle;' /><label for='expend1' style='cursor:pointer;'>75%% Energy</label> ", $expend === "75%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend2' value='50%%' %sstyle='vertical-align:middle;' /><label for='expend2' style='cursor:pointer;'>50%% Energy</label> ", $expend === "50%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend3' value='25%%' %sstyle='vertical-align:middle;' /><label for='expend3' style='cursor:pointer;'>25%% Energy</label> ", $expend === "25%" ? "checked='checked' " : ""); echo sprintf("<input type='radio' name='expend' id='expend4' value='value' %sstyle='vertical-align:middle;' onclick='document.train.value.focus();' /><label for='expend4' style='cursor:pointer;'><input type='text' id='value' name='value' value='{$row['energy']}' size='8' onfocus='this.select();' /> Energy</label> ", $expend === "value" ? "checked='checked' " : "");//(C)2008,Nyna echo "</td></tr><tr><td colspan='2'><input type='submit' name='submit' value='Train' style='width:100%' /></td></tr></table></form></td></tr><tr><td colspan=2>"; $ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ']; $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); $ir['IQrank']=get_rank($ir['IQ'],'IQ'); $tsrank=get_rank($ts,'strength+agility+guard+labour+IQ'); $ir['strength']=number_format($ir['strength']); $ir['agility']=number_format($ir['agility']); $ir['guard']=number_format($ir['guard']); $ir['labour']=number_format($ir['labour']); $ir['IQ']=number_format($ir['IQ']); $ts=number_format($ts); print" <h3><center>Current Stats and Ranks</center></h3><table border=0 cellpadding=10><tr align=center> <td>[b]Strength[/b] {$ir['strength']} [Ranked: {$ir['strank']}]</td> <td>[b]Agility[/b] {$ir['agility']} [Ranked: {$ir['agirank']}]</td> <td>[b]Guard[/b] {$ir['guard']} [Ranked: {$ir['guarank']}]</td> <td>[b]Labour[/b] {$ir['labour']} [Ranked: {$ir['labrank']}]</td> <td>[b]IQ[/b] {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td> <td>[b]Total[/b] {$ts} [Ranked: $tsrank]</td> </tr></table> </td></tr></table></div>"; $h->endpage(); ?> Now in short i would have thought that adding $gain=$gain/5; so the code looks like this for ($i = 0; $i < $value; $i++) { $gain += (mt_rand(1, 3) / mt_rand(500, 900) * mt_rand(500, 900) * (($will + 20) / 150)); $will = max(0, $will - mt_rand(1, 3)); } $gain=$gain/5; if ($row['jail']) $gain *= 0.5; would have fixed the problem, but for some reason it does not even effect it in the slightest... i have also tried changing the $gain function inside the for loop, so that it says $gain += (mt_rand(1, 3) / mt_rand(500, 900) * mt_rand(500, 900) * (($will + 20) / 150))*0.2; and that doesn't work does anyone have any idea what i am doing wrong.
-
And rather than fix it up, i was simply wondering what the best free gym out there is. could someone copy and paste, or direct me to one... preferably v.1 as i am poor lol... :mrgreen:
-
I know its huge, but it is over my head now.
MobTown replied to MobTown's topic in General Discussion
Re: I know its huge, but it is over my head now. i am confused what you mean, sorry to sound so thick. do you mean make that line $dam=(int)((((int) ($odata['strength']/100)) +1)*(rand(8000,12000)/10000)); look like the one that can be seen about 5 lines down from it? $dam=(int) (($r['damage']*$odata['strength']/$youdata['guard'])*(rand(8000,12000)/10000)); -
I have owned a game since mid April, and since then coded many things myself. Trying to stray away from mods, so that my site is unique. Unfortunately my attack feature has been driving me and my players mad. For some reason the attack is totally random you can attack someone and win, then ten minutes later attack and lose. As mentioned in thread title, I know this is a huge script, but would really appreciate someone helping me to find my failings, and point out any other issues with the code. <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm,0); $_GET['ID'] == (int) $_GET['ID']; die("Sincerist of apologies, but this thing is downright evil... [url='index.php']Return to Index[/url]"); if($ir['jail'] > 0) { die("[b]<font color=red>Criminals are not allowed here. You are in Jail for {$ir['jail']} more minute(s). Until you are out you can't view this page</font>[/b] [url='jail.php']Return to Jail[/url]"); } if($ir['hospital'] > 0) { die("[b]<font color=red>While in hospital you are not allowed here. You are in the Hospital for {$ir['hospital']} more minute(s). Until you are out you can't view this page</font>[/b] [url='hospital.php']Return to Hospital[/url]"); } $_GET['ID'] == (int) $_GET['ID']; if($ir['jail'] > 0) { die("[b]<font color=red>Criminals are not allowed here. You are in Jail for {$ir['jail']} more minute(s). Until you are out you can't view this page</font>[/b] [url='jail.php']Return to Jail[/url]"); } if($ir['hospital'] > 0) { die("[b]<font color=red>While in hospital you are not allowed here. You are in the Hospital for {$ir['hospital']} more minute(s). Until you are out you can't view this page</font>[/b] [url='hospital.php']Return to Hospital[/url]"); } if(!$_GET['ID']) { print "<font color='red'>WTF you doing, bro?</font>[/b]"; $h->endpage(); exit; } else if($_GET['ID'] == $userid) { print "<font color='red'>[b]Only the crazy attack themselves.</font>[/b]"; $h->endpage(); exit; } //get player data $youdata=$ir; $q=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}",$c); $odata=mysql_fetch_array($q); if ($odata['user_level']==2) { die("<center>You cannot attack admin, we have work to do. <a href=index.php>Back</a></center>"); } if($odata['hp'] == 1) { print "[b]<font color='red'>This player is unconscious.</font>[/b] [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if($odata['hospital'] and $ir['hospital']==0) { print "<font color='red'>[b]This player is in hospital.[/b]<font> [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if($odata['jail'] and $ir['jail']==0) { print "<font color='red'>[b]This player is in jail.[/b]<font> [url='index.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if($ir['hospital']) { print "[b]<font color='red'>You can not attack while in hospital.</font>[/b] [url='hospital.php']> Back[/url]"; $h->endpage(); $_SESSION['attacking']=0; exit; } else if ($odata['casino']==1) { die ("<center>You walk to the casino where your victim is, you get to the door and the security guard checks you. He knows you are here to cause trouble and turns you away Click <a href=viewuser.php?u={$_GET['ID']}>here</a> to go back to there profile."); } print "<table width=100%><tr><td colspan=2 align=center>"; if($_GET['wepid']) { if($_SESSION['attacking']==0) { if ($youdata['energy'] >= $youdata['maxenergy']/4) { $youdata['energy']-= $youdata['maxenergy']/2; $me=$youdata['maxenergy']/4; mysql_query("UPDATE users SET energy=energy- {$me} WHERE userid=$userid",$c); $_SESSION['attacklog']=""; } else { print "<font color='red'>[b]You can only attack someone when you have 25% energy</font>[/b]"; $h->endpage(); exit; } } $_SESSION['attacking']=1; $_GET['wepid'] = (int) $_GET['wepid']; $_GET['nextstep'] = (int) $_GET['nextstep']; $qr=mysql_query("SELECT * FROM equipped WHERE eq_itemid={$_GET['wepid']} and eq_userid=$userid",$c); if(mysql_num_rows($qr)==0) { print "<font color='red'>Stop trying to abuse a game bug. You could get hospitalized for that.</font>[/b] [url='index.php']> Home[/url]"; mysql_query("UPDATE users SET hospital=10 hospreason='Trying to cheat' where userid=$userid",$c); die(""); } $qo=mysql_query("SELECT i.*,w.* FROM items i LEFT JOIN weapons w ON i.itmid=w.item_id WHERE w.item_id={$_GET['wepid']}",$c); $r1=mysql_fetch_array($qo); $mydamage=(int) (($r1['damage']*$youdata['strength']/$odata['guard'])*(rand(8000,12000)/10000)); $hitratio=min(50*$ir['agility']/$odata['agility'],95); if($userid==1) { $hitratio=100; } $ohit=0; $yhit=0; print "$wep"; $oogly=0; While ($youdata['hp']>0 OR $odata['hp']>0 OR $oogly<50) { $oogly+=1; if ($wep=="") { $wep="mind but failed every time"; } if(rand(1,100) <= $hitratio) { //choose opp gun $eq=mysql_query("SELECT iv.*,i.*,w.* FROM equipped iv LEFT JOIN items i ON iv.eq_itemid=i.itmid LEFT JOIN weapons w ON iv.eq_itemid=w.item_id WHERE iv.eq_userid={$_GET['ID']} AND ( i.itmtype=3 OR i.itmtype=4 )",$c); if(mysql_num_rows($eq) == 0) { $wep="Fists"; $dam=(int)((((int) ($odata['strength']/100)) +1)*(rand(8000,12000)/10000)); } else if(mysql_num_rows($eq) == 1) { $r=mysql_fetch_array($eq); $wep=$r['itmname']; $dam=(int) (($r['damage']*$odata['strength']/$youdata['guard'])*(rand(8000,12000)/10000)); } else { $cnt=0; while($r=mysql_fetch_array($eq)) { $enweps[]=$r; $cnt++; } $weptouse=rand(0,$cnt-1); $wep=$enweps[$weptouse]['itmname']; $dam=(int) (($enweps[$weptouse]['damage']*$odata['strength']/$youdata['guard'])*(rand(8000,12000)/10000)); } $q3=mysql_query("SELECT a.Defence FROM equipped iv LEFT JOIN items i ON iv.eq_itemid = i.itmid LEFT JOIN armour a ON i.itmid=a.item_ID WHERE i.itmtype=7 AND iv.eq_userid={$_GET['ID']}",$c); if(mysql_num_rows($q3)) { $mydamage-=mysql_result($q3,0,0); } $shifoo1+=$mydamage; if($mydamage < 1) { $mydamage=1; } $odata['hp']-=$mydamage; if($odata['hp']==1) { $odata['hp']=0;$mydamage+=1; } mysql_query("UPDATE users SET hp=hp-$mydamage WHERE userid={$_GET['ID']}",$c); $ohit+=1; $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. Using his {$r1['itmname']} {$ir['username']} hit {$odata['username']} doing $mydamage damage ({$odata['hp']})</font> \n"; } else { $_SESSION['attacklog'].="<font color=red>{$_GET['nextstep']}. {$ir['username']} tried to hit {$odata['username']} but missed ({$odata['hp']})</font> \n"; } if ($wep=="") { $wep="mind but failed every time"; } if($odata['hp'] <= 0 || $oogly==50) { if ($shifoo1< $shifoo2) { $youdata['hp']=0; mysql_query("UPDATE users SET hp=0 WHERE userid=$userid",$c); die ("<font color=green><center>You hit {$odata['username']} $ohit times with your {$r1['itmname']}</center></font> <font color=red><center>{$odata['username']} hit you $yhit times with their $wep</center></font> <form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"); } else { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; mysql_query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}",$c); die ("<font color=green><center>You hit {$odata['username']} $ohit times with your {$r1['itmname']}</center></font> <font color=red><center>{$odata['username']} hit you $yhit times with their $wep </center></font> <table class=sample><tr><td align=center>Use this option to keep victim in hospital for half hour.</td></tr><tr><td> <form action='attackleave.php?ID={$_GET['ID']}&hitmen={$_GET['hitmen']}' method='post'> <input type='submit' value='Leave Them' style='width:100%'/> </form> </td></tr> <tr><td align=center>Use this option to to steal a small amount of the victims money.</td></tr><tr><td> <form action='attackmug.php?ID={$_GET['ID']}&hitmen={$_GET['hitmen']}' method='post'> <input type='submit' value='Mug Them' style='width:100%'> </form> </td></tr> <tr><td align=center>Use this option to gain EXP points from a hit. It is also the only option that the hitman bounty supports.</td></tr><tr><td> <form action='attackhosp.php?ID={$_GET['ID']}&hitmen={$_GET['hitmen']}' method='post'> <input type='submit' value='Hospitalize Them' style='width:100%'> </form></td></tr></table>"); } } else { $hitratio=min(50*$odata['agility']/$ir['agility'],95); if($odata['userid']==1) { $hitratio=100; } if(rand(1,100) <= $hitratio) { $q3=mysql_query("SELECT a.Defence FROM equipped iv LEFT JOIN items i ON iv.eq_itemid = i.itmid LEFT JOIN armour a ON i.itmid=a.item_ID WHERE i.itmtype=7 AND iv.eq_userid=$userid",$c); if(mysql_num_rows($q3)) { $dam-=mysql_result($q3,0,0); } $shifoo2+=$dam; if($dam < 1) { $dam=1; } $youdata['hp']-=$dam; mysql_query("UPDATE users SET hp=hp-$dam WHERE userid=$userid",$c); $ns=$_GET['nextstep']+1; $yhit+=1; $_SESSION['attacklog'].="<font color=blue>{$ns}. Using his $wep {$odata['username']} hit {$ir['username']} doing $dam damage ({$youdata['hp']})</font> \n"; } else { $ns=$_GET['nextstep']+1; $_SESSION['attacklog'].="<font color=blue>{$ns}. {$odata['username']} tried to hit {$ir['username']} but missed ({$youdata['hp']})</font> \n"; } if ($wep=="") { $wep="mind but failed every time"; } if($youdata['hp'] <= 0 || $oogly==50) { if ($shifoo1< $shifoo2) { $youdata['hp']=0; mysql_query("UPDATE users SET hp=0 WHERE userid=$userid",$c); die ("<font color=green><center>You hit {$odata['username']} $ohit times with your {$r1['itmname']}</center></font> <font color=red><center>{$odata['username']} hit you $yhit times with their $wep</center></font> <form action='attacklost.php?ID={$_GET['ID']}' method='post'><input type='submit' value='Continue' />"); } else { $odata['hp']=0; $_SESSION['attackwon']=$_GET['ID']; mysql_query("UPDATE users SET hp=0 WHERE userid={$_GET['ID']}",$c); die ("<font color=green><center>You hit {$odata['username']} $ohit times with your {$r1['itmname']}</center></font> <font color=red><center>{$odata['username']} hit you $yhit times with their $wep </center></font> <table class=sample><tr><td align=center>Use this option to keep victim in hospital for half hour.</td></tr><tr><td> <form action='attackleave.php?ID={$_GET['ID']}&hitmen={$_GET['hitmen']}' method='post'> <input type='submit' value='Leave Them' style='width:100%'/> </form> </td></tr> <tr><td align=center>Use this option to to steal a small amount of the victims money.</td></tr><tr><td> <form action='attackmug.php?ID={$_GET['ID']}&hitmen={$_GET['hitmen']}' method='post'> <input type='submit' value='Mug Them' style='width:100%'> </form> </td></tr> <tr><td align=center>Use this option to gain EXP points from a hit. It is also the only option that the hitman bounty supports.</td></tr><tr><td> <form action='attackhosp.php?ID={$_GET['ID']}&hitmen={$_GET['hitmen']}' method='post'> <input type='submit' value='Hospitalize Them' style='width:100%'> </form></td></tr></table>"); } } } } } else if ($odata['hp'] < $odata['maxhp']/2) { print "You can only attack those who have at least 1/2 their max health"; $h->endpage(); exit; } else if ($ir['gang'] == $odata['gang'] && $ir['gang'] > 0) { print "{$odata['username']} is in your gang. Behavior like that will see you killed."; $h->endpage(); exit; } else if ($youdata['energy'] < $youdata['maxenergy']/4) { print "You can only attack someone when you have 25% energy"; $h->endpage(); exit; } else if ($youdata['location'] != $odata['location']) { print "You can only attack someone in the same location!"; $h->endpage(); exit; } else { } print "</td></tr>"; if($youdata['hp'] <= 0 || $odata['hp'] <= 0 || $oogly==50) { print "</table>"; } else { print "<tr><td align=center>Your Health: {$youdata['hp']}/{$youdata['maxhp']} Opponents Health: {$odata['hp']}/{$odata['maxhp']}</td></tr>"; $mw=mysql_query("SELECT iv.*,i.* FROM equipped iv LEFT JOIN items i ON iv.eq_itemid=i.itmid WHERE iv.eq_userid=$userid AND (iv.eq_itemtype = 3 || iv.eq_itemtype = 4)",$c); print "<tr><td colspan=2 align='center'>Attack with: "; while($r=mysql_fetch_array($mw)) { if(!$_GET['nextstep']) { $ns=1; } else { $ns=$_GET['nextstep']+2; } print "[url='attack.php?nextstep=$ns&ID={$_GET[']{$r['itmname']}[/url] "; } print "</table>"; } $h->endpage(); ?> P.S As you can prob see from the variable names i was watching Kung Fu Panda while trying to fix this.
-
Re: Question ok... so i have installed PHP-Nuke version 8 (Free with my host as opose to latest v.9) and i may be missing a trick, but it still has separate users. I don't see how it would help.
-
Re: Question Hate to sound negative, but i have already done that before posting here. http://www.phpbb.com/community/viewtopic.php?f=46&t=1056945 someone has tried, but they are a little confused as to what i want, and think i want my site to use the phpbb login.
-
Re: Question Thanks for the advice, but to be honest with you I have tried to do as said, however I am new to PHP and the MCCODEs style is totally different from that In PHPBB I can't even see a query that looks the same as those used in MCCODES in the PHPBB pages.
-
Does anyone know of any high tech open source forums, where you specify where in the database the username and password are stored. So that users can log in that are already registered to my site, using the username and password hash in my database?
-
Re: Please Help. Thanks Tonka (+1), i knew it was going to be something simple... just couldn't quite put my finger on it.
-
Ok... I'll start with a couple of apologies, as I am not sure where this post is supposed to go, secondly this is probably the simplest thing in the world, yet it is still giving me trouble. So basically I want to print some form elements but they have java script functions attached to them. Now they only work if the quotations, (" and ') are kept in the same place, however by leaving them in this makes the ( print" code here "; ) mess up. Does anyone know how to work around it. My code can be seen below. print" <button onclick="addPTag(document.getElementById('text'),'B')">[b]B[/b]</button> <button onclick="addPTag(document.getElementById('text'),'I')">[i]I[/i]</button> <button onclick="addPTag(document.getElementById('text'),'U')"><u>U</u></button> "; Once again I apologise if this is simple, and or in the wrong place.
-
Re: Another Question... Thanks all for your help, yes the problem has been fixed.
-
Re: Another Question... cheers for the help guys and girls, the brute force debugging really is a good idea. Nyna, could I ask for a link to that tool of yours though? thanks again.
-
Probably a simply solution, but recently a friend of mine tried to help code on my site. Since, then an error arises when trying to access a page. I don't know what this means in the slightest, so wondered if you people could help me out. My page likes like this. <?php session_start(); require "global_func.php"; $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); if (!$_GET['ID']) { die ("Get outta here!"); } if($_GET['action'] == "cancel") { die ("You have cancelled your donation. Please donate later..."); } else if($_GET['action'] == "done") { $id=$_GET['ID']; $type=$_GET['type']; if($_GET['type']==1) { mysql_query("INSERT INTO inventory VALUES ('','34','$id','5')",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=1"); } else if($_GET['type']==2) { mysql_query("INSERT INTO inventory VALUES ('','34','$id','30')",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=2"); } else if($_GET['type']==3) { mysql_query("INSERT INTO inventory VALUES ('','34','$id','60')",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=3"); } else if($_GET['type']==4) { mysql_query("UPDATE users SET crystals=crystals+250 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=4"); } else if($_GET['type']==5) { mysql_query("UPDATE users SET crystals=crystals+1500 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=5"); } else if($_GET['type']==6) { mysql_query("UPDATE users SET crystals=crystals+3000 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=6"); } else if($_GET['type']==7) { mysql_query("INSERT INTO inventory VALUES ('','34','$id','5')",$c); mysql_query("UPDATE users SET money=money+10000, crystals=crystals+250, donatordays=donatordays+30 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=7"); } else if($_GET['type']==8) { mysql_query("INSERT INTO inventory VALUES ('','34','$id','30')",$c); mysql_query("UPDATE users SET money=money+50000 crystals=crystals+1500, donatordays=donatordays+60 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=8"); } else if($_GET['type']==9) { mysql_query("INSERT INTO inventory VALUES ('','34','$id','60')",$c); mysql_query("UPDATE users SET money=money+250000, crystals=crystals+3000, donatordays=donatordays+90 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=9"); } else if($_GET['type']==14) { mysql_query("UPDATE users SET donatordays=donatordays+30 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=10"); } else if($_GET['type']==15) { mysql_query("UPDATE users SET donatordays=donatordays+60 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=11"); } else if($_GET['type']==16) { mysql_query("UPDATE users SET donatordays=donatordays+90 WHERE userid=$id",$c); mysql_query("INSERT INTO dps_process VALUES ('$id',unix_timestamp(),'$type')",$c); header("Location: donatorcomplete.php?type=12"); } else { die ("Don't even try it"); } } if ($id!==$userid) { mysql_query("INSERT INTO events VALUES ('',$id,unix_timestamp(),0,'You recieved a donation pack off $username($userid)')",$c); } ?> Any other suggestions for improvement would also obviously be appreciated. Please use the [CODE]...[/CODE] tags
-
Re: MYSQL.PHP Hi again, as previously mentioned, i believed the problem to be underhand since doing everything suggested here. However since the last post, although i myself have not experienced any problems i have had numerous emails telling me that the error still exists, is there anything else i can do?
-
Re: MYSQL.PHP thank you for your support here, i think the problem is now underhand. btw i do have a real host lol :-D i would post name, but i would deem it as advertising so can only assume admin would as well. if any problem arises again i will be sure to ask here. +1 to all.
-
Re: MYSQL.PHP ok so i may sound like a noob, but i tried adding msyql_close($c) to the end of mysql.php But this simply stopped all my queries from working, showing an error, If mysql_close() is indeed the answer, where should it be put? This is what I suggested to the host when they replied with the close sql connections. Again, any help would be greatly appreciated.
-
Re: MYSQL.PHP thank you for the response, but the thing is they are saying it is not. as mentioned they think it is due to me not closing my mysql connction.
-
Recently I have purchased version 1 (yeah i'm cheap) of MCCodes, i have had no problems up until the last few days, in those few days i keep getting the message I got onto my host, as i believed that is where the fault lied, however they have told me it is probably due to not closing the sql connection. Could some please adivise me if this is indeed the problem, my mysql.php file can be seen below, (naturally i have * sensitive data)