public static function query($q, $params = array()) { if (self::$link === null) { self::connect(); } if (!is_array($params)) { $params = array_slice(func_get_args(), 1); } if (!empty($params)) { $q = preg_replace('/:(\\d+)/e', 'self::quote($params[\\1 - 1])', $q); } self::$numQueries++; self::$sql = $q; self::$result = mysql_query($q, self::$link) or die(mysql_error()); if (!self::$result) { return false; } else { if (!is_resource(self::$result)) { return true; } } $rset = array(); while ($row = mysql_fetch_assoc(self::$result)) { $rset[] = $row; } return $rset; }
public function query($query) { if (!empty($query) && trim($query) != "") { self::connect(); self::$result = mysql_query($query, self::$connection) or Log::write("mysql", mysql_error()); } }
$the_tag = str_replace("¡¡", " ", $the_tag); $the_tag = str_replace(" ", "_", $the_tag); $the_tag = explode(",", $the_tag); $max_count = count($the_tag); for ($n = 0; $n < $max_count; $n++) { $the_tag[$n] = trim($the_tag[$n], "_"); $the_tag[$n] = mysql_real_escape_string($the_tag[$n]); if (strlen($the_tag[$n]) < 3 || preg_match("/[\\d\\.]+/", $the_tag[$n])) { $db_tmp->update($setting['db']['pre_sub'] . "news_show", array("tag" => "replace('" . $the_tag[$n] . ",', '', tag)"), array("news_id", "n=", $record['news_id'])); $db_tmp->update($setting['db']['pre_sub'] . "news_show", array("tag" => "replace('," . $the_tag[$n] . "', '', tag)"), array("news_id", "n=", $record['news_id'])); continue; } if (strlen($the_tag[$n] > 50)) { $the_tag[$n] = substrPro($the_tag[$n], 0, 50); } if ($db_tmp->result($setting['db']['pre_sub'] . "news_tag", "id", array("tag", "=", $the_tag[$n]))) { $db_tmp->update($setting['db']['pre_sub'] . "news_tag", array("count" => "+1", "update_date" => "UNIX_TIMESTAMP()"), array("tag", "=", $the_tag[$n])); } else { $db_tmp->insert($setting['db']['pre_sub'] . "news_tag", array(0, $the_tag[$n], 1, 0, "UNIX_TIMESTAMP()", "UNIX_TIMESTAMP()")); } } if (++$n % 50 === 0) { $db_tmp->ReConnect(false, $setting['db']['name']); } } $db_tmp->delete($setting['db']['pre_sub'] . "news_tag", array(array("count", "n<", 2), array("click", "n<", 5, "and"), array("add_date", "f<", "UNIX_TIMESTAMP()-60*60*24*10", "and"))); $db->Free(); $n = 1; $db->select($setting['db']['pre_sub'] . "news_tag", "id, tag"); while ($record = $db->GetRS()) { $counter = $db_tmp->result($setting['db']['pre_sub'] . "news_show", "count(*)", array("tag", "like", $record['tag']));
mysql_close(); include_once "gzip_footer.php"; } else { if ($_GET[code] == '01') { if ($_POST['system_safe'] != '1') { header("location:index.php?act=idx"); } require "memory.php"; require "function/lib_install.php"; include_once "gzip_header.php"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<meta name=\"Author\" content=\"" . $CP[author] . "\">\n\t<meta name=\"Keywords\" content=\"" . $CP[name] . "\">\n\t<meta name=\"Description\" content=\"" . $CP[credit] . "\">\n\t<meta name=\"Copyright\" content=\"" . $CP[name] . " (c) " . $CP[corp] . "\">\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\">\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"theme/{$STORED['THEME']}/style.css\">\n\t<style type=\"text/css\">\n\t\t.title_bar {\n\t\t\tBACKGROUND-IMAGE: url(theme/{$STORED['THEME']}/{$THEME['title_bar_img_url']})\n\t\t}\n\t\t.title_bar2 {\n\t\t\tBACKGROUND-IMAGE: url(theme/{$STORED['THEME']}/{$THEME['title_bar2_img_url']})\n\t\t}\n\t</style>\n</head>\n<body " . $background . ">\n"; $sql = new MySQL(); $sql->Connect($CONFIG_sql_host, $CONFIG_sql_username, $CONFIG_sql_password); $query = "SELECT COUNT(*) FROM {$CONFIG_sql_cpdbname}.memory WHERE memory_object =\"sgcp_install\" AND memory_value1=\"1\""; $sql->result = mysql_query($query); if (!$sql->result()) { if (mysql_select_db($CONFIG_sql_cpdbname)) { $dropdb = "DROP DATABASE `{$CONFIG_sql_cpdbname}`;"; mysql_query($dropdb); } $createdb = "CREATE DATABASE `{$CONFIG_sql_cpdbname}`;"; if (mysql_query($createdb)) { if ($contents = file_get_contents("install/sql-files/sgcp_database.sql")) { $cpi = new CP_Install(); $execute_query = $cpi->promt_query($contents); for ($i = 0; $i < count($execute_query); $i++) { mysql_db_query($CONFIG_sql_cpdbname, $execute_query[$i]); } redir("index.php?act=idx", "Automatic System : has created a {$CONFIG_sql_cpdbname} database", 3); } else { redir("index.php?act=idx", "Automatic System : Could not read sgcp_database.sql file", 3);
<? /* * Sintaxe: table nome da tabela onde procurar a imagem id id da imagem * typeField nome do campo tipo da imagem imgField nome do campo onde está a * imagem - blob */ error_reporting ( E_ALL ); include_once ("classes.inc.php"); $db = new MySQL (); $db->open (); $sql = "SELECT * FROM " . $_REQUEST ['table'] . " WHERE id_" . $_REQUEST ['table'] . "='" . $_REQUEST ['id'] . "'"; $db->query ( $sql ); $varTabela = $db->result ( 0, $_REQUEST ['typeField'] ); header ( "Content-type: $varTabela" ); echo $db->result ( 0, $_REQUEST ['imgField'] ); $db->close (); ?>
function check_category($forum_id) { global $CONFIG_sql_cpdbname; $forum_id = (int) $forum_id; $sql = new MySQL(); $query = "SELECT category_id FROM {$CONFIG_sql_cpdbname}.forum WHERE forum_id = \"" . mysql_res($forum_id) . "\""; $sql->result = $sql->execute_query($query, 'function.php'); if ($sql->count_rows()) { $row = $sql->fetch_row(); $query = "SELECT COUNT(*) FROM {$CONFIG_sql_cpdbname}.memory WHERE memory_object = \"forum_category\" and memory_value1 = \"" . mysql_res($row['category_id']) . "\""; $sql->result = $sql->execute_query($query, 'function.php'); if (!$sql->result()) { return 0; } } else { return 0; } return $row[category_id]; }
} } } else { if ($GET_showtopic && $GET_view) { $GET_showtopic = (int) $GET_showtopic; if ($GET_view == 'getnewpost') { $query = "SELECT reply_id FROM {$CONFIG_sql_cpdbname}.board_reply WHERE topic_id =\"" . mysql_res($GET_showtopic) . "\" ORDER by reply_id DESC"; $sql->result = $sql->execute_query($query, 'index.php'); $count_rows_topic = $sql->count_rows(); $row_get_topic = $sql->fetch_row(); $reply_id = $row_get_topic[reply_id]; } else { if ($GET_view == 'findpost' && $GET_p) { $query = "SELECT COUNT(*) FROM {$CONFIG_sql_cpdbname}.board_reply WHERE topic_id =\"" . mysql_res($GET_showtopic) . "\" && reply_id<=\"" . mysql_res($GET_p) . "\" ORDER by reply_id DESC"; $sql->result = $sql->execute_query($query, 'index.php'); $count_rows_topic = $sql->result(); $reply_id = $GET_p; } else { header("location:index.php?act=idx"); } } if ($count_rows_topic <= $CONFIG_per_page) { $pages = '1'; } else { if ($count_rows_topic % $CONFIG_per_page == '0') { $pages = $count_rows_topic / $CONFIG_per_page; } else { $pages = $count_rows_topic / $CONFIG_per_page + 1; $pages = (int) $pages; } }
function get_attn_reg($check, $val, $val2) { header("Content-type: text/xml;charset=iso-8859-3"); global $CONFIG_sql_dbname, $lang; $sql = new MySQL(); $check = strip_tags($check); switch ($check) { case "userid": $query = "SELECT userid FROM {$CONFIG_sql_dbname}.login WHERE userid = \"" . mysql_res($val) . "\""; if (!length($val, 4, 24)) { echo "- {$lang['Reg_attn_1']}"; } else { if (!isAlphaNumeric($val)) { echo "- {$lang['Reg_attn_11']}"; } else { if ($sql->count_rows($sql->execute_query($query, 'lib_ajax.php'))) { echo "- {$lang['Reg_attn_2']}"; } } } break; case "pass": if (!length($val, 4, 24)) { echo "- {$lang['Reg_attn_3']}"; } else { if (!isAlphaNumeric($val)) { echo "- {$lang['Reg_attn_12']}"; } } break; case "pass2": if ($val != $val2) { echo "- {$lang['Reg_attn_4']}"; } else { if (!isAlphaNumeric($val)) { echo "- {$lang['Reg_attn_13']}"; } else { if (!length($val, 4, 24)) { echo "- {$lang['Reg_attn_5']}"; } } } break; case "slspass": if (!length($val, 4, 24)) { echo "- {$lang['Reg_attn_6']}"; } else { if (!isAlphaNumeric($val)) { echo "- {$lang['Reg_attn_14']}"; } } break; case "slspass2": if ($val != $val2) { echo "- {$lang['Reg_attn_7']}"; } else { if (!isAlphaNumeric($val)) { echo "- {$lang['Reg_attn_15']}"; } else { if (!length($val, 4, 24)) { echo "- {$lang['Reg_attn_8']}"; } } } break; case "email": $query = "SELECT COUNT(*) FROM {$CONFIG_sql_dbname}.login WHERE email = \"" . mysql_res($val) . "\""; if (!isMailform($val)) { echo "- {$lang['Reg_attn_9']}"; } else { if ($sql->result($sql->execute_query($query, 'lib_ajax.php'))) { echo "- {$lang['Reg_attn_10']}"; } } break; } }