Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Register Php
- <?php
- session_start();
- $_SESSION['message']='';
- $mysqli=new MySQLi('127.0.0.1','root','','accounts');
- if(isset($_POST['login'])) {
- $username = $mysqli->real_escape_string($_POST['username']);
- $password = md5($_POST['password']);
- $sql="SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1;";
- $result = mysqli_query($mysqli,$sql);
- if(mysqli_num_rows($result) > 0){
- $row = mysqli_fetch_array($result);
- if (($row['username']=='sithi')&&($row['password']=='202cb962ac59075b964b07152d234b70')){
- $_SESSION['user_type'] = $row;
- $_SESSION['password'] = $row;
- $_SESSION['message'] = "Registration successful!";
- header("location:myresuming.html");exit();
- }
- else{
- $_SESSION['username'] = $row['username'];
- $_SESSION['profile'] = $row['profile'];
- $_SESSION['message'] = "Registration successful!";
- header("location:Welcome.php");exit();
- }
- }
- else{
- $_SESSION['message'] = "Login Failed!";
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>form in Design</title>
- <link rel="stylesheet" type="text/css" href="mystyle.css" />
- <link rel="stylesheet" type="text/css" href="form.css" />
- </head>
- <body>
- <div class="container"><?=$_SESSION['message']?>
- <img src="5.jpg" />
- <form class="form" action="" method="post" enctype="multipart/form-data" autocomplete="off">
- <div class="alert alert-error"></div>
- <input type="text" placeholder="User Name" name="username" required />
- <input type="password" placeholder="Password" name="password" autocomplete="new-password" required />
- <input type="submit" name="login" value="login" class="btn-login" />
- </form>
- </div>
- </body>
- </html>
- <?php
- session_start();
- $_SESSION['message'] = '';
- $mysqli=new MySQLi('127.0.0.1','root','','learning_malaysia');
- if(isset($_POST['login'])) {
- $username = $mysqli->real_escape_string($_POST['username']);
- $password = md5($_POST['password']);
- $sql="SELECT*FROM tutor_register WHERE username ='$username' AND password ='$password'";
- $result = mysqli_query($mysqli,$sql) or die(mysql_error());
- $row = mysqli_num_rows ($result);
- if(mysqli_num_rows($result) > 0){
- $row = mysqli_fetch_array($result);
- $_SESSION['username'] = $username;
- header("location:class.php");
- }
- else{
- $_SESSION['message'] = "Login Failed!";
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Untitled Document</title>
- </head>
- <body>
- <?=$_SESSION['message']?>
- <form class="form" action="" method="post" enctype="multipart/form-data" autocomplete="off">
- <div class="alert alert-error"></div>
- <input type="text" placeholder="User Name" name="username" required />
- <input type="password" placeholder="Password" name="password" autocomplete="new-password" required />
- <input type="submit" name="login" value="login" class="btn-login" />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement