Skip to content

Instantly share code, notes, and snippets.

View Octagon-simon's full-sized avatar
Turning red flags into red tests that pass.

Simon Ugorji (Octagon) Octagon-simon

Turning red flags into red tests that pass.
View GitHub Profile
@Octagon-simon
Octagon-simon / captcha-script-part-5.php
Created October 16, 2021 15:16
Check if captcha challenge was successful
<?php
//View the demo.php file for a better code than this
if ($myCaptcha['captcha_status'] == 200) {
echo "Verfification Successful!";
}
?>
@Octagon-simon
Octagon-simon / captcha-script-part-6.php
Created October 16, 2021 15:17
Full code for captcha to work
<?php
//Captcha verification script
require_once 'core/captcha_verify.php';
//Captcha custom JS
include_once 'assets/captcha_script.php';
//Captcha custom CSS
include_once 'assets/captcha_style.php';
if(isset($_POST)&& isset($_POST['submit'])){
@Octagon-simon
Octagon-simon / captcha-script-part-7.php
Created October 16, 2021 15:21
Specify the length of the string here
<?php
//Specify the length of the string here
$captcha_txt = generateRandomString(5);
?>
@Octagon-simon
Octagon-simon / captcha-script-part-7.php
Created October 16, 2021 15:22
create array of colors
<?php
//create a color hex
$a=array(
"red"=>[255, 0, 0],
"green"=>[0, 155, 6],
"blue"=>[0, 0, 255],
"black"=>[0,0,0]
);
?>
@Octagon-simon
Octagon-simon / captcha-script-part-8.php
Created October 16, 2021 15:24
You can make it last for 2 minutes or 1 minute
<?php
//You can make it last for 2 minutes or 1 minute
$expire = gmdate(strtotime('+3 minutes', time()));
?>
var num = 200;
if (num < 100) {
console.log('Number less than 100');
}else if(num > 100) {
console.log('Number is greater than 100');
}else {
console.log('Number is not an Integer');
}
(condition) ? (action if true) : (action if false)
(if statement) { (action if true) else { (action if false) }
var num = 200;
(num < 100) ? console.log('Number less than 100') :
(num > 100) ? console.log('Number is greater than 100') :
console.log('Number is not an Integer')
<form>
<input name="foo" id="inp_foo" type="text">
</form>