$connect = mysql_connect("localhost","root","") or die ("Could not connect to databade.");
mysql_select_db("login") or die ("Could not find database.");
$query = mysql_query("SELECT * FROM users WHERE username='".mysql_real_escape_string($username)."' and password='".mysql_real_escape_string($password)."' LIMIT 1");
$numrows = mysql_num_rows($query);
if($numrows != 0)
{
while ($row = mysql_fetch_array($query))
{
$_SESSION['username'] = $row['username'];
$_SESSION['email'] = $row['email'];
$_SESSION['phone'] = $row['phone'];
$_SESSION['mobile'] = $row['mobile'];
$_SESSION['web'] = $row['web'];
}
header("location: home.php");
}
else {
echo "Your username and / or password is incorrect";
}
}
else {
echo "Please enter a username and password";
}
I am sorry. I added the var dump to the top of the login.php page which is the page that executes when you click login button. and I dont see anything change.
When I add it to the profile page that all the code has been on I get this at the top left screen
array(0) { }
i have fixed the session start issue it does show up in the page anymore. its now set up correctly. I have the code in the login.php set up the way you posted and it works fine. Now once you log in you are redirected to profile.php which is the code we have been echoing out the users information. that is where the errors are coming from.
profile.php
</div>
<div id="profilebio">
<p>This is where you write a bio about guess who? you!!!</p>
<?php
$db="login";
$link = mysql_connect("localhost", "root", "");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$username = mysql_real_escape_string(trim($_POST['username'])); ************************************************The issues our on these two lines... ****************************************** line 59
$password = mysql_real_escape_string(trim($_POST['password'])); ************************************************The issues our on these two lines... ****************************************** line 60
$result = mysql_query( "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1")
or die("SELECT Error: ".mysql_error());
hahahahah cause I am horrible man. and luckily because of your patience and skill its 100 percent fixed... thank you man. I wish there was some way i could repay you for all your time.. seriously your generosity is just amazing.
Now the information is displaying on the profile page correctly I need to add a button next to the information being echo that allows them to edit their information then resubmit it to the data base making the changes to the rows that it is stored in.
Bookmarks