-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdata.php
69 lines (69 loc) · 1.64 KB
/
sdata.php
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
<?php
if(isset($_POST['check']))
{
echo "Form Submitted<br>";
echo "Name:".' '.$name=$_POST['name'];
}
$rand=substr(rand(),0,4); //only show 4 numbers
?>
<html>
<head>
<style type="text/css">
.captcha { width:60px; background-image:url(cat.png);
border: 1px solid; }
.color { color:#FF0000; }
</style>
<script type="text/javascript">
//Javascript Referesh Random String
function captch()
{
var x = document.getElementById("ran")
x.value = Math.floor((Math.random() * 10000) + 1);
}
function validation()
{
if(document.form1.name.value=="")
{
document.getElementById("name").innerHTML="Enter your Name!";
document.form1.name.focus();
return false;
}
if(document.form1.chk.value=="")
{
document.getElementById("error").innerHTML="Enter Captcha!";
document.form1.chk.focus();
return false;
}
if(document.form1.ran.value!=document.form1.chk.value)
{
document.getElementById("error").innerHTML="Captcha Not Matched!";
document.form1.chk.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form method="post" action="<?php $_SERVER['PHP_SELF']?>" name="form1">
<table width="400px" align="center" bgcolor="#EBEBEB">
<tr> <td>Name:</td>
<td><input type="text" name="name">
<span id="name" class="color"></span>
</td>
</tr>
<tr> <td>Enter Captcha</td> <td><input type="text" name="chk" id="chk">
<span id="error" class="color"></span>
</td>
</tr>
<tr> <td> </td>
<td><input type="text" value="<?=$rand?>" id="ran"
readonly="readonly" class="captcha">
<input type="button" value="Refresh" onclick="captch()" /> </td> </tr>
<tr> <td colspan="2" align="center"> <input type="submit" name="check"
onclick="return validation();">
</td>
</table>
</form>
</body>
</html>