Example #1
0
$degree = $_POST['degree'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$error = null;
$saved = false;
try {
    $dsn = 'mysql:dbname=bookweb;host=140.127.74.142';
    $user = '******';
    $password = '******';
    $db = new PDO($dsn, $user, $password);
    $db->exec("set names utf8");
    $accountCheck = searchAccount($db, $account);
    if ($accountCheck) {
        insertAccount($db, $account, $pwd);
        $u_id = searchID($db, $account);
        insertUserInfo($db, $name, $dept, $degree, $email, $phone, $address, $u_id);
        $saved = true;
    } else {
        $error = "account";
        $saved = false;
    }
} catch (PDOException $e) {
    $error = $e;
}
$result = array("result" => $saved, "responseDetail" => $error);
$json_result = json_encode($result);
echo $json_result;
//----exit----
function searchAccount($db, $account)
{
Example #2
0
     } else {
         $c = searchID($_GET['searchText']);
         $e = searchNAME($_GET['searchText']);
         if ($c[0][0] != "empty") {
             $d = $c;
         } elseif ($e[0][0] != "empty") {
             $d = $e;
         } else {
             $d = $c;
         }
     }
 } elseif (!strcmp($_GET['search'], "id")) {
     if (!strcmp($_GET['searchText'], "")) {
         $d = showUSER();
     } else {
         $d = searchID($_GET['searchText']);
     }
 } elseif (!strcmp($_GET['search'], "name")) {
     if (!strcmp($_GET['searchText'], "")) {
         $d = showUSER();
     } else {
         $d = searchNAME($_GET['searchText']);
     }
 }
 foreach ($d as $var) {
     $var2 = "";
     $var3 = "";
     $var4 = $var[0];
     if ($var[2] == 0) {
         $var2 = "승인대기";
     } else {