Jump to content

Phpfr3ak

Members
  • Posts

    110
  • Joined

  • Last visited

    Never

Everything posted by Phpfr3ak

  1. Sorry, the code is to echo a certain aspect from the database that is selected i.e /playerranks.php?ReportType=score would echo the score colum, /playerranks.php?ReportType=cash_Stolen would echo the cash_stolen colum and so on, Sorry for not being so clear.
  2. I'm unsure as to why thsi doesnt work.. any clues? $scoretype = mysql_real_escape_string($users['scoretype']); <?php echo $scoretype ?>
  3. Thanks guys! Once again on the ball thorpe, appreciate all the help you have provided over the last few days.
  4. does anyone see why i get an unexpected T_VARIABLE here? Ive varied the code from something i had that was working so i don't see why it fails to work, any help would be great thanks. <?php require_once('_includes/db_connection.php'); if ($result = mysql_query('SELECT Banned FROM users WHERE username = '$username'')) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); if ($row['Banned'] != No) { echo "You are banned"; exit; } } } ?>
  5. Thank you very much thorpe, made that very clear i now have an understanding, many thanks!
  6. Yea... i tried ... no luck :/ $mode = mysql_query('SELECT mode FROM settings'); <?php if($mode == 1){ ?> <?php } else {?> <br /><br /> <p><span style="margin-left:8px"> <?php include("endgame.php"); }?></td>
  7. how would i define the variable to show $mode being under settings>mode in the database, sorry for my lack of clarity before, hope this explains it better..
  8. <?php if($mode == 1){ ?> is what i tried but i have no clue as to how to establish $mode as being settings>mode in the sql database, really rather new to it all.
  9. Probably real basic but i cant get to grips with it for the life of me, can anyone correct this and explain how its done please so i gain a better understanding of php thanks. <?php if(SELECT mode FROM settings WHERE mode = 1){ ?>
  10. I want the following script to run attack_code.php when all the statements come back as being ok.. only issue is on the last line i do }else{ include("attack_code.php"); yet it runs the attack_code anyway, its rather odd as if i leave attack_code.php at the top of the page it shows the error messages of the statements below any clues? <?php if($playerID == $defender) { echo "<div>You can't attack yourself.</div>"; include("exit.php"); exit; } /// below shows the noto forumla $cashnoto = round($steal_amount / 100); $drugnoto = round($steal_amount * 15); ?><br /> <?php $sql = "SELECT * FROM messages WHERE to_username = '$defender_info[username]' AND from_username = '$playerdata[username]' AND type = 'Combat' ORDER BY id DESC LIMIT 1"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $now = time(); $lastattack = strtotime($res['timestamp']); $timesince = $now - $lastattack; $nextatk = round((10800 - $timesince) / 60); if($timesince < 10800){ echo "You can only attack the same player once every 3 hours.<br><br> You can attack this player again in $nextatk minutes."; include("exit.php"); exit; }else{ $sql = "SELECT hits FROM users WHERE id = $playerID"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $hits = $res['hits']; if($hits < 1){ echo "You have no available hits. New hit allowances are granted every ten minutes on the :05's"; include("exit.php"); exit; }else{ ?>
  11. Doohh can't believe i missed that, Thank you very much.
  12. Hi for some reason i get parse error: syntax error, unexpected T_EXIT in C:\Program Files\EasyPHP-5.3.3\www\htdocs\attack_code.php on line 44, im unsure as to why as the code below looks good to me? If its wrong could someone correct em and explain as to why Thanks if($playerID == $defender) { echo "<div>You can't attack yourself.</div>"; include("exit.php"); exit; }else{ if($timesince < 10800){ echo "You can only attack the same player once every 3 hours."; include("exit.php") exit; }else{ if($hits < 1){ echo "You have no available hits. New hit allowances are granted every ten minutes on the :05's"; include("exit.php") exit; }else{ the part below the last }else{ is irrelevant and works so Ive not included
  13. Thats exactly how i have it set up at the moment via the message is sent as an attack message instead of say player message... yet its still not working if i leave the page and go to attack again the error message is there... yet if i refresh the page after the attack i can use all the hits/as many attacks as i want.
  14. The issue is that if you f5 once attacking another player you can attack them again without any error message... Below is the code, is there a way to prevent the refresh from making the attack happen again? <?php $sql = "SELECT * FROM messages WHERE to_username = '$defender_info[username]' AND from_username = '$playerdata[username]' AND type = 'Combat' ORDER BY id DESC LIMIT 1"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $now = time(); $lastattack = strtotime($res['timestamp']); $timesince = $now - $lastattack; $nextatk = round((10800 - $timesince) / 60); if($timesince < 10800){ echo "You can only attack the same player once every 3 hours.<br><br> You can attack this player again in $nextatk minutes."; } else{ $sql = "SELECT hits FROM users WHERE id = $playerID"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $hits = $res['hits']; if($hits < 1){ echo "You have no available hits. New hit allowances are granted every ten minutes on the :05's"; } else{ ?>
  15. I think ive found the issue i think its something along the lines of; if ($playerdata($res[$level_type]) < $res['level_req']) { Yet its not working any ideas? :s sorry im really crummy at php atm trying to gather the basics
  16. It's echoing You don't have the required level to learn this skill, but i don't see as why...
  17. Hi, fairly new to php, can't seem to figure out why this isn't working, it did before i added the $level_type aspect in... which i need to work with the way ive changed my script, any ideas as to why its not working? if ($token == $_SESSION['token']){ $sql = "SELECT * FROM skills WHERE id=$sid"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); //code goes here if ($playerdata['$level_type'] < $res['level_req']) { echo "You don't have the required level to learn this skill<br><br><a href='doresearch.php?sid=$res[id]'>Return to skill points!</a>"; } else {
  18. Hi, I'm wondering how i would go about making a drop down menu in php to insert the option into users > Maint of my database, if anyone has any tutorials or examples it would be great, Thanks a lot.
  19. From header <?php require_once('check.php'); $username = $_SESSION['username']; require_once('server.php'); require_once('stats.php'); $admin = $crewed = $playerdata['admin']; //SET OTHER PLAYERS ID $ID = mysql_real_escape_string($_GET['id']); //Get player data for current player $query = mysql_query("SELECT * FROM users WHERE username = '$username'"); $result = mysql_fetch_array($query); $playerID = $result['id']; $query = mysql_query("SELECT * FROM users WHERE id = '$playerID'"); $playerdata = mysql_fetch_array($query); //end current player data //if NO ID IS SET, MAKE OTHER USERS ID OUR ID if($ID == ""){ $ID = $playerID; } //data if viewing another profile $query = mysql_query("SELECT * FROM users WHERE id = '$ID'"); $data2 = mysql_fetch_array($query) or die(mysql_error()); $CrewID = $res['crew_id']; //end other users data //crew_data $crewed = $playerdata['in_crew']; if($crewed == 1){ //get crew name and id $sql = "SELECT * FROM player_crews WHERE player_id = $playerID"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $CrewID = $res['crew_id']; $sql = "SELECT name FROM crews WHERE id = $CrewID"; $que = mysql_query($sql) or die(mysql_error()); $res = mysql_fetch_array($que); $cname = $res['name']; } ?>
  20. The statements are in header.php yea, they work with other pages so its something on this page for sure not the header
  21. The full code is below, i didn't notice i hadn't removed the users part thanks for pointing it out... now get the error varse error: syntax error, unexpected '}' in C:\Program Files\EasyPHP-5.3.3\www\htdocs\leavecrew.php on line 18, dont see why :s <?php include("header.php"); ?> <td width="375" height="586" valign="top" colspan="2" bgcolor="#1a2940" align="center" style="border-bottom:thin #FFF solid;"> <br /> <br /><?php$CrewID = mysql_real_escape_string($_GET['CrewID']); $up = "DELETE FROM player_crews WHERE id = $playerID"; mysql_query($up) or die(mysql_error()); $up = "UPDATE crews SET members = members - 1 WHERE id = $CrewID"; mysql_query($up) or die(mysql_error()); $up = "UPDATE users SET in_crew = 0 WHERE id = $playerID"; mysql_query($up) or die(mysql_error()); echo "You have successfully left this crew."; } else { echo "Error";?></td> <?php include("footer.php"); ?>
  22. I don't see what the heck it could be. kind of lost anyone provide a hand please? Parse error, unexpected T_STRING on line 11, but I don't see it Parse error: syntax error, unexpected T_STRING in C:\Program Files\EasyPHP-5.3.3\www\htdocs\leavecrew.php on line 11 <?php$CrewID = mysql_real_escape_string($_GET['CrewID']); UPDATE users SET $up = "DELETE FROM player_crews WHERE id = $playerID"; mysql_query($up) or die(mysql_error()); $up = "UPDATE crews SET members = members - 1 WHERE id = $CrewID"; mysql_query($up) or die(mysql_error()); $up = "UPDATE users SET in_crew = 0 WHERE id = $playerID"; mysql_query($up) or die(mysql_error()); echo "You have successfully left this crew."; } else { echo "Error"; } }?>
  23. Thanks for that i've done the following, only problem is it shows the noto as say 239,952,380.00 is there a way to remove the . as its not needed in the manner im using it and it looks out of place, thanks. <?php echo number_format($data2['noto'], 2, '.', ','); ?></strong>xp)</span></td>
  24. Sorry i wasn;t very clear, what i actually meant was numbers that i currently want shown as money form are shown as say 345678 where as id like them to be shown as 345,678
  25. Hi, basically i have data in my database i want to represent as cash, i currently put the dollar sign infront of each echo which is fine, but how would i go about adding , to the php code itself as you cannot do this from the sql database..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.