Jump to content

dabaR

Members
  • Posts

    189
  • Joined

  • Last visited

Posts posted by dabaR

  1. die() simply prints strings... false is the empty string, there you have automatic type conversion.

     

    If you are still asking what is the problem with the code, it is still the same, unless you changed that...

     

    You do not keep information about the fact the person logged in across requests. So the person logs in on a post, on the next get the $session is created anew, without it being logged in. In other words, your "Session" is not doing the thing that is the essence of being a Session.

     

    Consider that, and try to figure out how you are going to deal with it. Usually people use $_SESSION to hold an identifier and check whether the person requesting the page is logged in already. That's really pretty much your only option.

     

    </incoherentMorningTalk>

  2. Hi again,

     

    echo "". $row['image_location'] . ""; seems unnecessarily chatty. Seems like echo $row['image_location']; would do the same.

     

    I would rewrite

    echo "<img src=".$row['image_location']." height=100 width=100 border=0>";
    

    as

    printf('<img src="%s" height="100" width="100" style="border: 0" />', $row['image_location']);
    

     

    Because I think that is more solid HTML.

  3. So how about something like SELECT TOP 1 * FROM table WHERE (for - against) > $voting_score OR ((for-against) = $voting_score and id > $current_id) ORDER BY (for - against) ASC, id ASC

     

    Sorry about it being so pseudocody instead of specific. You'll have to translate to your exact code. That code is meant to have all interpolations of variables into the SQL string escaped using something like mysql_real_escape_string() as well.

  4. $query = INSERT INTO Users(user, date_registered, password, email) VALUES ("eric", "12/12/12, test, eric@eric.com");
    

     

    There are no quotes around the query string. You need:

    $query = 'INSERT INTO Users(user, date_registered, password, email) VALUES ("eric", "12/12/12, test, eric@eric.com")';
    

×
×
  • 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.