Exemple #1
0
function DB_checkLogin($username, $pwd)
{
    $username = santize($username);
    $hashpwd = hash_pwd($pwd);
    $q = "SELECT id,username,nickname FROM USERINFO WHERE username='******' AND pwd='" . $hashpwd . "';";
    $rslt = mysqli_query($GLOBALS['con'], $q);
    if ($rslt != FALSE) {
        if (mysqli_num_rows($rslt) > 0) {
            $row = mysqli_fetch_array($rslt);
            $_SESSION['id'] = $row['id'];
            $_SESSION['username'] = $row['username'];
            $_SESSION['nickname'] = $row['nickname'];
            DB_ping(TRUE);
            return 1;
        } else {
            return 0;
        }
    }
    return -1;
}
Exemple #2
0
<?php

/* 
 * Project	: iTalk
 * 		talking is life ....
 * 	(By gagan1kumar)
 */
session_start();
include 'db.php';
if (isset($_SESSION['id'])) {
    DB_connect();
    $result = FALSE;
    if (isset($_REQUEST["makeNull"])) {
        $result = DB_ping(FALSE);
    } else {
        $result = DB_ping(TRUE);
    }
    DB_close();
    if ($result == TRUE) {
        exit;
    }
}
http_response_code(203);