Skip to content

Instantly share code, notes, and snippets.

View DaltonWebDev's full-sized avatar
🏠
Working from home

Dalton Edwards DaltonWebDev

🏠
Working from home
View GitHub Profile
<?php
function dfLatest($member) {
global $conn;
global $date;
$following = listFollowing($member);
if ($following === false) {
return false;
} else {
foreach ($following as $object) {
$memberId = $object["author"];
<?php
// Structure of the human brain
$brain = array ( array ( 0 => array ( 1 => 'Frontal Lobe', 2 => 'Parietal Lobe', 3 => 'Occipital Lobe', ), 1 => array ( 4 => 'Temporal Lobe', 5 => 'Corpus Callosum', 6 => 'Hippocampus', ), 2 => array ( 7 => 'Amygdala', ), 3 => array ( 8 => 'Thalamus', ), 4 => array ( 9 => 'Fornix', ), 5 => array ( 10 => 'Corpus Striatum', ), 6 => array ( 11 => 'Thalamus', ), 7 => array ( 12 => 'Sub-Thalamus', ), 8 => array ( 13 => 'Hypothalamus', ), 9 => array ( 14 => 'Brain Stem', ), 10 => array ( 15 => 'Cerebellum', ), 11 => array ( 16 => 'Medulla', ), 12 => array ( 17 => 'Pons', ), 13 => array ( 18 => 'Diencephalon', ), 14 => array ( 19 => 'Spinal Cord', ), 15 => array ( 20 => 'Lateral Ventricles', ), 16 => array ( 21 => 'Telencephalon', ), 17 => array ( 22 => 'Cerebrum', ), 18 => array ( 23 => 'Cerebellum', ), 19 => array ( 24 => 'Medulla', ), 20 => array ( 25 => 'Pons', ), 21 => array ( 26 => 'Diencephalon', ), 22 => array ( 27 => 'Spinal Cord', ), 23 => array ( 28 => 'Lateral Vent
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>BlockBuddies</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
<link href="style.css" rel="stylesheet">
<?php
header("Content-Type: application/json; charset=utf-8");
$username = $_POST["username"];
$wehatepasswordsJson = $_POST["wehatepasswordsJson"];
if (empty($username)) {
$error = "Please enter your username.";
} else if ($username !== "test") {
$error = "This is a demo. Please enter test for the username.";
<!DOCTYPE html>
<html>
<head></head>
<body>
<form action="https://link.to.your.form/">
<!— your inputs here —>
<div id="wehatepasswords"></div>
<button type="submit">Submit</button>
</form>
<script src="https://wehatepasswords.com/main.js"></script>
<?php
$captchaVerification = !empty($_REQUEST["captcha_verification"]) ? $_REQUEST["captcha_verification"] : false;
if ($captchaVerification !== false) {
$data = [
"endpoint" => "verify",
"captcha_verification" => $captchaVerification,
"captcha_difficulty" => 5 // make sure the difficulty matches the diffulty you added to form button
];
$options = [
"http" => [
<!DOCTYPE html>
<html>
<head></head>
<body>
<form action="https://link.to.your.form/" id="wehatecaptchas">
<!— more inputs here —>
<button type="submit" difficulty="5">Submit</button>
</form>
<script>
const onSubmit = (data) => {
<?php
header("Content-type: application/json; charset=utf-8");
$username = !empty($_POST["username"]) ? strtolower($_POST["username"]) : false;
$message = !empty($_POST["message"]) ? $_POST["message"] : false;
$messageExploded = explode(" ", $message);
if ($messageExploded[0] === "text") {
$outputArray[] = [
"type" => "text",
"message" => "Your username is " . $username
];
<?php
session_start();
header("Content-type: application/json; charset=utf-8");
$username = !empty($_POST["username"]) ? strtolower($_POST["username"]) : false;
$message = !empty($_POST["message"]) ? $_POST["message"] : false;
$sticky = false;
if ($username === false) {
$botMessage = "Who are you?";
} else if ($message === false) {
$botMessage = "Please write something before hitting send.";
function sendEmail($to, $subject, $from, $content) {
$data = "{\"personalizations\": [ { \"to\": [ { \"email\": \"$to\" } ], \"subject\": \"$subject\" } ], \"from\": { \"email\": \"$from\" }, \"content\": [ { \"type\": \"text/plain\", \"value\": \"$content\" } ] }";
$result = file_get_contents("https://api.sendgrid.com/v3/mail/send", null, stream_context_create(array(
"http" => array(
"method" => "POST",
"header" => "Content-Type: application/json" . "\r\n"
. "Content-Length: " . strlen($data) . "\r\n" . "Authorization: Bearer RETRACTED",
"content" => $data
)
)));