Initial commit
[2ch-be.git] / dev-test / artist / a_log.php
blobee16412cb53fb7fdff78e63ce423c3d99e7c750a
1 <?php
2 include('encrypt_artist.php');
3 $incpa = "";
4 $g = $_POST;
6 if(count($g)>1) {
7 if (isset($g['mail']) && !empty($g['mail']) && !empty($g['pass'])) {
8 $err = false;
9 $email = filter_var($g['mail'], FILTER_SANITIZE_EMAIL);
10 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
11 //echo "Invalid email";
12 $err = true;
14 $pass = filter_var($g['pass'], FILTER_SANITIZE_STRING);
15 $email = strip_tags(addslashes($email));
16 $pass = strip_tags(addslashes($pass));
18 if(!preg_match("/[a-z0-9 \!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\]\^\_\{\}\|\~]{4,32}+/i",$pass)) {
19 //echo "Invalid password!";
20 $err = true;
23 $fdir = substr($email, 0, 1);
24 $sdir = substr($email, 1, 1);
25 $data = @file(ADBD_PATH."$fdir/$sdir/$email/info.txt");
26 /*echo ADBD_PATH."$fdir/$sdir/$email/info.txt<br>";
27 var_dump($data);*/
28 if(count($data)>1) {
29 for ($i=0; $i < count($data); $i++) {
30 $data[$i] = trim($data[$i]);
32 $inputpass = md5($pass."kahitanupo");
33 if ($inputpass != $data[2]) {
34 $inputpass = hash("sha256", $pass."kahitanupo");
35 if ($inputpass != $data[2]) {
36 $incpa = "Wrong Password!";
37 $err = true;
40 if ($err == false) {
41 if (isset($data[count($data)-1]) && $data[count($data)-1]== FORGOT) {
42 unset($data[count($data)-1]);
43 $writeData = implode("\n", $data);
44 file_put_contents(ADBD_PATH."$fdir/$sdir/$email/info.txt", $writeData);
46 foreach($_COOKIE as $ky => $vl){
47 setcookie($ky,"",time()-3600);
49 $ADMDM = Encrypt($email,AKEY);
50 $AMDMD = Encrypt($pass,AKEY);
51 if($_SERVER['SERVER_NAME'] == "be.2ch.net") {
52 setcookie('ADMDM',$ADMDM,0,'/',".2ch.net"); //
53 setcookie('AMDMD',$AMDMD,0,'/',".2ch.net"); //
54 } elseif ($_SERVER['SERVER_NAME'] == "be.bbspink.com") {
55 setcookie('ADMDM',$ADMDM,0,'/',".bbspink.com"); //
56 setcookie('AMDMD',$AMDMD,0,'/',".bbspink.com"); //
58 /*$_SESSION['sLoggedDir'] = loggedEmail($email, MDB_PATH);*/
59 $_SESSION['utype'] = trim($data[3]);
60 $_SESSION['artistid'] = trim($data[0]);
61 $_SESSION['aname'] = trim($data[1]);
62 // echo "logged";
63 // die;
64 header('location:artist.php');
66 } else {
67 echo "Error: User Doesn't Exists!";
69 } else {
70 echo "NG";