-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubmit.php
More file actions
40 lines (20 loc) · 809 Bytes
/
submit.php
File metadata and controls
40 lines (20 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// we check if everything is filled in
if(empty($_POST['fname']) || empty($_POST['lname']) || empty($_POST['email']) || empty($_POST['pass']))
{
die(msg(0,"All the fields are required"));
}
// is the email valid?
if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $_POST['email'])))
die(msg(0,"You haven't provided a valid email"));
// Here you must put your code for validating and escaping all the input data,
// inserting new records in your DB and echo-ing a message of the type:
// echo msg(1,"/member-area.php");
// where member-area.php is the address on your site where registered users are
// redirected after registration.
echo msg(1,"registered.html");
function msg($status,$txt)
{
return '{"status":'.$status.',"txt":"'.$txt.'"}';
}
?>