Announcement

Collapse
No announcement yet.

Can Security Be Tightened on my code please?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Paul M
    replied
    Originally posted by Icheb View Post
    Whoops.

    How else do you think "remember me" works?
    Why don't you look at the code and see - vb does not store your password anywhere.

    Leave a comment:


  • DirectPixel
    replied
    Originally posted by Icheb View Post
    Whoops.

    How else do you think "remember me" works?
    IIRC, that contains your password hash only. Never your plaintext.

    Leave a comment:


  • Floris
    replied
    Originally posted by NEWLiNE View Post
    Hi, can security be tightened on my code, please help, thank you.
    Code:
    PHP Code:
    <?php 
    error_reporting
    (E_ALL); 
    include(
    "config.php"); 
    if (!
    $logged['username']) 

    if ( !isset(
    $_POST['login']) || !$_POST['login'] ) 

    echo(

    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> 
    </td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <a href=\"register.php\">Register Here</a> 
    </td></tr></table></form></center>"
    ); 

    if(!empty(
    $_POST['login'])) { 
    //if ($_POST['login']) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password md5($_POST['password']); 
    // the above lines set variables with the submitted information. 
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data mysql_fetch_array($info); 
    if(
    $data['password'] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"
    }else{ 
    // the password was right! 
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id"$user['id'],time()+(60*60*24*5), "/"""); 
    setcookie("pass"$user['password'],time()+(60*60*24*5), "/"""); 
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
    header("Location: account.php"); 



    else 

    header("Location: account.php"); 

    ?>
    You might want to take a look here
    http://www-128.ibm.com/developerwork...void5PHPerrors

    Leave a comment:


  • Icheb
    replied
    Whoops.

    How else do you think "remember me" works?
    Attached Files

    Leave a comment:


  • DirectPixel
    replied
    vB doesn't store your password in a cookie. It stores your session in there, AFAIK.

    Leave a comment:


  • Icheb
    replied
    Originally posted by Andrew111888 View Post
    I wouldn't store a password in a cookie, but that's just me.
    Yes, vB's security is really bad because they store passwords in a cookie. Just like the rest of the internet.

    Leave a comment:


  • DirectPixel
    replied
    Originally posted by NEWLiNE View Post
    bump, any advice?
    Like I said, path your SQL injection vulnerabilities. You're not sanitizing your $_POST variables.

    Leave a comment:


  • Andrew111888
    replied
    I wouldn't store a password in a cookie, but that's just me.

    Leave a comment:


  • MrNase
    replied
    No idea about the security but have a look at http://php.net/heredoc

    It should help you a lot to clean up your code (removing 'echo("' and all those unneeded '\')

    Leave a comment:


  • mentalrz
    replied
    Originally posted by NEWLiNE View Post
    bump, any advice?
    offer money, you be suprised at the reponse.

    Leave a comment:


  • NEWLiNE
    replied
    bump, any advice?

    Leave a comment:


  • Lats
    replied
    Part of the forum restructure I guess...
    http://www.vbulletin.com/forum/showthread.php?t=193554

    Leave a comment:


  • ManagerJosh
    replied
    No need to jump the poor guy Lats. He's just looking for some advice to tighten up security in his PHP code.

    Leave a comment:


  • DirectPixel
    replied
    Originally posted by Lats View Post
    Are you aware this is the vBulletin support forums?
    ...in which he posted in the off-topic Chit-Chat forums. Nothing wrong with that. It may not be the best place to ask a question like this, but surely, it's not against the rules.

    Leave a comment:


  • NEWLiNE
    replied
    yes thank you, i was hoping to get some off vbulletin topic help from a developer,

    Leave a comment:

Related Topics

Collapse

Working...
X