-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata.php
More file actions
73 lines (58 loc) · 1.53 KB
/
data.php
File metadata and controls
73 lines (58 loc) · 1.53 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
$user = $_SESSION['user'];
$servername = "localhost";
$username = "*********";
$password = "********";
$dbname = "********";
$conn = mysqli_connect($servername, $username, $password, $dbname) or die(" can't connect to server");
?>
<?
function check($input)
{
$input = trim($input);
$input = stripslashes($input);
$input = htmlspecialchars($input);
return $input;
}
function died($error)
{
// your error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error . "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
$name = $user = $email = $mbno = $pword = $cpword = "";
$name = check($_POST["name"]);
$email = check($_POST["email"]);
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if (!preg_match($email_exp, $email))
{
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if (!preg_match($string_exp, $name))
{
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if (strlen($error_message) > 0)
{
died($error_message);
}
?>
<html>
<body>
Welcome <?php echo $name; ?><br>
Your email address : <?php echo $email; ?>
<?
$sql1 = "INSERT INTO conuser(name,email) VALUES ('$name','$email')";
if (mysqli_query($conn, $sql1) == true)
{
echo " is registered Successfully ";
}
else " error in registration";
?>
</body>
</html>