· 8 years ago · Mar 04, 2018, 02:34 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
10
11if(!isset($_POST['submit'])) {
12
13echo '
14
15 <b>Login Box </b>
16 <form action="index.php" method="POST">
17 ID: <input type="text" name="name" value=""> </br>
18 PW: <input type="password" name="pass" value=""> </br>
19 <input type="submit" name="submit" value="submit">
20 </form>';
21
22
23
24
25
26
27 }
28 //check posted info
29 else ($_POST['name'] == "" && $_POST['pass'] == "") {
30 echo 'You need to enter your ID/Username and password.';
31 exit;
32 }
33
34 else
35 {
36 //login code
37 $usern = mysql_real_escape_string($_POST['name']);
38 $pass = $_POST['pass'];
39 //$pass = md5($_POST['pass']);
40 $check1 = mysql_query("SELECT * from `users` where `uname` = '$usern' AND `pass` = '$pass'");
41 $callback1 = mysql_fetch_array($check1);
42 $record1 = mysql_num_rows($check1);
43 $_SESSION['user'] = $callback1['uname'];
44
45 echo 'You have logedin. You will redirect in a moment';
46 echo $_SESSION['user'];
47
48 }
49
50
51 elseif(!$record1 = 1) {
52 echo' ID and password combo is wrong.';
53 exit;
54 }