Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2
boss last na gusto ko lang lagyan ng captcha.sana matulungan mo ko ulit boss. tnx boss
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Freetext</title>
<!-- The stylesheet -->
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
} else {
limitCount.value = limitNum - limitField.value.length;
}
}
</script>
<center>
<marquee direction="down" width="250" height="50" behavior="alternate" scrollamount="2" onmouseover="this.stop();" onmouseout="this.start();">
<font size="5" face="Comic Sans MS" color="blue">
Freetext All Network
</marquee>
<form name="Freetext" method="post" action="sms.php">
<font size="3" face="Comic Sans MS" color="blue">Cellphone no.</font><br>
<input type="text" name="Cellphone" placeholder="Ex. 09999045349"><br>
<font size="3" face="Comic Sans MS" color="blue">Message</font><br>
<textarea name="limitedtextfield" type="text" onKeyDown="limitText(this.form.limitedtextfield,this.form.countdown,150);"
onKeyUp="limitText(this.form.limitedtextfield,this.form.countdown,150);" maxlength="150" cols="32" rows="6" placeholder="Type your message up to 150 characters."></textarea>
<br />
<font size="1">(Maximum characters: 150)<br />
You have
<input readonly type="text" name="countdown" size="3" value="150">
characters left.</font>
<input type="submit" name="submit" value="SEND">
</form>
</font>
</body>
</html>
sms.php
<?php
function itexmo($number,$message,$apicode){
$url = 'https://www.itexmo.com/php_api/api.php';
$itexmo = array('1' => $number, '2' => $message, '3' => $apicode);
$param = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($itexmo),
),
);
$context = stream_context_create($param);
return file_get_contents($url, false, $context);}
function itexmo_bal($apicode){
$url = 'https://www.itexmo.com/php_api/api.php';
$itexmo = array('4' => $apicode);
$param = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($itexmo),
),
);
$context = stream_context_create($param);
return file_get_contents($url, false, $context);}
If(isset($_POST['submit'])){
$number = $_POST['Cellphone'];
$message = $_POST['limitedtextfield'];
$result = itexmo($number,$message,"blacklang");
if ($result == 0){
echo "Message sent!";
}else{
echo "Error Num ". $result . " was encountered!";
}
}
?>
Adding reCAPTCHA to your site
Keys
Step 1: client-side integration
Paste this snippet before the closing </head> tag on your HTML template:
<script src='https://www.google.com/recaptcha/api.js'></script>
Paste this snippet at the end of the <form> where you want the reCAPTCHA widget to appear:
<div class="g-recaptcha" data-sitekey="6LeGggMTAAAAAIvbyNLW5Y di na to complete"></div>
The reCAPTCHA documentation site describes more details and advanced configurations.
Step 2: Server side integration
When your users submit the form where you integrated reCAPTCHA, you'll get as part of the payload a string with the name "g-recaptcha-response". In order to check whether Google has verified that user, send a POST request with these parameters:
URL:
https://www.google.com/recaptcha/api/siteverify
secret(required)
6LeGggMTAAAAAOiDd63R0lEICY6 di na rin to complete
response(required) The value of 'g-recaptcha-response'.