Forum Moderators: coopster
function register($cusid,$userpass,$remember) {
$cusid = mysql_escape_string($cusid);
$userpass = mysql_escape_string(md5($userpass));
$result=mysql_fetch_array(mysql_query("SELECT * FROM $table WHERE cusid = '{$cusid}'"), MYSQL_ASSOC);
if (!$result) { //insert record if user name doesn't exist
$insert = mysql_query("INSERT INTO $table VALUES ('', '$cusid', '$userpass', '', '', '')") or DIE ($this->query_error);
$result = mysql_fetch_array(mysql_query("SELECT * FROM $table WHERE cusid = '{$cusid}' AND userpass = '{$userpass}'"), MYSQL_ASSOC) or DIE ($this->query_error);
$this->message .= '<p>Registration was successful</p>';
$this->set_session($result,$remember,true); //log user on
return true;
} else {
$this->message .= '<p>username already exists! Please choose a different name</p>';
return false;
}
}
INSERT INTO mapp VALUES ('', '11', '(32-bit md5 hash here)', '', '', '')ERROR: something went wrong when accessing the database. Please consult your webmaster
the 11 is the $cusid and the long number is the $userpass after md5
[edited by: coopster at 12:04 pm (utc) on July 6, 2007]
[edit reason] removed specifics [/edit]
localhost. For example, Yahoo hosting uses mysql Of course there may be other reasons. These seem to be the most common.
Good luck :)