Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style type="text/css" language="css">
- #head{valign: top; text-align: center}
- #links{float: left}
- #type_list{display: none; position: relative; left:30px}
- #login{position: relative; left: 30px; top: 20px}
- </style>
- <script type="text/javascript" language="javascript">
- function show_type_list()
- {
- document.getElementById("type_list").style.display = "inline";
- }
- </script>
- </head>
- <body>
- <!--Head of the page-->
- <div id="head">
- <h1>Login</h1>
- </div>
- <!--Links; standard layout-->
- <!--could transfer these and make shtml-->
- <div id="links">
- <dl>
- <form name="type_list" >
- <dt><a href="/index_files/display.php" style="text-decoration:none">Home</a></dt>
- <dt><a href="#" style="text-decoration:none" onclick="show_type_list()">Type</a></dt>
- <div id="type_list">
- <dd>Aeronautical</dd>
- <dd>Architectural</dd>
- <dd>Bioengineering</dd>
- <dd>Chemical/Petrolum</dd>
- <dd>Civil</dd>
- <dd>Computer Science</dd>
- <dd>Electrical</dd>
- <dd>Engineering Management</dd>
- <dd>Engineering Physics</dd>
- <dd>Mechanical</dd>
- </div>
- </form>
- <dt><a href="/index_files/upload_form-1.php" style="text-decoration:none">Upload</a></dt>
- <dt><a href="/index_files/login_page.php" style="text-decoration:none">Login</a></dt>
- </dl>
- </div>
- <!--Login form-->
- <div id="login">
- <form name="login" onSubmit="validate_form()" action="login.php" enctype="multipart/form-data" method="post">
- Username: <input type="text" name="username" />
- <br />
- Password: <input type="password" name="password" />
- <br />
- <input type="submit" value="Login" />
- </form>
- </div>
- </body>
- </html>
- page 2
- <?php
- if($_SESSION['authenticate'] == "")
- {
- //declaration of variables
- //creating connection to serve
- $con = mysql_connect("localhost","username","pass") or die('Could not connect to server' . mysql_error());
- $table = "user_pass";
- $db = "whackand_wikieng";
- //making user input safe
- mysql_select_db($db, $con);
- $username = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- $result = mysql_query("SELECT Number FROM $table WHERE Username='$username' AND Password='$password'") or die(mysql_error());
- $row = mysql_fetch_array( $result );
- $id = (int)$row['Number'];
- if($id > 0)
- {
- session_start();
- /*$_SESSION['Username'] = $Username;
- $_SESSION['Id'] = $Id;*/
- $_SESSION['Authenticate'] = 1;
- header("Location: upload_form-1.php");
- }
- else
- {
- session_start();
- $_SESSION['authenticate'] = "";
- echo "You are not allowed to upload files." . "<br />";
- echo $username . "<br />";
- echo $password . "<br />";
- echo $result . "<br />";
- echo $row . "<br />";
- echo $id . "<br />";
- }
- //closing server connection
- mysql_close($con);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement