public function find($keywords) { global $db; $keywords = strTrimTotal($keywords); if (empty($keywords)) { return false; } $this->keywords = $keywords; mysql_query("SET NAMES 'UTF8'"); //mysql_query('ALTER TABLE `'.$this->settable.'` ADD FULLTEXT ('.$this->searchcolumns.')'); if (empty($this->selectcolumns)) { $select = '*'; } else { $select = $this->selectcolumns; } $sql = "select " . $select . " from " . $this->settable . " where MATCH(" . $this->searchcolumns . ") AGAINST('" . $keywords . "' IN BOOLEAN MODE) "; $rs = mysql_query($sql); //echo mysql_num_rows($rs); $arr_data = array(); while ($row = mysql_fetch_array($rs)) { $row = fetch_row($row); array_push($arr_data, $row); } $this->result = $arr_data; }
function send_mail_by_userid($userid, $subject, $text) { $userid = (int) $userid; $sql = "SELECT u.email\n\t\tFROM " . PREF . "users AS u\n\t\tWHERE u.id={$userid}\n\t\tLIMIT 1"; $result = query($sql); $rows = num_rows($result); if (!$rows) { return; } $emails = fetch_row($result); return send_mail_to_first($emails, $subject, $text); }
function move_entry($sendername, $senderdomain, $src, $rcpt) { global $moved; $query = "SELECT first_seen FROM connect WHERE sender_name='" . addslashes($sendername) . "' AND sender_domain='" . addslashes($senderdomain) . "' AND src='" . addslashes($src) . "' AND rcpt='" . addslashes($rcpt) . "'"; $result = do_query($query); $line = fetch_row($result); # add to 'from_awl' $query = "INSERT INTO from_awl(sender_name, sender_domain, src, first_seen, last_seen) VALUES('" . addslashes($sendername) . "', '" . addslashes($senderdomain) . "', '" . addslashes($src) . "', '" . $line["first_seen"] . "', '" . $line["first_seen"] . "')"; do_query($query); # and remove from 'connect' $query = "DELETE FROM connect WHERE sender_name='" . addslashes($sendername) . "' AND sender_domain='" . addslashes($senderdomain) . "' AND src='" . addslashes($src) . "' AND rcpt='" . addslashes($rcpt) . "'"; do_query($query); $moved .= '<br />' . $sendername . '@' . $senderdomain . ' [' . $src . '] for ' . $rcpt . ' moved to whitelist.'; }
function gSomeOptions($key, $func) { global $_CACHE; if (isset($_CACHE[$key])) { return $_CACHE[$key]; } if (is_string($func)) { $result = query($func); $ret = []; while (list($id, $name) = fetch_row($result)) { $ret[$id] = $name; } } else { $ret = $func(); } $_CACHE[$key] = $ret; return $ret; }
function delete_undef($mode) { global $message; if ($mode == "email") { $query_cnt = "SELECT COUNT(*) AS count FROM from_awl WHERE sender_name='-undef-' AND sender_domain='-undef-'"; $query = "DELETE FROM from_awl WHERE sender_name='-undef-' AND sender_domain='-undef-'"; } else { $query_cnt = "SELECT COUNT(*) AS count FROM domain_awl WHERE sender_domain='-undef-'"; $query = "DELETE FROM domain_awl WHERE sender_domain='-undef-'"; } $result = do_query($query_cnt); $n = fetch_row($result); if ($n["count"] > 0) { do_query($query); $message = '<br />-undef- entries (' . $n["count"] . ') deleted.'; } else { $message = "<br />No -undef- entries found - nothing was deleted."; } }
function loginbypost() { global $LU, $attempt; $post_get = new GetVarClass(); $email = $post_get->getemail("email"); $pw = $post_get->getvar("pw"); if (!$email || !$pw) { return 0; } $subquery = "u.email='{$email}'"; $attempt = 1; $sql = "SELECT u.id,u.pw\n\t\tFROM " . PREF . "users AS u\n\t\tWHERE {$subquery} AND (u.pwhash=MD5('{$pw}') OR '{$LU["moderid"]}'<>0) AND u.active\n\t\tLIMIT 1"; $result = query($sql); $rows = num_rows($result); if ($rows) { list($LU["id"], $knownpw) = fetch_row($result); if (!ALLOWMULTISESSIONS) { dropallsessions($LU["id"]); } } return $rows; }
public function find($keywords) { global $db; $keywords = trim($keywords); if (empty($keywords)) { return false; } $this->keywords = $keywords; //$db->query('ALTER TABLE `'.$this->settable.'` ADD FULLTEXT ('.$this->searchcolumns.')'); if (empty($this->selectcolumns)) { $select = '*'; } else { $select = $this->selectcolumns; } $sql = "select " . $select . " from " . $this->settable . " where MATCH(" . $this->searchcolumns . ") AGAINST('" . $keywords . "') "; $rs = $db->query($sql); $arr_data = array(); while ($row = $db->fetch_array($rs)) { $row = fetch_row($row); array_push($arr_data, $row); } $this->result = $arr_data; }
function kd_transaksi() { $kode_temp = fetch_row("SELECT noinvoice FROM invoice ORDER BY noinvoice DESC LIMIT 0,1"); if ($kode_temp == '') { $kode = "T00001"; } else { $jum = substr($kode_temp, 1, 6); $jum++; if ($jum <= 9) { $kode = "T0000" . $jum; } elseif ($jum <= 99) { $kode = "T000" . $jum; } elseif ($jum <= 999) { $kode = "T00" . $jum; } elseif ($jum <= 9999) { $kode = "T0" . $jum; } elseif ($jum <= 99999) { $kode = "T" . $jum; } else { die("Kode pemesanan melebihi batas"); } } return $kode; }
function get_idkabupaten($lat, $lng) { $id = fetch_row("select idkabupaten from kabupaten \n\twhere lat='{$lat}' and lng='{$lng}'"); return $id; }
// html code using this survey if (!empty($_REQUEST['submit'])) { $sid = intval($_POST['sid']); $msg = response_check_answers($sid, $_SESSION['rid'], $_SESSION['sec']); if ($ESPCONFIG['use_captcha']) { require_once ESP_BASE . 'public/captcha_check.php'; $msg .= response_check_captcha("captcha_check", 0); } // if the parameter test is set in the URL // and the survey is in fact in the test stage // then don't set the cookie if (isset($_REQUEST['test'])) { $sql = "SELECT status, name FROM " . $GLOBALS['ESPCONFIG']['survey_table'] . " WHERE id={$sid}"; $result = execute_sql($sql); if ($result && record_count($result) > 0) { list($status, $name) = fetch_row($result); } else { $status = 0; } if ($status & STATUS_TEST) { $test = 1; } else { $test = 0; } } else { $test = 0; } if (empty($msg) && !$test) { // Added for cookie auth, to eliminate double submits $cookiename = "survey_" . $sid; $expire = time() + 60 * 60 * 24 * $GLOBALS['ESPCONFIG']['limit_double_postings'];
if ($sort == "sender_name") { $order = "sender_name " . $dir . ", sender_domain " . $dir; } else { if ($sort == "sender_domain") { $order = "sender_domain " . $dir . ", sender_name " . $dir; } else { $order = $sort . " " . $dir; } } $query = "SELECT sender_name, sender_domain, src, first_seen, last_seen FROM from_awl ORDER BY " . $order; } else { $order = $sort . " " . $dir; $query = "SELECT sender_domain, src, first_seen, last_seen FROM domain_awl ORDER BY " . $order; } $result = do_query($query); while ($line = fetch_row($result)) { $sd = $line["sender_domain"]; $src = $line["src"]; $fs = $line["first_seen"]; $ls = $line["last_seen"]; if ($mode == "email") { $sn = $line["sender_name"]; echo ' <tr> <td width="20"><input type="checkbox" name="chk[]" value="' . $sn . '@@' . $sd . '@@' . $src . '" /></td> <td width="300"><span title="' . $sn . '">' . shorten_it($sn, 42) . '</span></td> '; } else { $sn = "noname"; echo ' <tr>
} db_close($_result); } unset($_sql); unset($_result); } // To make all results public uncomment the next line. //$results = 1; // See the FAQ for more instructions. // call the handler-prefix once $sid is set to handle // authentication / authorization if (empty($_name) && isset($sid) && $sid) { $_sql = "SELECT title,theme FROM " . $GLOBALS['ESPCONFIG']['survey_table'] . " WHERE id = '{$sid}'"; if ($_result = execute_sql($_sql)) { if (record_count($_result) > 0) { list($_title, $_css) = fetch_row($_result); } db_close($_result); } unset($_sql); unset($_result); } include $ESPCONFIG['handler_prefix']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php if (!empty($ESPCONFIG['charset'])) { echo '<meta http-equiv="Content-Type" content="text/html; charset=' . $ESPCONFIG['charset'] . "\" />\n";
function remindPassword($userid) { $sql = "SELECT email, pw\n\t\tFROM " . PREF . "users\n\t\tWHERE active=1 AND id={$userid}\n\t\tLIMIT 1"; $result = query($sql); $rows = num_rows($result); if (!$rows) { die("Регистрационные данные не будут высланы: пользователь №{$userid} не найден. "); } list($mail, $password) = fetch_row($result); $subject = "Регистрация в базе заявок Дурмштранга"; $text = <<<EOT \tВы зарегистрировались в базе заявок Дурмштранга. \t<br /> \tВаш пароль: {$password} \t<br /> \tПо техническим вопросам обращайтесь к Бодигриму (andrew.lelechenko@gmail.com, skype bodigrim). EOT; send_mail_by_userid($userid, $subject, $text); }
<?php /******************************************** SQLgrey Web Interface Filename: index.php Purpose: Renders the main menu page Version: 1.1.8 *********************************************/ require "includes/functions.inc.php"; $query = "SELECT COUNT(*) AS count FROM connect"; $result = do_query($query); $line = fetch_row($result); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>SQLGrey Webinterface</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="main.css" type="text/css" charset="utf-8" /> <style type="text/css"> input { width: 150px; height: 25px; font-size: 13px; } </style> </head> <body> <div id="page"> <div class="navcontainer">
function get_total_stat() { $hasil = fetch_row("select sum(jumlah) from counter"); return $hasil; }
function db_result001($sql) { return db_result00($sql); $hash = md5($sql); $key = "selina_sql_{$hash}"; $ret = gRedis($key); if ($ret !== null) { $ret = @unserialize($ret); return $ret; } $result = query($sql); $rows = num_rows($result); if (!$rows) { $ret = false; } else { list($ret) = fetch_row($result); } sRedis($key, serialize($ret)); expireRedis($key, 100); return $ret; }
<li><a href="./paginas/contato.php">Contato</a></li> <li><a href="./paginas/galeria.php">Galeria</a></li> </ul> </nav> </div> <div class="one_quarter"> <h2 class="footer_title">Últimas Fotos</h2> <ul id="ft_gallery" class="nospace spacing clear"> <?php $contador = 1; $qtd = 1; while ($linhas = fetch_array($lastest_fotos)) { if ($qtd == 9) { break; } $galeria = fetch_row(execute_query("select galeria_endereco from tb_galeria where galeria_id={$linhas['0']}", $id_conn)); if ($contador == 1) { echo "<li class=\"one_third first\"><a href=\"." . $galeria[0] . $linhas[1] . "\"><img src=\"." . $galeria[0] . $linhas[1] . "\" alt=\"\"></a></li>"; } else { echo "<li class=\"one_third\"><a href=\"." . $galeria[0] . $linhas[1] . "\"><img src=\"." . $galeria[0] . $linhas[1] . "\" alt=\"\"></a></li>"; if ($contador == 3) { $contador = 0; } } $contador++; $qtd++; } ?> <!-- <li class="one_third first"><a href="#"><img src="images/demo/80x80.gif" alt=""></a></li> <li class="one_third"><a href="#"><img src="images/demo/80x80.gif" alt=""></a></li>
source_num_input("{$_Parent_node}:", 'psource', $psource); editarea_input("{$_Text}:", 20, 100, 'text', $text); if (fetch_val("SELECT is_leaf({$source})") == 'f') { textarea_input('Template:', 3, 100, 'template', $template); select_source_type("Type", 'part_type', $part_type); select_source_type("{$_Subtype}:", 'ch_part_type', $ch_part_type); } else { hidden_input('template', false); hidden_input('part_type', $part_type); hidden_input('ch_part_type', 0); } text_input("{$_Sort_order}:", 20, 'sort', $sort); text_input("{$_Source_date}:", 20, 'source_date', $source_date); form_submit(); form_end(); $row = fetch_row("SELECT ecc({$source}), rcc({$source}), ssc({$source})"); printf("<p>{$_There_are} %s %s, %s %s {$_and} %s %s {$_associated_with_this_source}.</p>", $row[0], $row[0] == 1 ? $_event : $_events, $row[1], $row[1] == 1 ? $_relation : $_relations, $row[2], $row[2] == 1 ? $_subsource : $_subsources); echo "</body>\n</html>\n"; } else { $person = $_POST['person']; $source = $_POST['source']; $text = $_POST['text']; $source_date = $_POST['source_date'] ? $_POST['source_date'] : fetch_val("SELECT true_date_extract('{$text}')"); $psource = $_POST['psource'] ? $_POST['psource'] : 0; $sort = $_POST['sort'] ? $_POST['sort'] : 1; $part_type = $_POST['part_type']; $ch_part_type = isset($_POST['ch_part_type']) ? $_POST['ch_part_type'] : 0; $sort = get_sort($psource, $text, $sort); $text = note_to_db($text); $ret = $_POST['ret']; $template = isset($_POST['template']) ? $_POST['template'] : false;
if (!empty($GLOBALS['errmsg'])) { echo $GLOBALS['errmsg']; } return; } // did we show feedback on the last page of the survey? // SFID: 2771740 if (isset($_REQUEST['feedback']) && is_scalar($feedback = $_REQUEST['feedback']) && 'finished' == $feedback) { // then, the next step is to finish up the survey, since the feedback "interrupted" that processing all_done(); } // get the survey $sql = "SELECT status, name, public, open_date, close_date FROM " . $GLOBALS['ESPCONFIG']['survey_table'] . " WHERE id={$sid}"; $result = execute_sql($sql); if ($result && record_count($result) > 0) { list($status, $name, $survey_public, $open_date, $close_date) = fetch_row($result); } else { $status = 0; } // Added for cookie auth, to eliminate double submits // only for public surveys $cookiename = "survey_" . $sid; if ($GLOBALS['ESPCONFIG']['limit_double_postings'] > 0 && isset($_COOKIE["{$cookiename}"]) && $survey_public == 'Y' && !($ESPCONFIG['auth_response'] && auth_get_option('resume'))) { echo mkerror(_('You have already completed this survey.')); return; } $request_direct = 0; $request_referer = ''; if (!empty($_REQUEST['referer'])) { $request_referer = htmlspecialchars($_REQUEST['referer']); } else {
return $result = prepared_query($dbh, $query, $userResponse); } // PROCESS DATA $user = $_SESSION["user"]; $ip = $_SERVER["REMOTE_ADDR"]; //$ipUsed = filter_var($ip, FILTER_VALIDATE_IP) ? ip_exists($ip) : true; if (!empty($_POST)) { $efficacyResponse = getUserResponse($_POST); $efficacyResponse = array_merge(array($user), $efficacyResponse); // Time stuff $start_time = $_SESSION["es_start_time"]; $es_time = time() - $start_time; array_push($efficacyResponse, $es_time); $_SESSION['es_time'] = $es_time; //for later //if (!$ipUsed) { add_efficacy_row($efficacyResponse); $es_id = mysql_insert_id(); //documented php function // Populate the user table $get_user = fetch_row(find_user($user)); $update_user = "******"; prepared_query($dbh, $update_user, array($es_id, $user)); echo "got to end of if"; //} // Redirect user to thank you page $header = "Location: http://cs.wellesley.edu/~hcilab/pghci_privacy/PGHCI-Privacy-Study/pretask.php"; header($header); //redirects user exit; }