Hey guys, I've coded a register script which works fine, and it goes to the table ´users´ with the following settings:
-ID
-Username
-Password
-Email
-Screenname
-IP
Ok, but my login script doesn't work, does someone know how?
Here is my login script:
Login2.php
Code:
<form id="form1" name="form1" method="post" action="login3.php">
<p align="left" class="tdglobal"><span class="b01">User Control Panel</span></p>
<table width="200" border="0" align="left" class="liteoption">
<tr>
<td width="97" class="left"><div align="left"><b>Username:</b></div></td>
<td width="93" class="left"><input name="user" type="text" class="liteoption" id="user" size="15" maxlength="15" /></td>
</tr>
<tr>
<td class="center"><div align="center"><b>Password:</b></div></td>
<td class="center"><input name="pass" type="password" class="liteoption" id="pass" size="15" maxlength="15" /></td>
</tr>
</table>
<br></br><br><p align="left" class="tdglobal"><span class="center">
<input name="submit" type="submit" class="liteoption" id="submit" value="Log In" size="15" maxlength="15" />
</span></p>
</form>
<p align="center" class="tdglobal">
Login3.php:
Code:
<?php
if(isset($_POST['submit'])) {
$username = $_POST['user'];
$password = md5($_POST['pass']);
$con = mysql_connect("localhost","root","");
mysql_select_db("albsky", $con);
$result1 = "SELECT * FROM users WHERE username='$username' and password='$password'";
$query = mysql_query($result1);
$count = mysql_num_rows($query);
if($count == 1){
session_register("User_Name");
session_register("User_Pass");
$_SESSION['account'] = $_POST['user'];
echo('Logged in.... Click <a href=?op=user><strong>here</strong></a>');
}
else {
echo "<strong>Try Again</strong>";
}
}
?>
<br />
</p>
what should I change to let it work?
It connects to database but it can't find my user details
Ty in advance