MySql Delete Comment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

Your teacher needs to go back to school. :P

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";
	}
}
?>
I will let you figure out what three things I added or changed. ;)
Post Reply