[ create a new paste ] login | about

Link: http://codepad.org/Xejdk0TL    [ raw code | output | fork ]

PHP, pasted on Mar 8:
<?php
include("sql_information.php");

class database{

	public function logincheck(){
		$db = new MySQLDatabase();
		$user_name = $_POST['user_name'];
		$password = $_POST['password'];
		$sql = "SELECT * FROM user_accounts WHERE name = '$user_name' AND password = '$password'";
		$queryresult = $db->query($sql);
		
		$this->userinfo($queryresult);
	}


	function userinfo($queryresult){
	
		if ($result = $db->fetchArray($queryresult)) {
		//var_dump($result);


		$answer = $result['id'];

		if ($answer == 1){
		  echo "Welcome {$result['name']} the administrator !";
		} elseif ($answer != 1) {
		  echo "Welcome {$result['name']} the user !";
		}
		} else {
		echo "Wrong User Name &/or Password entered, please go back & retry.";
		}
	}
}

$dbc = new database();
$dbc -> logincheck();


Output:
1
2
3
4
5
6

Warning: include(sql_information.php): failed to open stream: No such file or directory on line 2

Warning: include(): Failed opening 'sql_information.php' for inclusion (include_path='.:/usr/lib/php') on line 2

Fatal error: Class 'MySQLDatabase' not found on line 7


Create a new paste based on this one


Comments: