diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..a9dbf02 --- /dev/null +++ b/functions.php @@ -0,0 +1,50 @@ +Username/password is incorrect."; + } + } +} + // If form submitted, insert values into the database. +function register () +{ + if (isset($_REQUEST['username'])) { + global $con; + // removes backslashes + $username = stripslashes($_REQUEST['username']); + //escapes special characters in a string + $username = mysqli_real_escape_string($con,$username); + $email = stripslashes($_REQUEST['email']); + $email = mysqli_real_escape_string($con,$email); + $password = stripslashes($_REQUEST['password']); + $password = mysqli_real_escape_string($con,$password); + $query = "INSERT into users (userLogin, userPass, userEmail) + VALUES ('$username', '$password', '$email')"; + $result = mysqli_query($con,$query); + if ($result) { + echo "
"; + } + } +} +?> diff --git a/index.php b/index.php index 5787afa..e7960a5 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,6 @@ + @@ -20,12 +23,12 @@ -Not registered yet? Register Here
+Not registered yet? Register Here
+ diff --git a/login.php b/login.php deleted file mode 100644 index b7b742f..0000000 --- a/login.php +++ /dev/null @@ -1,27 +0,0 @@ - -Some title
- -