Code: Select all
<?php
include('config.php')
$dbname2 = 'phptest1';
$connection_id = mysql_connect($dbhost2, $dbuser2, $dbpass2) or die('Error connecting to mysql');
mysql_select_db($dbname2, $connection_id) or die('Cannot select DB');
$password=$_POST['cpass'];
$isAuth = false; //set to false originally
// i have this just to test if it will output the password i enter into the password box, and it does!
echo $password . "<br>";
if (isset($_POST['submit']))
{
$result2 = mysql_query("SELECT * FROM `usrauth1` WHERE `cpass` = $password", $connection_id) or die('Error ID #3');
while ($row = mysql_fetch_array($result2))
{
if($row['cpass'] === $password)
{
$isAuth = true;
// again, i'l worry about the cookie stuff later.
session_start();
session_register('cpass');
}
}
if($isAuth)
{
print "logged in successfully ";
print "<A href=''>Refresh</a>";
}
else
print "Wrong Pass ID1";
}
}
?>