Initial commit
[2ch-be.git] / dev-test / old_dev / bak / login_test_bak.php
blobefad8c3dfbee8139423dececc32924f191ad2e2a
1 <?php
2 include('../encrypt.php');
3 $g = $_POST;
4 if(count($g)>1){
5 $err = false;
6 if (isset($g['m']) && !empty($g['m']) && !empty($g['p'])) {
7 $email = filter_var($g['m'], FILTER_SANITIZE_EMAIL);
8 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
9 exit;
11 $pass = filter_var($g['p'], FILTER_SANITIZE_STRING);
13 $email = strip_tags(addslashes($email));
14 $pass = strip_tags(addslashes($pass));
16 $fdir = substr($email, 0, 1);
17 $sdir = substr($email, 1, 1);
18 $data = @file(DB_PATH."$fdir/$sdir/$email");
20 if(count($data)>3) {
21 for ($i=0; $i < count($data); $i++) {
22 $data[$i] = trim($data[$i]);
24 $inputpass = md5($pass."kahitanupo");
25 if ($inputpass != $data[2]) {
26 $inputpass = hash("sha256", $pass."kahitanupo");
27 if ($inputpass != $data[2]) {
28 $err = true;
30 //echo "Invalid Password";
32 if($err == false) {
33 foreach($_COOKIE as $ky => $vl){
34 setcookie($ky,"",time()-3600);
37 $DMDM = Encrypt($email,KEY);
38 $MDMD = Encrypt($pass,KEY);
39 setcookie('DMDM',$DMDM,0,'/',".2ch.net");
40 setcookie('MDMD',$MDMD,0,'/',".2ch.net");
41 //header('location:status.php');
43 } else {
44 echo "Invalid Password";
46 } else {
47 echo "ユーザーは存在しません";
50 } else {
51 echo "無効な詳細";