Есть ли от простакова сочинение

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 <? class Database { var $db_id = false; var $connected = false; var $query_num = 0; var $query_list = array(); var $mysql_error = ''; var $mysql_version = ''; var $mysql_error_num = 0; var $mysql_extend = "Mysql"; var $Mysql_time_taken = 0; var $query_id = false; public function connect($db_user, $db_pass, $db_name, $db_location = 'localhost', $show_error=1) { if(!$this->db_id = @mysql_connect($db_location, $db_user, $db_pass)) { if($show_error == 1) { $this->display_error(mysql_error(), mysql_errno()); } else { return false; } } if(!@mysql_select_db($db_name, $this->db_id)) { if($show_error == 1) { $this->display_error(mysql_error(), mysql_errno()); } else { return false; } } $this->mysql_version = mysql_get_server_info(); if(!defined('collate')) { define ("collate", "cp1251"); } if (version_compare($this->mysql_version, '4.1', ">=")) mysql_query("/!40101 set names '" . collate . "' /"); $this->connected = true; return true; } public function query($query, $show_error=true) { $time_before = $this->get_real_time(); if(!$this->connected) $this->connect(Mysql_user,Mysql_password,Mysql_ DB,Mysql_hostname); if(!($this->query_id = mysql_query($query, $this->db_id) )) { $this->mysql_error = mysql_error(); $this->mysql_error_num = mysql_errno(); if($show_error) { $this->display_error($this->mysql_error, $this->mysql_error_num, $query); } } $this->Mysql_time_taken += $this->get_real_time() - $time_before; // $this->query_list[] = array( 'time' => ($this->get_real_time() - $time_before), // 'query' => $query, // 'num' => (count($this->query_list) + 1)); $this->query_num ++; return $this->query_id; } function get_row($query_id = '') { if ($query_id == '') $query_id = $this->query_id; return mysql_fetch_assoc($query_id); } function get_affected_rows() { return mysql_affected_rows($this->db_id); } function get_array($query_id = '') { if ($query_id == '') $query_id = $this->query_id; return mysql_fetch_array($query_id); } public function super_query($query, $multi = false) { if(!$multi) { $this->query($query); $data = $this->get_row(); $this->free(); return $data; } else { $this->query($query); $rows = array(); while($row = $this->get_row()) { $rows[] = $row; } $this->free(); return $rows; } } public function num_rows($query_id = '') { if ($query_id == '') $query_id = $this->query_id; return mysql_num_rows($query_id); } public function insert_id() { return mysql_insert_id($this->db_id); } public function get_result_fields($query_id = '') { if ($query_id == '') $query_id = $this->query_id; while ($field = mysql_fetch_field($query_id)) { $fields[] = $field; } return $fields; } public function safesql( $source ) { if(!$this->db_id) $this->connect(Mysql_user,Mysql_password,Mysql_ DB,Mysql_hostname); if ($this->db_id) return mysql_real_escape_string ($source, $this->db_id); else return addslashes($source); } public function free( $query_id = '' ) { if ($query_id == '') $query_id = $this->query_id; @mysql_free_result($query_id); } public function close() { @mysql_close($this->db_id); } public function get_real_time() { list($seconds, $microSeconds) = explode(' ', microtime()); return ((float)$seconds + (float)$microSeconds); } public function display_error($error, $error_num, $query = '') { if($query) { $query = preg_replace("/([0-9a-f]){32}/", "", $query); // Hides all hashes $query_str = "$query"; } if ( stristr($_server['http_user_agent'], 'Firefox') ) $brauzer = "Firefox"; elseif ( stristr($_server['http_user_agent'], 'Chrome') ) $brauzer = "Chrome"; elseif ( stristr($_server['http_user_agent'], 'Safari') ) $brauzer = "Safari"; elseif ( stristr($_server['http_user_agent'], 'Opera') ) $brauzer = "Opera"; elseif ( stristr($_server['http_user_agent'], 'msie 6.0') ) $brauzer = "IE 6"; elseif ( stristr($_server['http_user_agent'], 'msie 7.0') ) $brauzer = "IE 7"; elseif ( stristr($_server['http_user_agent'], 'msie 8.0') ) $brauzer = "IE 8"; $ip = $_server['remote_addr']; $date = date('d.m.Y H:i:s'); $session = $_session['name']; $data = @fopen("error_log", "a+"); fputs($data, "$session||$ip||$date||$brauzer||$error||$error_nu m||$query_str||\n"); fclose($data); if(!$error == "Can't connect to Mysql server on 'web-2.pawn.su' (4)") { $data2 = @fopen(".htaccess", "a+"); fputs($data2, "deny from $ip\n"); fclose($data2); } echo '<font color="black" size="4">Ошибка с базой данных!</font>'; exit(); } } $db = new Database; ?>
Источник: http://www.cyberforum.ru/php-database/thread836692.html

Облако тегов: лазерная коррекция зрения лечение израиль цена

Оставить комментарий