Permalink
Browse files

* fix web login/signup bug

  • Loading branch information...
1 parent 4e0c73f commit 0bb4a210a86b9422bcd3264f4867f0f311e6303b @xwisdom xwisdom committed Jul 24, 2005
Showing with 12 additions and 12 deletions.
  1. +4 −4 assets/snippets/weblogin/weblogin.processor.inc.php
  2. +8 −8 assets/snippets/weblogin/websignup.inc.php
@@ -184,14 +184,14 @@
$sql = "SELECT $dbase.".$table_prefix."web_users.*, $dbase.".$table_prefix."web_user_attributes.* FROM $dbase.".$table_prefix."web_users, $dbase.".$table_prefix."web_user_attributes WHERE $dbase.".$table_prefix."web_users.username REGEXP BINARY '^".$username."$' and $dbase.".$table_prefix."web_user_attributes.internalKey=$dbase.".$table_prefix."web_users.id;";
$ds = $modx->dbQuery($sql);
- $limit = mysql_num_rows($ds);
+ $limit = $modx->db->getRecordCount($ds);
if($limit==0 || $limit>1) {
$output = webLoginAlert("Incorrect username or password entered!");
return;
}
- $row = mysql_fetch_assoc($ds);
+ $row = $modx->db->getRow($ds);
$internalKey = $row['internalKey'];
$dbasePassword = $row['password'];
@@ -332,8 +332,8 @@
FROM $tblug ug
INNER JOIN $tbluga uga ON uga.webgroup=ug.webgroup
WHERE ug.webuser =".$internalKey;
- $ds = $modx->dbQuery($sql);
- while ($row = mysql_fetch_row($ds)) $dg[$i++]=$row[0];
+ $ds = $modx->db->query($sql);
+ while ($row = $modx->db->getRow($ds)) $dg[$i++]=$row[0];
$_SESSION['webDocgroups'] = $dg;
if($_POST['rememberme']==1) {
@@ -50,11 +50,11 @@
}
else {
$sql = "SELECT id FROM ".$modx->getFullTableName("web_users")." WHERE username='$username'";
- if(!$rs = mysql_query($sql)){
+ if(!$rs = $modx->db->query($sql)){
$output = webLoginAlert("An error occured while attempting to retreive all users with username $username.").$tpl;
return;
}
- $limit = mysql_num_rows($rs);
+ $limit = $modx->db->getRecordCount($rs);
if($limit>0) {
$output = webLoginAlert("Username is already in use!").$tpl;
return;
@@ -74,13 +74,13 @@
// check for duplicate email address
$sql = "SELECT id FROM ".$modx->getFullTableName("web_user_attributes")." WHERE email='$email'";
- if(!$rs = mysql_query($sql)){
+ if(!$rs = $modx->db->query($sql)){
$output = webLoginAlert("An error occured while attempting to retreive all users with email $email.").$tpl;
return;
}
- $limit = mysql_num_rows($rs);
+ $limit = $modx->db->getRecordCount($rs);
if($limit>0) {
- $row=mysql_fetch_assoc($rs);
+ $row=$modx->db->getRow($rs);
if($row['id']!=$id) {
$output = webLoginAlert("Email is already in use!").$tpl;
return;
@@ -106,18 +106,18 @@
// create the user account
$sql = "INSERT INTO ".$modx->getFullTableName("web_users")." (username, password)
VALUES('".$username."', md5('".$password."'));";
- $rs = mysql_query($sql);
+ $rs = $modx->db->query($sql);
if(!$rs){
$output = webLoginAlert("An error occured while attempting to save the user.").$tpl;
return;
}
// now get the id
- $key=mysql_insert_id();
+ $key=$modx->db->getInsertId();
// save user attributes
$sql = "INSERT INTO ".$modx->getFullTableName("web_user_attributes")." (internalKey, fullname, email, zip, state, country)
VALUES($key, '$fullname', '$email', '$zip', '$state', '$country');";
- $rs = mysql_query($sql);
+ $rs = $modx->db->query($sql);
if(!$rs){
$output = webLoginAlert("An error occured while attempting to save the user's attributes.").$tpl;
return;

0 comments on commit 0bb4a21

Please sign in to comment.