Initial commit
[2ch-be.git] / dev-test / old_dev / old / log.php
blob2394533ce38d6199488c734bc63d8de7ef5ff1a8
1 <?php
2 include('encrypt.php');
3 $g = $_POST;
4 if(count($g)>1){
5 if (isset($g['mail']) && !empty($g['mail']) && !empty($g['pass'])) {
6 $err = false;
7 $email = filter_var($g['mail'], FILTER_SANITIZE_EMAIL);
8 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
9 //echo "Invalid email";
10 $err = true;
12 $pass = filter_var($g['pass'], FILTER_SANITIZE_STRING);
14 $email = strip_tags(addslashes($email));
15 $pass = strip_tags(addslashes($pass));
17 if(!preg_match("/[a-z0-9 \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\]\^\_\{\}\|\~]{4,32}+/i",$pass)) {
18 //echo "Invalid password!";
19 $err = true;
21 $fdir = substr($email, 0, 1);
22 $sdir = substr($email, 1, 1);
23 $data = @file(DB_PATH."$fdir/$sdir/$email");
25 if(count($data)>3) {
26 for ($i=0; $i < count($data); $i++) {
27 $data[$i] = trim($data[$i]);
29 $inputpass = md5($pass."kahitanupo");
30 if ($inputpass != $data[2]) {
31 $inputpass = hash("sha256", $pass."kahitanupo");
32 if ($inputpass != $data[2]) {
33 echo "–³Œø‚ȃpƒXƒ��[ƒh";
34 $err = true;
37 if ($err == false) {
38 if (isset($data[count($data)-1]) && $data[count($data)-1]== FORGOT) {
39 unset($data[count($data)-1]);
40 $writeData = implode("\n", $data);
41 //$writeData = $data[0]."\n".$data[1]."\n".$data[2]."\n".$data[3]."\n".$data[4]."\n".$data[5]."\n";
42 file_put_contents(DB_PATH."$fdir/$sdir/$email", $writeData);
44 foreach($_COOKIE as $ky => $vl){
45 setcookie($ky,"",time()-3600);
48 $DMDM = Encrypt($email,KEY);
49 $MDMD = Encrypt($pass,KEY);
50 if($_SERVER['SERVER_NAME'] == "be.2ch.net") {
51 setcookie('DMDM',$DMDM,0,'/',".2ch.net"); //
52 setcookie('MDMD',$MDMD,0,'/',".2ch.net"); //
53 } elseif ($_SERVER['SERVER_NAME'] == "be.bbspink.com") {
54 setcookie('DMDM',$DMDM,0,'/',".bbspink.com"); //
55 setcookie('MDMD',$MDMD,0,'/',".bbspink.com"); //
57 //setcookie('DMDM',$DMDM,0,'/',".2ch.net");
58 //setcookie('MDMD',$MDMD,0,'/',".2ch.net");
59 header('location:status.php');
61 } else {
62 echo "ƒ†�[ƒU�[‚Í‘¶�Ý‚µ‚Ü‚¹‚ñ";
65 } else {
66 echo "–³Œø‚È�Ú�×";