Ejemplo n.º 1
0
 public function register($username, $password, $email, $phone, $name)
 {
     global $connAdodb;
     $sql = "select * from users where (username = "******" OR phone = " . $connAdodb->qstr($phone) . " OR email = " . $connAdodb->qstr($email) . ")";
     $rs = $connAdodb->Execute($sql);
     if ($rs->RecordCount() === 0) {
         //insert here
         $return['username'] = $username;
         $return['password'] = $password;
         $return['email'] = $email;
         $return['phone'] = $phone;
         $return['name'] = $name;
         $return['user_id'] = guid();
         $return['status'] = 1;
         $return['created'] = tstobts(time());
         $connAdodb->AutoExecute('users', $return, 'INSERT');
         unset($return['password']);
         return $return;
     }
     if ($rs->fields['username'] == $username) {
         return 0;
     }
     if ($rs->fields['email'] == $email) {
         return 1;
     }
     if ($rs->fields['phone'] == $phone) {
         return 2;
     }
     return 3;
 }
Ejemplo n.º 2
0
<?php

require_once 'Connections/conn.php';
$_POST['user_id'] = guid();
$_POST['status'] = guid();
$_POST['created'] = tstobts(time());
if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
        if (PHP_VERSION < 6) {
            $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
        }
        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
        switch ($theType) {
            case "text":
                $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
                break;
            case "long":
            case "int":
                $theValue = $theValue != "" ? intval($theValue) : "NULL";
                break;
            case "double":
                $theValue = $theValue != "" ? doubleval($theValue) : "NULL";
                break;
            case "date":
                $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
                break;
            case "defined":
                $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
                break;
        }