Jump to content

R1der

Members
  • Posts

    104
  • Joined

  • Last visited

    Never

Everything posted by R1der

  1. Erm the update query works fine how it is.. Why would that have anything to do with the INSERT query?
  2. Ok i have made a classifieds page but when you click "Post" it inserts the 'id' 'username' but when it comes to adding the 'text' part it INSERTS '0' and i cant understand why :S Can anyone help with this? <? session_start(); include("gameconfig.php"); $title = "Classifieds"; if(!$email || !$password){ error("field"); exit; } if($playerinfo[password] != $password){ error("password"); }else{ include("top.php"); $cost=1000*$playerinfo['level']; echo "<center>Tribal Classifieds<br><br></center>"; echo "<center>It will cost you $cost gold to post a advertisement<br><br></center>"; echo "<center><form method=post action=classifieds.php?action=post>Advertise: <input name=post size=12> <INPUT TYPE=SUBMIT VALUE=Post></FORM></center>"; $select = mysql_query("select * from classifieds order by id DESC LIMIT 20"); while($lis = mysql_fetch_array($select)) if($playerinfo['status'] !="Member"){ echo "<center>[<a href=classifieds.php?step=delete&id=$lis[id]>D</a>] "; echo "$lis[username]: $lis[text]</center><br>"; }else{ echo "$lis[username]: $lis[text]</center><br>"; } if($action == "post") { $post = abs($post); $post = str_replace("-","",$post); $cost=1000*$playerinfo['level']; if($playerinfo['gold'] > $cost){ mysql_query("UPDATE userdb set gold=gold-$cost WHERE id='$playerinfo[id]'"); mysql_query("INSERT INTO classifieds (id, username, text) VALUES ('', '$playerinfo[username]', '$post')") or die(mysql_error()); echo "<center>You sucessfully added your advertisement.</center>"; }else{ echo "<cener>You do not have enough gold to proceed</center>"; } } if ($step == delete) { echo "News deleted. <a href=classifieds.php>Back</a>"; $remove = mysql_query("delete from classifieds where id='$id'"); } include("bottom.php"); } ?> Thanks. Oh and also can you tell me if my code (test box) is secure enough from sql injections? Thanks for your time
  3. Dont worry about it, Ill just remove that bit of coding as its fine when i remove that anyways Thanks for your time and your help
  4. I am affraid i cant do that. By doing that people will steal the coding
  5. No because it goes like this print "text text text text text text text text ";
  6. global $ir,$c,$h,$gangdata; $pq=mysql_query("SELECT * FROM users WHERE userid={$gangdata['gangPRESIDENT']}",$c); $ldr=mysql_fetch_array($pq); $vpq=mysql_query("SELECT * FROM users WHERE userid={$gangdata['gangVICEPRES']}",$c); $coldr=mysql_fetch_array($vpq); print "<h3><u>{$gangdata['gangNAME']} Gang</u></h3><hr />
  7. if($gangdata['gangPIC']) //line 62 { print "<img src='{$gangdata['gangPIC']}' alt='Gang Picture' width='468' height='60' /><hr />"; } else { print "<b>No Gang Picture</b><hr />"; } I get this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /****/******/*******/******.php on line 62 It all worked fine till i added that, i could'nt spot a problem with it and its prob something simple. Thanks for your time
  8. Thx for the reply but i tried $user before i changed it to $users
  9. ok i am having a problem with this bit of codeing (No errors) [code]<? if($user['wilderness'] == 1 && $ir['posX'] == $users['posX'] && $ir['posY'] == $user['posY']){ print "{$user['username']}";}?>[/code] ok i have tried everything i can think of to get this to work, Basicly i want it to show the username of all users  who is in the same place as them on like a coordinate map kinda thing. But i cant get it to show the users even tho there are users in the same location as them. This is how it shows You are currently at (0,0) North West          East South You are see: *****(here is where it should show the users)***** Hope this makes sence
  10. R1der

    error

    yes i am still getting the error and no i did'nt cut any of the code out. Also that is a good point about random lol
  11. R1der

    error

    [code]while( $youdata > 0 && $odata > 0) { $opponents_health -= random(5,10); } [/code]
  12. R1der

    error

    No because i fixed that and still get the same error
  13. R1der

    error

    But i am sure even if it was that. it would'nt cause this error
  14. R1der

    error

    i get this error from this code. Can anyone help with this? Parse error: syntax error, unexpected ')' in /****/******/*****/****.php on line 2 [code]while($youdata > 0 && $odata >) { $opponents_health -= random(5,10); }[/code] Thx
  15. R1der

    MD5 help

    lol kk, Can anyone suggest another way i can do this? i want away my users can get there password if thay forget it.
  16. R1der

    MD5 help

    Ok stop confusing me lol Can this be done or not? :P
  17. R1der

    MD5 help

    Ah damn! Thx anyways for the reply
  18. R1der

    MD5 help

    ok i got a forgot password page what it does is thay type in there username and then it emails them there password. but the password is md5 in the database can you help me make it so it send them there password decrypted? [code$body = "Hello {$b['username']}! Your password for www.********.com is {$b['userpass']}. If you have any other problems please mail *****@********.com"; [/code This si the part that needs help this part of the code is the body of the email you get with there password in it Thx
  19. There are 5 i have just fixed it i removed " from (''$pet Thanks for all your help
  20. $sql = "INSERT INTO pets_owned VALUES(''$pet, $userid, 1, 1, 1)"; $result = mysql_query($sql, $c); if (!$result){    echo "Couldn't execute $sql:" . mysql_error(); } I think i posted the wrong code b4
  21. [code]$sql = "INSERT INTO pets_owned VALUES('' $pet, $userid, 1, 1, 1)"; $result = mysql_query($sql, $c); if (!$result){   echo "Couldn't execute $sql:" . mysql_error(); } [/code]
  22. ok come across another problem lol. when trying to buy a pet i get this Couldn't execute INSERT INTO pets_owned VALUES('' 1, 1, 1, 1, 1):You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1, 1, 1, 1, 1)' at line 1 the first 1 being the pet id second being the userid third , forth and fifth being strength,agility,guard Anyone have any ideas? let me know if ya wanna see code
  23. Ok i fixed it now Thx for your help :)
  24. ok its working now strange lol. i get this now Couldn't execute INSERT INTO pets_owned VALUES('', 1, 1, 1, 1, 1):Column count doesn't match value count at row 1You bought a Greyhound / Poodle!
×
×
  • 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.