Initial commit
[2ch-be.git] / dev-test / old_dev / old / bak / log.php
blob55511ab584518a5894253f6a97093731763ba374
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 $email = filter_var($g['mail'], FILTER_SANITIZE_EMAIL);
7 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
8 exit;
10 $pass = filter_var($g['pass'], FILTER_SANITIZE_STRING);
12 $email = strip_tags(addslashes($email));
13 $pass = strip_tags(addslashes($pass));
15 if(!preg_match("/[a-z0-9 \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\]\^\_\{\}\|\~]{4,32}+/i",$pass)) {
16 echo "Invalid password!";
17 exit;
19 $fdir = substr($email, 0, 1);
20 $sdir = substr($email, 1, 1);
21 $data = @file(DB_PATH."$fdir/$sdir/$email");
23 if(count($data)>3) {
24 for ($i=0; $i < count($data); $i++) {
25 $data[$i] = trim($data[$i]);
27 $inputpass = md5($pass."kahitanupo");
28 if ($inputpass != $data[2]) {
29 echo "–³Œø‚ȃpƒXƒ��[ƒh";
30 } else {
31 if (isset($data[count($data)-1]) && $data[count($data)-1]== FORGOT) {
32 unset($data[count($data)-1]);
33 $writeData = implode("\n", $data);
34 //$writeData = $data[0]."\n".$data[1]."\n".$data[2]."\n".$data[3]."\n".$data[4]."\n".$data[5]."\n";
35 file_put_contents(DB_PATH."$fdir/$sdir/$email", $writeData);
37 foreach($_COOKIE as $ky => $vl){
38 setcookie($ky,"",time()-3600);
41 $DMDM = Encrypt($email,KEY);
42 $MDMD = Encrypt($pass,KEY);
43 setcookie('DMDM',$DMDM,0,'/',".2ch.net");
44 setcookie('MDMD',$MDMD,0,'/',".2ch.net");
45 header('location:status.php');
47 } else {
48 echo "ƒ†�[ƒU�[‚Í‘¶�Ý‚µ‚Ü‚¹‚ñ";
51 } else {
52 echo "–³Œø‚È�Ú�×";