Subject | $login_check = ibase_num_rows($sql); problem |
---|---|
Author | Johan van Zyl |
Post date | 2004-11-21T09:59:08Z |
I did a serach an replace - from mysql to ibase
but it doe snot like
$login_check = ibase_num_rows($sql); ?????
How do I solve this problem?
<?
/* Check User Script */
session_start(); // Start Session
include 'db.php';
// Convert to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'login_form.html';
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = ibase_query("SELECT username, password FROM users WHERE
username='$username' AND password='$password' AND activated='1'");
$login_check = ibase_num_rows($sql);
if($login_check > 0){
while($row = ibase_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('special_user');
$_SESSION['user_level'] = $user_level;
ibase_query("UPDATE users SET last_login_date=now() WHERE
userid='$userid'");
header("Location: login_success.php");
}
} else {
echo "You could not be logged in! Either the username and password do not
match or you have not validated your membership!<br />
Please try again!<br />";
include 'login_form.html';
}
?>
========================
Johan van Zyl
JVZ Systems CC
Box 3469
Somerset West
7129
johan@...
http://www.jvz.co.za
+27 (0)82 875 4238
+27 (0)21 851 7205
Fax 088 021 852 2387
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004/11/19
but it doe snot like
$login_check = ibase_num_rows($sql); ?????
How do I solve this problem?
<?
/* Check User Script */
session_start(); // Start Session
include 'db.php';
// Convert to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'login_form.html';
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = ibase_query("SELECT username, password FROM users WHERE
username='$username' AND password='$password' AND activated='1'");
$login_check = ibase_num_rows($sql);
if($login_check > 0){
while($row = ibase_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('special_user');
$_SESSION['user_level'] = $user_level;
ibase_query("UPDATE users SET last_login_date=now() WHERE
userid='$userid'");
header("Location: login_success.php");
}
} else {
echo "You could not be logged in! Either the username and password do not
match or you have not validated your membership!<br />
Please try again!<br />";
include 'login_form.html';
}
?>
========================
Johan van Zyl
JVZ Systems CC
Box 3469
Somerset West
7129
johan@...
http://www.jvz.co.za
+27 (0)82 875 4238
+27 (0)21 851 7205
Fax 088 021 852 2387
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004/11/19