Jump to content

R1der

Members
  • Posts

    104
  • Joined

  • Last visited

    Never

Posts posted by R1der

  1. 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

  2. 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 />

  3. 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

  4. 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
  5. 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
  6. 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
  7. 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
×
×
  • 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.