· 8 years ago · Mar 04, 2018, 03:10 PM
1<?php
2//Coded by: Zettiee
3//email: lg.zettiee(AT) gmail.com
4//design by: tonka
5//email: ........add it here
6//index.php
7
8include (DIRNAME(__FILE__) . '/connect.php');
9
10if(!$_POST['submit']) {
11?>
12
13<html>
14 <head>
15 <title>Login Page</title>
16 </head>
17
18 <body align="center">
19
20
21 <b>Login Box </b>
22 <form action="login.php" method="POST">
23 ID: <input type="text" name="name" value=""> </br>
24 PW: <input type="password" name="pass" value=""> </br>
25 <input type="submit" name="Login" value="submit">
26 </form>
27
28
29
30
31 </body>
32
33</html>
34<?php
35 }
36 //check posted info
37 elseif ($_POST['name'] == "" && $_POST['pass'] == "") {
38 echo 'You need to enter your ID/Username and password.';
39 exit;
40 }
41
42 else {
43
44 $check = mysql_query("SELECT * from `users` where `uname` = ".$usern." AND `pass` = 'md5($pass)'");
45 $callback = mysql_num_rows($check);
46
47
48 if($callback => 0)
49
50 {
51 //login code
52 $usern = mysql_real_escape_string($_POST['name']);
53 $pass = $_POST['pass'];
54 //$pass = md5($_POST['pass']);
55 $check1 = mysql_query("SELECT * from `users` where `uname` = ".$usern." AND `pass` = ".$pass."");
56 $callback1 = mysql_fetch_array($check1);
57 $_SESSION['user'] = $callback1['uname'];
58
59 echo 'You have logedin. You will redirect in a moment';
60 echo' <meta http-equiv="refresh" content="0;url="home.php" /> ';
61
62 }
63 else {
64 echo' ID and password combo is wrong.';
65 exit;
66 }
67
68 }