-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
84 lines (77 loc) · 2.4 KB
/
login.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
if(isset($_POST['login'])){
$nick = hax($_POST["nick"]);
$pass = hax($_POST["password"]);
$pass = md5($pass);
$login = confirmuser($pass, $nick);
if($login == 1){
echo "<p class='cp_txt'>No such username</p>";
die;
}
if($login == 2){
echo "<p class='cp_txt'>Wrong password</p>";
die;
}
if($login == 3){
echo "<p class='cp_txt'>Email not confirmed</p>";
die;
}
if($login == 0){
$_SESSION['kopanick'] = $nick;
$_SESSION['kopapass'] = $pass;
if($_POST["remember"] == "remember"){
setcookie("kopanick", $_SESSION['kopanick'], time()+60*60*24*365, "/");
setcookie("kopapass", $_SESSION['kopapass'], time()+60*60*24*365, "/");
}else{
setcookie("kopanick", $_SESSION['kopanick'], 0, "/");
setcookie("kopapass", $_SESSION['kopapass'], 0, "/");
}
$loggedin = true;
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$self\">";
}
}
$loggedin = checklogin();
if(isset($_POST['logout'])){
unset($_SESSION['kopanick']);
unset($_SESSION['kopapass']);
$_SESSION = array();
setcookie("kopanick", "", time()-3600, "/");
setcookie("kopapass", "", time()-3600, "/");
echo "<meta http-equiv=\"Refresh\" content=\"0;url=$self\">";
}
//new pass
if(isset($_POST['newpass'])){
$nick = hax($_POST["nick"]);
$result = mysql_query("SELECT Kuski, KuskiIndex FROM kuski WHERE Kuski = '$nick'");
$row = mysql_fetch_array($result);
$kuskiindex = $row['KuskiIndex'];
$newpassword = randomPrefix(10);
$md5pass = md5($newpassword);
mysql_query("UPDATE kuski SET Password = '$md5pass' WHERE KuskiIndex = '$kuskiindex'") or die(mysql_error());
$success = "Your new password is: $newpassword";
/*include_once("classes/mail_class.php");
$send = new Email;
$send->message = "You have requested a new password on Kopasite.\n\nNick: $nick\nNew Password: $newpassword";
$send->to = $row['Email'];
$send->headline = "Kopasite New Password Request";
$send->from = "Kopasite";
$send->frommail = "kopasite@gmail.com";
if($send->sendMail()){
$success = "A new password has been sent to your email adress ".$row['Email'];
}else{
$error = "fail";
}*/
$newpasssent = true;
}
//
// SET kuski, team, kuskiindex as variables
if(isset($_SESSION['kopanick'])){
$k = $_SESSION['kopanick'];
$getk = mysql_query("SELECT Kuski, Team, KuskiIndex, Country FROM kuski WHERE Kuski = '$k'") or die(mysql_error());
$rowk = mysql_fetch_array($getk);
$ki = $rowk['KuskiIndex'];
$kt = $rowk['Team'];
$kc = $rowk['Country'];
}
//
?>