Esempio n. 1
0
function Register()
{
    if (!isset($_GET["new_login"]) or !isset($_GET["new_pass"]) or !isset($_GET["invite"])) {
        exit("Fields not set");
    }
    $new_login = CleanString($_GET["new_login"]);
    $new_pass = CleanString($_GET["new_pass"]);
    $invite = CleanString($_GET["invite"]);
    $good_code = ExecQueryAndReturnResult("SELECT `Valid` FROM `invites` WHERE `InviteCode` = '{$invite}'");
    if (count($good_code) == 1 and $good_code[0][0] == 1) {
        //проверим, есть ли уже пользователь с указанным именем
        $usersCount = ExecQueryAndReturnResult("Select Count(*) From `users` where `Login` = '{$new_login}'");
        if (count($usersCount) == 1 and $usersCount[0][0] == 0) {
            ExecQuery("INSERT INTO `users`(`Login`, `Password`) VALUES ('{$new_login}', '{$new_pass}')");
            ExecQuery("UPDATE `invites` SET `Valid`=0 WHERE `InviteCode` = '{$invite}'");
            $result = ExecQueryAndReturnResult("SELECT `Id` FROM `users` WHERE `Login` = '{$new_login}' and `Password` = '{$new_pass}' and `Banned` = 0");
            if (count($result) == 1) {
                session_start();
                $_SESSION['login_user'] = $result[0][0];
                echo "OK";
            }
        } else {
            echo "User with the same name already exist";
        }
    } else {
        echo "Wrong invite code";
    }
}
Esempio n. 2
0
function UpdateData($data, $table, $where)
{
    $query = 'UPDATE ' . $table . " SET ";
    foreach ($data as $key => $value) {
        if (is_array($value)) {
            $query .= $key . "=" . current($value) . ", ";
        } else {
            $query .= $key . "='" . addslashes($value) . "', ";
        }
    }
    $query = preg_replace("/, \$/", "", $query);
    $query .= " WHERE " . $where;
    ExecQuery($query);
    return mysql_affected_rows();
}
 /**
  * function sets mail settings,
  * using $values array
  *
  * @param array $values
  */
 function setMailSettings($values)
 {
     foreach ($values as $name => $value) {
         $params = array("name" => $name, "value" => $value);
         ExecQuery("UPDATE_MAIL_SETTINGS", $params);
     }
 }
Esempio n. 4
0
$params['exec_module'] = "";
$params['img_row_path'] = "";
// путь к рисункам
$params['img_row_file'] = "";
// путь к рисункам
$params['img4demo'] = "";
// определить имя рисунка
ExecQuery($params);
?>


<br/><hr/><h4>HNB</h4>
<?php 
// поиск по pnc
/* Запрос EPC Toyota */
$query = "\r\nSELECT *\r\n  FROM hnb\r\n  WHERE hnb.catalog = '{$catalog}'\r\n\tAND hnb.catalog_code = '{$catalog_code}'\r\n\tAND hnb.pnc = '{$pnc}'\r\n";
$params = array();
$params['query'] = $query;
$params['f_sel_name'] = "";
$params['f_sel_value'] = "";
$params['url_main_params'] = "";
$params['f_exec_name'] = "";
$params['exec_module'] = "";
$params['img_row_path'] = "";
// путь к рисункам
$params['img_row_file'] = "";
// путь к рисункам
$params['img4demo'] = "";
// определить имя рисунка
ExecQuery($params);