示例#1
0
function parseQuery($caller, $s)
{
    //simple replaces
    $cmd = array("#db->", "#dbfilter->", "#by_bizness");
    $sql = array(get_class($caller) . "_", "(SELECT * FROM ", "WHERE biznessUID=" . osBackBizness() . ")");
    $s = str_replace($cmd, $sql, $s);
    //functional replaces
    //finally
    return $s;
}
示例#2
0
 function add($email, $password, $passwordagain, $userName, $Address, $Country, $PostalCode, $role)
 {
     //check if the email is already registered
     query("SELECT * FROM user_info WHERE email='" . $email . "' ;");
     if ($row = fetch()) {
         if ($email == $row["email"]) {
             return -1;
             //user already exist
         }
     } else {
         if ($password == $passwordagain) {
             //save the new user in the database
             $vcode = $this->createVerificationCode();
             $hashPassword = $this->sha1Hash($email, $password);
             query("INSERT INTO user_info (email,password,verificationCode,biznessUID,userName,Address,Country,PostalCode,role) VALUES ('" . $email . "', '" . $hashPassword . "','" . $vcode . "','" . osBackBizness() . "','" . $userName . "','" . $Address . "','" . $Country . "','" . $PostalCode . "','" . $role . "');");
             // A welcome message to the user...
             $msg = "Welcome! Please login to your account and verify by this code: " . $vcode;
             $mailheader = 'From: register@sam-rad.com' . "\r\n" . 'Reply-To: register@sam-rad.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
             //send an email to the user. FIX MAILING FUNCTION!
             $this->sendEmail($email, "Welcome to buziness!", $msg, $mailheader);
             //to get the fresh userUID...
             query("SELECT * FROM user_info WHERE email='" . $email . "' ;");
             if ($row = fetch()) {
                 $this->userUID = $row['userUID'];
             }
             $this->loggedIn = 2;
             //All set - user added and logged in!
             return 1;
         } else {
             return -2;
         }
     }
 }
示例#3
0
 function add($email, $password, $passwordagain)
 {
     //check if the email is already registered
     query("SELECT * FROM user_info WHERE email='" . $email . "' ;");
     if ($row = fetch()) {
         if ($email == $row["email"]) {
             return -1;
             //user already exist
         }
     } else {
         if ($password == $passwordagain) {
             //save the new user in the database
             $vcode = $this->createVerificationCode();
             $hashPassword = $this->sha1Hash($email, $password);
             query("INSERT INTO user_info (email,password,verificationCode,biznessUID) VALUES ('" . $email . "', '" . $hashPassword . "','" . $vcode . "','" . osBackBizness() . "');");
             // A welcome message to the user...
             $msg = "Welcome! Please verify your account using this code: " . $vcode;
             //send an email to the user. FIX MAILING FUNCTION!
             $this->sendEmail($email, "Welcome to buziness!", $msg);
             //to get the fresh userUID...
             query("SELECT * FROM user_info WHERE email='" . $email . "' ;");
             if ($row = fetch()) {
                 $this->userUID = $row['userUID'];
             }
             $this->loggedIn = 2;
             //All set - user added and logged in!
             return 1;
         } else {
             return -2;
         }
     }
 }
示例#4
0
 function init()
 {
     if ($this->catUID == 0) {
         //----ROOT it is
         query("SELECT c.catUID as catUID, c.Lable AS lable, t.name AS type_name FROM category_cat AS c,category_type AS t WHERE c.typeUID=t.typeUID AND c.owner_type ='bizness' AND c.owner_UID='" . osBackBizness() . "'");
         if ($row = fetch()) {
             $this->catUID = $row['catUID'];
             $this->lable = $row['lable'];
             $this->type_name = $row['type_name'];
         }
     } else {
         //---Specific category
         query("SELECT c.Lable AS lable, t.Name AS type_name FROM category_cat AS c,category_type AS t WHERE c.typeUID=t.typeUID AND c.catUID=" . $this->catUID);
         if ($row = fetch()) {
             $this->lable = $row['lable'];
             $this->type_name = $row['type_name'];
         }
     }
 }