slight refactoring
This commit is contained in:
parent
91a3a34f09
commit
f10d6255db
|
@ -1,33 +1,35 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Registration</title>
|
<title>Registration</title>
|
||||||
<link rel="stylesheet" href="css/loginstyle.css" />
|
<link rel="stylesheet" href="css/loginstyle.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
require('db.php');
|
require('db.php');
|
||||||
// If form submitted, insert values into the database.
|
// If form submitted, insert values into the database.
|
||||||
if (isset($_REQUEST['username'])){
|
if (isset($_REQUEST['username'])) {
|
||||||
// removes backslashes
|
// removes backslashes
|
||||||
$username = stripslashes($_REQUEST['username']);
|
$username = stripslashes($_REQUEST['username']);
|
||||||
//escapes special characters in a string
|
//escapes special characters in a string
|
||||||
$username = mysqli_real_escape_string($con,$username);
|
$username = mysqli_real_escape_string($con,$username);
|
||||||
$email = stripslashes($_REQUEST['email']);
|
$email = stripslashes($_REQUEST['email']);
|
||||||
$email = mysqli_real_escape_string($con,$email);
|
$email = mysqli_real_escape_string($con,$email);
|
||||||
$password = stripslashes($_REQUEST['password']);
|
$password = stripslashes($_REQUEST['password']);
|
||||||
$password = mysqli_real_escape_string($con,$password);
|
$password = mysqli_real_escape_string($con,$password);
|
||||||
$trn_date = date("Y-m-d H:i:s");
|
$trn_date = date("Y-m-d H:i:s");
|
||||||
$query = "INSERT into `users` (username, password, email, trn_date)
|
$query = "INSERT into `users` (username, password, email, trn_date)
|
||||||
VALUES ('$username', '".md5($password)."', '$email', '$trn_date')";
|
VALUES ('$username', '".md5($password)."',
|
||||||
|
'$email', '$trn_date')";
|
||||||
$result = mysqli_query($con,$query);
|
$result = mysqli_query($con,$query);
|
||||||
if($result){
|
if ($result) {
|
||||||
echo "<div class='form'>
|
echo "<div class='form'>
|
||||||
<h3>You are registered successfully.</h3>
|
<h3>You are registered successfully.</h3>
|
||||||
<br/>Click here to <a href='login.php'>Login</a></div>";
|
<br/>Click here to <a href='login.php'>Login</a></div>";
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
?>
|
?>
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<h1>Registration</h1>
|
<h1>Registration</h1>
|
||||||
|
|
Loading…
Reference in New Issue