File tree Expand file tree Collapse file tree 7 files changed +22
-8
lines changed Expand file tree Collapse file tree 7 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ //Connecting to the Database
3
4
$ database = array ();
4
5
$ database ['host ' ] = "localhost " ;
5
6
$ database ['port ' ] = "3306 " ;
Original file line number Diff line number Diff line change 1
1
<?php
2
-
2
+
3
+ //Function to check for invalid characters in the Username
3
4
function checkInvalidCharacters ($ text ) {
4
5
5
6
return (bool ) preg_match ("/[^\w-.]/ " , $ text );
6
7
}
7
8
9
+ //Function to encrypt the users Password
8
10
function encrypt_pswd ($ input , $ rounds = 9 ){
9
11
10
12
$ salt = "" ;
Original file line number Diff line number Diff line change
1
+ <!-- Login page without Fancy Frontend -->
2
+
1
3
<!DOCTYPE html>
2
4
3
5
<html lang =" en-US" >
Original file line number Diff line number Diff line change 1
1
<?php
2
-
2
+ //Login Functions
3
+
3
4
$ username = $ _POST ['username ' ];
4
5
$ password = $ _POST ['password ' ];
5
6
Original file line number Diff line number Diff line change
1
+ <!-- Registeration page without Fancy Frontend -->
1
2
<!DOCTYPE html>
2
3
3
4
<html lang =" en-US" >
6
7
<meta http-equiv = " X-UA-Compatible" content = " IE=edge" >
7
8
<title >CODEX FORUM</title >
8
9
<meta name = " viewport" content = " width=device-width, initial-scale=1" >
10
+ <!-- House Keeping Elements -->
9
11
<link rel = " stylesheet" type = " text/css" media = " screen" href = " main.css" />
10
12
<script src = " main.js" ></script >
11
13
</head >
12
14
<body >
15
+ <!-- Sending register_parse the User's data by passing method = POST -->
13
16
<form action = " register_parse.php" method = " POST" >
14
17
Enter a Username : <input type = " text" name = " username" placeholder = " Enter a Username" ><br ><br >
15
18
Enter a Password   ; : <input type = " password" name = " password" placeholder = " Enter a Password" ><br ><br >
Original file line number Diff line number Diff line change
1
+ <!-- This is the register page with fancy frontend -->
2
+
1
3
<!DOCTYPE html>
2
4
<html lang =" en" >
3
5
11
13
<style >
12
14
/* This is inline styling*/
13
15
body {
14
- font - family : " Open Sans" , sans - serif ;
15
- height : 100vh ;
16
- background : url (" https://scontent-bom1-1.xx.fbcdn.net/v/t1.0-9/14720459_1037919169668229_6982952498177798721_n.jpg?oh=852060ef345fbdcb6c6787149071986c&oe=5B45206C" )
17
- 50 % fixed ;
18
- background - size : cover ;
19
- }
16
+ font - family : " Open Sans" , sans - serif ;
17
+ height : 100vh ;
18
+ background : url (" https://scontent-bom1-1.xx.fbcdn.net/v/t1.0-9/14720459_1037919169668229_6982952498177798721_n.jpg?oh=852060ef345fbdcb6c6787149071986c&oe=5B45206C" )
19
+ 50 % fixed ;
20
+ background - size : cover ;
21
+ }
20
22
21
23
@keyframes spinner {
22
24
0 % {
Original file line number Diff line number Diff line change 11
11
/* echo "Registeration Details : ";
12
12
echo "Username : " . $username . "<br/><br/> Password : " . $password; */
13
13
14
+ //CHecking If the User forgot to enter the Username or Password
14
15
if ( $ username == "" || $ password == "" ){
15
16
echo "Please fill in all the details <br/> Please check if you forgot to enter data in any of the fields <br/> " ;
16
17
}
17
18
19
+ //Checking for invalid Username or short Password
20
+ //The account will be fed to the database only if the above two conditions are satisfied.
18
21
else {
19
22
if ( checkInvalidCharacters ($ username ) )
20
23
echo "Username can only contain <br/><br/><ul><li> A to Z </li><li> a to z </li><li> 0 to 9 </li><li> . and _ </li></ul> " ;
You can’t perform that action at this time.
0 commit comments