function FinishQuery($sqlinput, $connection, $trackid) { // parallel assignment short cut list($result, $valid) = DoQuery($sqlinput, $connection); // show a reply ProcessError($connection, $result, $valid, $trackid); // close connection mysqli_close($connection); }
# id of the user $some = 1; set_time_limit(120); # check if we have been "killed" $alive = checkLock($send_process_id); if ($alive) { keepLock($send_process_id); } else { ProcessError($GLOBALS['I18N']->get('Process Killed by other process')); } # check if the message we are working on is still there and in process $status = Sql_Fetch_Array_query("select id,status from {$tables['message']} where id = {$messageid}"); if (!$status['id']) { ProcessError($GLOBALS['I18N']->get('Message I was working on has disappeared')); } elseif ($status['status'] != 'inprocess') { ProcessError($GLOBALS['I18N']->get('Sending of this message has been suspended')); } flush(); # check whether the user has already received the message $um = Sql_query("select entered from {$tables['usermessage']} where userid = {$userdata['0']} and messageid = {$messageid}"); if (!Sql_Affected_Rows()) { if ($script_stage < 4) { $script_stage = 4; } # we know a user $someusers = 1; $users = Sql_query("select id,email,uniqid,htmlemail,rssfrequency,confirmed,blacklisted from {$tables['user']} where id = {$userid}"); # pick the first one (rather historical) $user = Sql_fetch_row($users); if ($user[5] && is_email($user[1])) { $userid = $user[0];
<?php define('ROOT_HOST', '/zodiacool/'); session_start(); if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') { define('UPLOAD_DIR', $_SERVER['DOCUMENT_ROOT'] . substr(ROOT_HOST, 1) . 'upload'); } else { define('UPLOAD_DIR', $_SERVER['DOCUMENT_ROOT'] . ROOT_HOST . 'upload'); } require_once 'model/database.inc.php'; require_once 'model/global-functions.php'; if (!isset($_REQUEST['section'])) { include_once 'controller/home.php'; } else { if (isset($_REQUEST['section'])) { if (file_exists('controller/' . $_REQUEST['section'] . '.php')) { include_once 'controller/' . $_REQUEST['section'] . '.php'; } else { if (file_exists('controller-xhr/' . $_REQUEST['section'] . '.php')) { include_once 'controller-xhr/' . $_REQUEST['section'] . '.php'; } else { //ProcessError(); echo 'not-found'; } } } else { ProcessError(); } }
if (Sql_Has_Error($database_connection)) { ProcessError(Sql_Error($database_connection)); } } while ($userdata = Sql_fetch_row($userids)) { $some = 1; #set_time_limit(60); # check if we have been "killed" $alive = checkLock($send_process_id); if ($alive) keepLock($send_process_id); else ProcessError("Process Killed by other process"); # check if the message we are working on is still there $res = Sql_query("select id from {$tables['message']} where id = $messageid"); if (!Sql_Affected_Rows()) ProcessError("Message I was working on has disappeared"); flush(); # check whether the user has already received the message $um = Sql_query("select entered from {$tables['usermessage']} where userid = $userdata[0] and messageid = $messageid"); if (!Sql_Affected_Rows() || $processrss) { if ($script_stage < 4) $script_stage = 4; # we know a user $someusers = 1; $users = Sql_query("select id,email,uniqid,htmlemail,rssfrequency,confirmed from {$tables['user']} where id = $userdata[0]"); # pick the first one $user = Sql_fetch_row($users); if ($user[5] && is_email($user[1])) { $userid = $user[0]; # id of the user $useremail = $user[1]; # email of the user
} else { $report .= " failed\n"; print "..failed<br/>\n"; $mailreport .= " failed\n"; $mailreport .= $rss->lasterror; $failreport .= "\n".$feed[0] . " failed \n". $rss->lasterror; } flush(); if ($parseresult) { while ($item = $rss->getNextItem()) { set_time_limit(60); $alive = checkLock($process_id); if ($alive) keepLock($process_id); else ProcessError("Process Killed by other process"); $itemcount++; Sql_Query(sprintf('select * from %s where title = "%s" and link = "%s"', $tables["rssitem"],addslashes(substr($item["title"],0,100)),addslashes(substr($item["link"],0,100)))); if (!Sql_Affected_Rows()) { $newitemcount++; Sql_Query(sprintf('insert into %s (title,link,source,list,added) values("%s","%s","%s",%d,now())', $tables["rssitem"],addslashes($item["title"]),addslashes($item["link"]),addslashes($feed[0]),$feed[1])); $itemid = Sql_Insert_Id(); foreach ($item as $key => $val) { if ($item != "title" && $item != "link") { Sql_Query(sprintf('insert into %s (itemid,tag,data) values("%s","%s","%s")', $tables["rssitem_data"],$itemid,$key,addslashes($val))); }
} else { $report .= ' ' . $GLOBALS['I18N']->get('failed') . "\n"; output('..' . $GLOBALS['I18N']->get('failed') . '<br />'); $mailreport .= ' ' . $GLOBALS['I18N']->get('failed') . "\n"; $mailreport .= $rss->lasterror; $failreport .= "\n" . $feed[0] . ' ' . $GLOBALS['I18N']->get('failed') . "\n" . $rss->lasterror; } flush(); if ($parseresult) { while ($item = $rss->getNextItem()) { set_time_limit(60); $alive = checkLock($process_id); if ($alive) { keepLock($process_id); } else { ProcessError($GLOBALS['I18N']->get('Process Killed by other process')); } $itemcount++; Sql_Query(sprintf('select * from %s where title = "%s" and link = "%s"', $tables["rssitem"], addslashes($item["title"]), addslashes($item["link"]))); if (!Sql_Affected_Rows()) { $newitemcount++; Sql_Query(sprintf('insert into %s (title,link,source,list,added) values("%s","%s","%s",%d,now())', $tables["rssitem"], addslashes($item["title"]), addslashes($item['link']), addslashes($feed[0]), $feed[1])); $itemid = Sql_Insert_Id(); foreach ($item as $key => $val) { if ($item != 'title' && $item != 'link') { Sql_Query(sprintf('insert into %s (itemid,tag,data) values("%s","%s","%s")', $tables["rssitem_data"], $itemid, $key, addslashes($val))); } } }