Jump to content

www

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

www's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Perfect advice. After the 10hour haul I only needed a little break before I came back, looked at the code and felt incredibly embarrassed and pressed a single backspace haha. Thanks requinix. Thanks spiderwell. Fatigue is killing my brain haha.
  2. I'm writing a very simple clean login session as a demonstration to friends. I've been over this code a lot of times and can't fault it, but obviously I am wrong.. or maybe xampp is just having one of those days. Undefined Index: username on line 30, login.php all files involved are attached. Thanks in advance. <?php session_start(); $username = $_POST['username']; $password = $_POST['password']; if ($username&&$password) { $connect = mysql_connect("localhost","root","") or die("couldn't connect"); mysql_select_db("login") or die("couldn't find db"); $query = mysql_query("SELECT * FROM users WHERE username='$username'"); $numrows = mysql_num_rows($query); if ($numrows!=0) { //login code while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['username']; $dbpassword = $row['password']; } //check is pass & user match if ($username==$dbusername&&$password==$dbpassword) { echo "you're in click here to enter the <a href='member.php'>member page</a> haha"; $_SESSION['username']==$dbusername; } else echo "incorrect password"; } else die("that user doesn't exist"); } else die("failed to connect") ?> [attachment deleted by admin]
×
×
  • 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.