Re: Loging Script
- From: Rik <luiheidsgoeroe@xxxxxxxxxxx>
- Date: Sat, 17 Feb 2007 18:03:06 +0100
On Sat, 17 Feb 2007 14:13:22 +0100, phyburn <phyburn@xxxxxxxxx> wrote:
It seems there is something wrong with my script for the reason that
it always returns, UserName NOT found . I know it connects to the db
fine because I don't get a error. So just been trying to figure out
what's wrong. I am using PEAR btw.
Pastebin: http://pastebin.ca/360410
<?PHP
require 'DB.php';
$db = DB::connect('mysql://lol:lol@localhost/user');
if (DB::isError($db)) {die('ERROR{1}: ' . $db-getMessage()); }else{print "We connected";}
$user = $_POST['user'];
$password = md5($_POST['password']);
$password2 = md5($_POST['password2']);
$sql = check();
function check()
{
global $db;
global $user;
$rows = $db->getAll('SELECT user_name FROM user');
if (DB::isError($db)) {die('ERROR{2}: ' . $db->getMessage());}
Untested, I seldomly use PEAR::DB:
$stmt = $db->prepare('SELECT user_name, password FROM user WHERE user_name = ?');
$result = $db->execute($stmt,$user);
if($result->numRows()!=1) die('Username not found or multiple users with the same name.');
--
Rik Wasmus
.
- References:
- Loging Script
- From: phyburn
- Loging Script
- Prev by Date: Re: what's the Basic Encryption method used in mysql
- Next by Date: Re: Defered interpolation
- Previous by thread: Re: Loging Script
- Next by thread: Defered interpolation
- Index(es):
Relevant Pages
|