-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkLogin.php
33 lines (31 loc) · 898 Bytes
/
checkLogin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
session_start();
function check(){
$i;
$array = array();
$str = file_get_contents('users.txt');
$array = json_decode($str);
for($i=0;$i<sizeof($array);$i++){
if($array[$i]->user === $_POST['username'] && $array[$i]->pass === $_POST['password']){
$_SESSION['login'] = $_POST['username'];
$_SESSION['pubCode'] = $array[$i]->pubKey;
$_SESSION['privCode'] = $array[$i]->privKey;
return true;
}
}
return false;
}
header('Content-type: application/json');
//$_SESSION['login'] = $_POST['username'];
//$_SESSION['pubCode'] = $_POST['username'];
//$_SESSION['privCode'] = $_POST['username'];
//$path = 'phpseclib';
// set_include_path(get_include_path() . PATH_SEPARATOR . $path);
// include_once('Crypt/RSA.php');
if(check()){
echo json_encode("true");
}
else{
echo json_encode("false");
}
?>