Skip to content

Instantly share code, notes, and snippets.

@jonasporto
Created April 3, 2015 16:26
Show Gist options
  • Select an option

  • Save jonasporto/0c3e2a5460f2edb27e79 to your computer and use it in GitHub Desktop.

Select an option

Save jonasporto/0c3e2a5460f2edb27e79 to your computer and use it in GitHub Desktop.
ODESK PHP If / Else Script
<?php
$array_of_zips = [53005, 53007, 53008, 53018, 53029, 53045, 53046, 53051, 53052, 53056, 53058, 53064, 53066, 53069, 53072, 53089, 53103, 53118, 53119, 53122, 53127, 53146, 53149, 53150, 53151, 53153, 53183, 53186, 53187, 53188, 53189];
$zip_parameter = $_GET['zip'];
$executeScript = 'script2';
if (in_array($zip_parameter, $array_of_zips)) {
$executeScript = 'script1';
}
if (!isset($_GET['tfa_next']) && $executeScript == 'script1') {
$params= "?tfa_22=".$_GET['zip'];
echo file_get_contents("http://app.formassembly.com/rest/forms/view/370146".$params);
} else if (!isset($_GET['tfa_next']) && $executeScript == 'script2') {
$params= "?tfa_22=".$_GET['zip'];
echo file_get_contents("http://app.formassembly.com/rest/forms/view/370206".$params);
} else {
echo file_get_contents("http://app.formassembly.com/rest".$_GET['tfa_next']);
}
}?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment