Note that there are some explanatory texts on larger screens.

plurals
  1. POPhp Log In, Cannot continue session
    text
    copied!<p>So basically I am trying to run a login system and use the user's data to update a page in real time, unfortunately I cannot continue the session and every time I try to echo the user nothing happens, here is my code for logging in. </p> <pre><code> &lt;?php $host="IPADRESS"; // Host name $username="web11-sign-up"; // Mysql username $password="w0lfbane01#"; // Mysql password $db_name="web11-sign-up"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $mypassword = md5($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION["$myusername"]; $_SESSION["$mypassword"]; header("location:Scene-Selection/"); } else { echo "Wrong Username or Password"; } ?&gt; </code></pre> <p>I did not realize that this section was not working until I started on another section of the site. I could not retrieve any information from the database.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload