$dup_flag = ""; */ // build the form 1 email $emailArray = makeEmail($postArray, $formNum, $dup_flag); // add auto-submit icontact submission form in hidden iframe if (!$test_env) { $icontactFrame = makeIcontactFrame($email, $fname, $lname, $street_address, $city, $state, $zip, getDOB($dob_y, $dob_m, $dob_d), $anticipated_grad_year, $fields_recruiter); } // add to mysql db // get it all ready for safe insertion $db->do_query(makeSQL($postArray, $formNum)); $db_id = mysql_insert_id(); } else { // build the form 2 email $emailArray = makeEmail($postArray, $formNum, ""); $db->do_query(makeSQL($postArray, $formNum)); $doRedir = true; } $bad = array("*****@*****.**", "*****@*****.**"); $from = $email; if (!in_array($bad, $from)) { $headers = "From: {$from}\r\n"; $headers .= 'Cc: recruit@simons-rock.edu' . "\r\n"; $headers .= 'Bcc: dscheff@simons-rock.edu' . "\r\n"; if (!$test_env) { if (!isset($recruiter_email_handle)) { $recruiter_email_handle = getCounselorEmailHandle($_POST['counselor']); } mail($recruiter_email_handle, $emailArray['subj'], $emailArray['body'], $headers); } $emailArray['body'] .= "\n\nRECRUITER EMAIL HANDLE: {$recruiter_email_handle}\n\n";
<?php header("Content-Type: application/json; charset=utf-8"); require '../config/mysql2json.php'; require '../config/config.php'; function makeSQL() { $request = 'select * from stockprice_brand'; if (s($_GET["q"]) != "") { $request .= sprintf(" where company_name like '%s' or company_name_kana like '%s'", s($_GET["q"]), s($_GET["q"])); } $request .= " limit 5;"; return $request; } $link = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error()); $db_select = mysql_select_db($db_database) or die(mysql_error()); $query = makeSQL(); $res = mysql_query($query); if (!is_string($res)) { $num = mysql_affected_rows($link); $objJSON = new mysql2json(); echo $_GET['callback'] . "(" . trim($objJSON->getJSON($res, $num)) . ")"; } else { echo $_GET['callback'] . "(" . json_encode(array('status' => 'ERROR', 'error' => 'failed')) . ")"; } mysql_close($link); exit;
set_time_limit(0); $files = $_GET['files']; if (substr($files, -1) == ";") { $files = substr($files, 0, -1); } $addFiles = explode(";", $files); include '../../sql-connect.php'; mysql_select_db("{$dbname}"); mysql_set_charset('utf8'); function makeSQL($fileName, $tablename) { $raw = file_get_contents("../../gtfs/{$fileName}"); $lines = explode("\n", $raw); $tableHeaders = $lines[0]; unset($lines[0]); foreach ($lines as $line) { $data = explode(",", $line); $sqlValues = "VALUES("; foreach ($data as $element) { $sqlValues .= "'{$element}',"; } $sqlValues = substr($sqlValues, 0, -1) . ")"; $sqlSyntax = "INSERT INTO {$tablename} ({$tableHeaders}) {$sqlValues}"; mysql_query($sqlSyntax); } } foreach ($addFiles as $file) { $nameOnly = explode(".", $file); makeSQL("{$file}", "{$nameOnly['0']}"); } echo "Done!";
$link = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error()); $db_select = mysql_select_db($db_database) or die(mysql_error()); $response = array("status" => "ok"); function makeSQL($brand_code) { $request = ""; if ($brand_code != "") { $request = sprintf("select word, res_%s from nikkei_chiSquare order by res_%s desc limit 5;", $brand_code, $brand_code); } return $request; } foreach (split(',', s($_GET["brand_code"])) as $brand_code) { if ($brand_code == "") { $brand_code = "0101"; } $mysql_res = mysql_query(makeSQL($brand_code)); if (!is_string($mysql_res)) { while ($row = mysql_fetch_array($mysql_res, MYSQL_ASSOC)) { $response["data"][$brand_code][] = $row; } } else { $response["error"] = "NO DATA"; } } if (s($_GET["format"]) == "json") { echo json_encode($response); } else { echo $_GET['callback'] . "(" . json_encode($response) . ")"; } mysql_close($link); exit;
$response = array("status" => "ok"); function makeSQL($resource, $ga_kaku, $pred) { $request = sprintf('select nikkei.date, kiji_headline from nikkei inner join %s on nikkei.kiji_id = %s.kiji_id', $resource, $resource); if ($ga_kaku != "" or $pred != "") { $request .= sprintf(" where ga_kaku = '%s' and predicate = '%s'", $ga_kaku, $pred); } $request .= " limit 10;"; return $request; } $resource = "nikkei_pred"; if (s($_GET["resource"]) == "mecab") { $resource = "nikkei_mecab"; } #$mysql_res = mysql_query(makeSQL($resource, "", "")); $mysql_res = mysql_query(makeSQL($resource, s($_GET["ga_kaku"]), s($_GET["pred"]))); if (!is_string($mysql_res)) { while ($row = mysql_fetch_array($mysql_res, MYSQL_ASSOC)) { $response["data"][] = $row; } } else { $response["data"] = ""; $response["error"] = "no data"; } if (s($_GET["format"]) == "json") { echo json_encode($response); } else { echo $_GET['callback'] . "(" . json_encode($response) . ")"; } mysql_close($link); exit;
<?php header("Content-Type: application/json; charset=utf-8"); require '../config/mysql2json.php'; require '../config/config.php'; $link = mysql_connect($db_host, $db_username, $db_password) or die(mysql_error()); $db_select = mysql_select_db($db_database) or die(mysql_error()); $response = array("status" => "ok"); function makeSQL() { if (s($_GET["rate"]) != null and s($_GET["kiji_id"]) != null) { $request = sprintf('update nikkei set rate = %d where kiji_id = "%s";', s($_GET["rate"]), s($_GET["kiji_id"])); } return $request; } $mysql_res = mysql_query(makeSQL()); if (!is_string($mysql_res)) { $response["request"] = makeSQL(); $response["response"] = $mysql_res; } else { $response["data"] = ""; $response["error"] = "no data"; } if (s($_GET["format"]) == "json") { echo json_encode($response); } else { echo $_GET['callback'] . "(" . json_encode($response) . ")"; } mysql_close($link); exit;
$response = array("status" => "ok"); function makeSQL() { $request = 'select kiji_id, date, kiji_headline, kiji_midashi, rate from nikkei'; if (s($_GET["type"]) == "view") { if (s($_GET["start"]) != null) { $request .= sprintf(" where rate is not NULL order by rate desc limit %d, 10;", s($_GET["start"])); } else { $request .= sprintf(" where rate is not NULL order by rate desc limit 10;"); } } else { $request .= sprintf(" where rate is NULL limit 1;"); } return $request; } $mysql_res = mysql_query(makeSQL()); if (!is_string($mysql_res)) { while ($row = mysql_fetch_array($mysql_res, MYSQL_ASSOC)) { $response["data"][] = $row; } } else { $response["data"] = ""; $response["error"] = "no data"; } if (s($_GET["format"]) == "json") { echo json_encode($response); } else { echo $_GET['callback'] . "(" . json_encode($response) . ")"; } mysql_close($link); exit;