This php code for a php login form works on PHP Version 4.3.10 when tested (when uploaded to my webhosting)
but not on PHP Version 4.4.0 (on my localcomputer, im using IIS)
all this code does when tested on 4.3.10 is
after entering user: rene and passwd: 11111, echoes:
SELECT user, ID from soluciones where user = 'rene' and ID = '1111'
it works with my webhosting, but not on my computer...
Can somone explain me why?
<?php session_start(); ?>
<html>
<head>
</head>
<body>
<form action="login.php" name="login" method="post">
User <input type="text" size="20" name="user">
Password <input type="password" size="20" name="pass">
<input type="submit" name="submit" value="Aceptar">
</form>
<?php
if ($submit)
{
$dbcnx = mysql_connect("localhost", "myuser", "password");
mysql_select_db("selex", $dbcnx);
$strSQL = 'SELECT user, ID from soluciones where user = "' . $_POST['user'] . '" and ID = "' . $_POST['pass'] . '"' ;
$res = mysql_query($strSQL);
$x = @mysql_num_rows($res);
if ($rs= @mysql_fetch_array($res))
{
$_SESSION['user'] = $rs['user'];
$_SESSION['pass'] = $rs['ID'];
elseif ($x=='0')
{
$error = "Verifica tu Username y Password";
echo $error;
}//end if error login
}//end submit
?>
</body>
</html>