Happy 5th anniversary everyone!

Over 1000 games have been claimed and all codes are gone! Thank you so much for the fantastic interest in Swiss games!

[insert_php]
/*

$challenges = array(
“5 plus 5 = ?” => “10”,
“7 – 1 = ?” => “6”,
“7 – 2 = ?” => “5”,
“7 – 3 = ?” => “4”,
“7 minus 4 = ?” => “3”,
“7 – 5 = ?” => “2”,
“7 – 6 = ?” => “1”,
“7 – 7 = ?” => “0”,
“12 + 12 = ?” => “24”,
“77 – 3 = ?” => “74”,
“77 – 4 = ?” => “73”,
“77 minus 5 = ?” => “72”,
“77 – 6 = ?” => “71”,
“67 – 3 = ?” => “64”,
“67 – 4 = ?” => “63”,
“67 – 5 = ?” => “62”,
“67 – 6 = ?” => “61”,
“47 minus 3 = ?” => “44”,
“47 – 4 = ?” => “43”,
“47 – 5 = ?” => “42”,
“47 – 6 = ?” => “41”);

$QUIET_IP_CHECK = false;
$IP_LIMIT_ACTIVE = true;
$DEBUG = true;

if ($DEBUG) { error_reporting(E_ALL); ini_set(‘display_errors’, 1); }

$ip = getRealIpAddr();

$link = mysqli_connect(“localhost”, “sgdach_vouchers5”, “n2vUM2Rse3Z@3bkk#8Ho”, “sgdach_vouchers5”);

if (mysqli_connect_errno() || $ip == “212.120.88.137”) {

echo_please_later();
echo_debug( $ip );
return;

}

if (isset($_POST[“email”]) && isset($_POST[“game”]) && strlen(trim($_POST[“email”])) > 0) {

$challenge = mysqli_real_escape_string($link, $_POST[“chal”]);
$response = mysqli_real_escape_string($link, $_POST[“resp”]);

if ($challenges[$challenge] !== $response) {
echo_form($link, array_rand($challenges));
return;
}

$email = mysqli_real_escape_string($link, $_POST[“email”]);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return;
}
$game_id = mysqli_real_escape_string($link, $_POST[“game”]);
$result = mysqli_query($link, “SELECT * FROM `Games` WHERE game_id = $game_id LIMIT 1;”);
$row = mysqli_fetch_assoc($result);
$game_name = $row[“game”];
$game_url = $row[“game_url”];
$studio_name = $row[“studio”];
$studio_url = $row[“studio_url”];

// log
$result = mysqli_query($link, “INSERT INTO `sgdach_vouchers5`.`Requests` (`t`, `email`, `game`, `ip`) VALUES (CURRENT_TIMESTAMP, ‘$email’, ‘$game_id’, ‘”. $ip .”‘);”);

if (strpos($email, “roy.v.dijk”) > 0) {

echo_please_later();
echo_debug( $ip );
return;

}

// check if email already exists
$result = mysqli_query($link, “SELECT * FROM `Vouchers` WHERE email = ‘$email’ LIMIT 1;”);

if (mysqli_num_rows($result) == 0) {

// IP Blocker Begin
if ($IP_LIMIT_ACTIVE) {
$result = mysqli_query($link, “SELECT * FROM `sgdach_vouchers5`.`Requests` WHERE ip = ‘$ip’ AND t > DATE_SUB(NOW(), INTERVAL 5 MINUTE) ORDER BY `Requests`.`t` DESC;”);
if (mysqli_num_rows($result) > 2) {

if (mysqli_num_rows($result) == 3) {
$headers = ‘From: noreply-vouchers@sgda.ch’ .”\r\n”.’Content-Type: text/plain’.”\r\n”.’X-Mailer: Gbanga-Voucher-Mailer’;
// mail(“r.vanrooden@sgda.ch”, “Mehrfacheinlösung $ip”, “$ip (dieses mal $email) hat ” . (mysqli_num_rows($result)) . ” mal versucht, einen Code zu bestellen”, $headers);
// mail(“m.sala@sgda.ch”, “Mehrfacheinlösung $ip”, “$ip (dieses mal $email) hat ” . (mysqli_num_rows($result)) . ” mal versucht, einen Code zu bestellen”, $headers);
}

if (!$QUIET_IP_CHECK) {
echo_please_later();
echo_debug( $ip );
return;
}

}
}
// IP Blocker End

// consume a new code

// $result = mysqli_query($link, “SELECT * FROM `Vouchers` WHERE game_id = $game_id AND email IS NULL LIMIT 1;”);

$isUpdated = mysqli_query($link, “UPDATE `sgdach_vouchers5`.`Vouchers` SET `email` = ‘$email’ WHERE game_id = $game_id AND email IS NULL LIMIT 1;”);

if ($isUpdated && mysqli_affected_rows($link)) {

echo_debug( “new code” );
echo_your_code($email, $game_name, $game_url, $studio_name, $studio_url);

// mail
// $email = “noreply-vouchers@sgda.ch”;
// $password = “K#BNNhbUhhT47xqc$XYK”;

$result = mysqli_query($link, “SELECT * FROM `Vouchers` WHERE email = ‘$email’ LIMIT 1;”);
$row = mysqli_fetch_assoc($result);
$code = $row[“voucher”];

send_mail($email, $game_name, $game_url, $studio_name, $studio_url, $code);

} else {
echo_debug(“all codes for this game have gone”);
echo_all_gone($email, $game_name, $game_url, $studio_name, $studio_url);
echo_form($link, array_rand($challenges));
}

} else {

echo_debug(“already ordered a code
“);
$result = mysqli_query($link, “SELECT * FROM `Games` AS G, `Vouchers` AS V WHERE G.game_id = V.game_id AND V.email = ‘$email’ LIMIT 1;”);
$row = mysqli_fetch_assoc($result);
$game_name = $row[“game”];
$game_url = $row[“game_url”];
$studio_name = $row[“studio”];
$studio_url = $row[“studio_url”];
echo_your_code($email, $game_name, $game_url, $studio_name, $studio_url);

}

} else {

echo_form($link, array_rand($challenges));

}

function echo_form($link, $this_chal) {

?>

Please enter your email and choose a game to receive a free copy of your favorite Swiss game. You can only get one voucher, so choose wisely.

“>



Your code

Thanks for your interest in Swiss games!

We have sent your voucher code for the game Sorry, all codes for the game

Wow, that was a blast

We currently cannot deliver more codes. Please come back later.

Thanks for your interest in Swiss games!

Your code for $game_name (by studio $studio_name) is:

$code

Codes for Steam can be redeem like described here.

iOS promo codes can be redeemed like described here.

On Google Play,
the redeeming of promotional codes is described here.

Please make sure you use it within the next 24 hours.

\n\n

Sincerely, your SGDA team!

\r\n\r\n–c4d5d00c4725d9ed0b3c8b–“;

$headers = ‘From: noreply-vouchers@sgda.ch’ .”\r\n”.’Content-Type: multipart/alternative; boundary=c4d5d00c4725d9ed0b3c8b’.”\r\n”.’X-Mailer: Gbanga-Voucher-Mailer’;
mail($to, $subject, $message, $headers);
}

function getRealIpAddr()
{
if (!empty($_SERVER[‘HTTP_CLIENT_IP’])) //check ip from share internet
{
$ip=$_SERVER[‘HTTP_CLIENT_IP’];
}
elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])) //to check ip is pass from proxy
{
$ip=$_SERVER[‘HTTP_X_FORWARDED_FOR’];
}
else
{
$ip=$_SERVER[‘REMOTE_ADDR’];
}
return $ip;
}

function echo_debug($msg) {

global $DEBUG;
if ($DEBUG) { echo “

Debug: $msg

“; }

}

*/
[/insert_php]

AirConsole (90 Days of AirConsole Hero)

Airships

A nifty game

Conran – The dinky Raccoon

Crossbow Warrior – the legend of William Tell

Feist

First Strike

Niche – a genetics survival game

Plug & Play

Slime-san

The Firm

https://vimeo.com/119526025

Transport Fever