1
+ <?php
2
+ session_start ();
3
+ include "_netphp.php " ;
4
+ // print_r($_POST);
5
+ // Array ( [input1] => Jane [input2] => Smith [input3] => max base code @ g m a i l . com [yournameCode1] => 7v0c5ku1lgx6pp17bh67fdausml1lxyoih24uo46fnd4dzodqi )
6
+ if (isset ($ _POST ["submit2 " ], $ _POST ["yournameCode1 " ], $ _POST ["anotherfield " ])) {
7
+ $ token =$ _POST ["yournameCode1 " ];
8
+ $ res =post ("http://localhost/matno3/SampleCaptchaAPI/src/index.php?method=done&token= " .$ token , [], [
9
+ "Token: d4f5g6df4gd5f6ge4r89rf48 " ,
10
+ "Key: x1x1x1x1x1x1 " ,
11
+ ]);
12
+ $ json =json_decode ($ res [0 ], true );
13
+ if (is_array ($ json ) and $ json != null and count ($ json ) > 0 ) {
14
+ if ($ json ["status " ] == "success " ) {
15
+ // write your code here
16
+ exit ("Done 2! \n" );
17
+ }
18
+ else {
19
+ exit ("Error: captcha is not valid! " );
20
+ }
21
+ }
22
+ else {
23
+ exit ("Error: API have error! \n" );
24
+ }
25
+ }
26
+ if (isset ($ _POST ["submit " ], $ _POST ["yournameCode0 " ], $ _POST ["input1 " ], $ _POST ["input2 " ], $ _POST ["input3 " ])) {
27
+ $ token =$ _POST ["yournameCode0 " ];
28
+ $ res =post ("http://localhost/matno3/SampleCaptchaAPI/src/index.php?method=done&token= " .$ token , [], [
29
+ "Token: d4f5g6df4gd5f6ge4r89rf48 " ,
30
+ "Key: x1x1x1x1x1x1 " ,
31
+ ]);
32
+ // print_r($res);
33
+ // print_r($res[0]);
34
+ $ json =json_decode ($ res [0 ], true );
35
+ if (is_array ($ json ) and $ json != null and count ($ json ) > 0 ) {
36
+ if ($ json ["status " ] == "success " ) {
37
+ // write your code here
38
+ exit ("Done! \n" );
39
+ }
40
+ else {
41
+ exit ("Error: captcha is not valid! " );
42
+ }
43
+ }
44
+ else {
45
+ exit ("Error: API have error! \n" );
46
+ }
47
+ }
48
+ ?>
49
+ <!-- <img id="image" src="captcha.php">
50
+ <button id="refresh" onclick="document.querySelector('#image').src='captcha.php';">Refresh</button>
51
+ <form action="" method="POST">
52
+ <input type="text" name="code">
53
+ <button name="submit">send</button>
54
+ </form>
55
+ -->
56
+ <!DOCTYPE HTML>
57
+ <html dir="ltr">
58
+
59
+ <head>
60
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
61
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
62
+ <meta name="viewport" content="width=device-width, user-scalable=yes">
63
+ <title>thincaptcha demo</title>
64
+ <link rel="stylesheet" href="style.css" type="text/css">
65
+ <script src="api.js" async defer></script>
66
+ </head>
67
+
68
+ <body>
69
+ <div class="sample-form">
70
+ <h2>Form 0</h2>
71
+ <form id="thincaptcha-form0" method="POST">
72
+ <fieldset>
73
+ <legend>Sample Form with ThinCaptcha</legend>
74
+ <ul>
75
+ <li>
76
+ <label for="input1">First Name</label>
77
+ <input class="jfk-textinput" id="input1" name="input1" type="text" value="Jane">
78
+ </li>
79
+ <li>
80
+ <label for="input2">Last Name</label>
81
+ <input class="jfk-textinput" id="input2" name="input2" type="text" value="Smith">
82
+ </li>
83
+ <li>
84
+ <label for="input3">Email</label>
85
+ <input class="jfk-textinput" id="input3" name="input3" type="text" value="max base code @ g m a i l . com">
86
+ </li>
87
+ <li>
88
+ <p>Pick your favorite color:</p>
89
+ <label class="jfk-radiobutton-label" for="option1">
90
+ <input class="jfk-radiobutton-checked" type="radio" id="option1" name="radios" value="option1" disabled aria-disabled="true" checked aria-checked="true">Red</label>
91
+ <label class="jfk-radiobutton-label" for="option2">
92
+ <input class="jfk-radiobutton" type="radio" id="option2" name="radios" value="option2" disabled aria-disabled="true">Green</label>
93
+ </li>
94
+ <li>
95
+ <div id="thincaptcha-code0"></div>
96
+ </li>
97
+ <li>
98
+ <input name="submit" type="submit" value="Submit">
99
+ </li>
100
+ </ul>
101
+ </fieldset>
102
+ </form>
103
+ <h2>Form 1</h2>
104
+ <form id="thincaptcha-form1" method="POST">
105
+ <input type="text" name="anotherfield">
106
+ <br>
107
+ <div id="thincaptcha-code1"></div>
108
+ <br>
109
+ <button name="submit2">Send</button>
110
+ </form>
111
+ </div>
112
+ <script type="text/javascript">
113
+ window.addEventListener("load", function() {
114
+ thinCaptcha.setLink("http://localhost/matno3/SampleCaptchaAPI/src/")
115
+ thinCaptcha.setKey("x1x1x1x1x1x1", "d4f5g6df4gd5f6ge4r89rf48")
116
+ thinCaptcha.apply("#thincaptcha-form0", "#thincaptcha-code0", "yournameCode0", undefined)
117
+ thinCaptcha.apply("#thincaptcha-form1", "#thincaptcha-code1", "yournameCode1", undefined)
118
+ })
119
+ </script>
120
+ </body>
121
+
122
+ </html>
0 commit comments