function user_add($login, $pass, $email, $type, $disa_reas, $guar_code) {
GLOBAL $G_dbpfx;
- $usr_sql = sprintf("INSERT INTO %susers (login, pass, email, type, disa_reas, guar_code)
+ $usr_sql = sprintf("INSERT INTO %susers (login, pass, email, type, disa_reas, guar_code)
VALUES ('%s', '%s', '%s', %d, %d, %d) RETURNING *;",
- $G_dbpfx, escsql(strtolower($login)), escsql($pass), escsql($email),
+ $G_dbpfx, escsql(strtolower($login)), escsql($pass), escsql($email),
$type, $disa_reas, $guar_code);
if (! (($usr_pg = $this->query($usr_sql)) != FALSE && pg_affected_rows($usr_pg) == 1) ) {
return $usr_obj;
}
+ function mail_check($code, $type, $hash)
+ {
+ GLOBAL $G_dbpfx;
+
+ $mai_sql = sprintf("SELECT * FROM %smails WHERE code = %d AND type = %d AND hash = '%s';",
+ $G_dbpfx, $code, $type, escsql($hash));
+ if (($mai_pg = $this->query($mai_sql)) == FALSE || pg_numrows($mai_pg) != 1) {
+ // check failed
+ return (FALSE);
+ }
+
+ $mai_obj = pg_fetch_object($mai_pg, 0);
+ return ($mai_obj);
+ }
+
+ function mail_delete($code)
+ {
+ GLOBAL $G_dbpfx;
+
+ $mai_sql = sprintf("DELETE FROM %smails WHERE code = %d;", $G_dbpfx, $code);
+
+ if (($mai_pg = $this->query($mai_sql)) == FALSE || pg_affected_rows($mai_pg) != 1) {
+ return (FALSE);
+ }
+ return (TRUE);
+ }
+
+
} // End class BriskDB
class LoginDBOld