keys = array(); $c_key = base64_encode(sha1(md5($ckey))); $c_key = substr($c_key, 0, round(ord($ckey{0})/5)); $c2_key = base64_encode(md5(sha1($ckey))); $last = strlen($ckey) - 1; $c2_key = substr($c2_key, 1, round(ord($ckey{$last})/7)); $c3_key = base64_encode(sha1(md5($c_key).md5($c2_key))); $mid = round($last/2); $c3_key = substr($c3_key, 1, round(ord($ckey{$mid})/9)); $c_key = $c_key.$c2_key.$c3_key; $c_key = base64_encode($c_key); for($i = 0; $i < strlen($c_key); $i++){ $this->keys[] = $c_key[$i]; } } function encrypt($string){ $string = base64_encode($string); $keys = $this->keys; for($i = 0; $i < strlen($string); $i++){ if(count($keys)>0){ $id = $i % count($keys); $ord = ord($string{$i}); $ord = $ord OR ord($keys[$id]); $id++; $ord = $ord AND ord($keys[$id]); $id++; $ord = $ord XOR ord($keys[$id]); $id++; $ord = $ord + ord($keys[$id]); $string{$i} = chr($ord); } else{ $id = $i % 1; $ord = ord($string{$i}); $ord = $ord OR ord($keys[$id]); $id++; $ord = $ord AND ord($keys[$id]); $id++; $ord = $ord XOR ord($keys[$id]); $id++; $ord = $ord + ord($keys[$id]); $string{$i} = chr($ord); } } return base64_encode($string); } function decrypt($string){ $string = base64_decode($string); $keys = $this->keys; for($i = 0; $i < strlen($string); $i++){ if(count($keys)>0) { $id = $i % count($keys); $ord = ord($string{$i}); $ord = $ord XOR ord($keys[$id]); $id++; $ord = $ord AND ord($keys[$id]); $id++; $ord = $ord OR ord($keys[$id]); $id++; $ord = $ord - ord($keys[$id]); $string{$i} = chr($ord); } else{ $id = $i % 1; $ord = ord($string{$i}); $ord = $ord XOR ord($keys[$id]); $id++; $ord = $ord AND ord($keys[$id]); $id++; $ord = $ord OR ord($keys[$id]); $id++; $ord = $ord - ord($keys[$id]); $string{$i} = chr($ord); } } return base64_decode($string); } } ?>
".mysql_error()."
"; print_error(); if(LOCAL_MODE) { echo "
sql: $sql"; } echo ""; } function print_error() { $debug_backtrace = debug_backtrace(); for ($i = 1; $i < count($debug_backtrace); $i++) { $error = $debug_backtrace[$i]; echo "
"; echo "
"; echo "File: ".$error['file']."
"; echo "Line: ".$error['line']."
"; echo "Function: ".$error['function']."
"; echo "
"; } } function db_fetch_array($sql, $dbcon2 = null) { if($dbcon2==''){ if(!isset($GLOBALS['dbcon'])) { connect_db(); } $dbcon2 = $GLOBALS['dbcon']; } $result = mysql_fetch_array($sql) or die(mysql_error()); return $result; } function db_fetch_object($sql, $dbcon2 = null) { if($dbcon2==''){ if(!isset($GLOBALS['dbcon'])) { connect_db(); } $dbcon2 = $GLOBALS['dbcon']; } $result = mysql_fetch_object($sql) or die(mysql_error()); return $result; } function NumRows($sql, $dbcon2 = null) { if($dbcon2==''){ if(!isset($GLOBALS['dbcon'])) { connect_db(); } $dbcon2 = $GLOBALS['dbcon']; } $result = mysql_num_rows($sql) ; if(!is_numeric($result)){ return 0; } else{ return $result; } } ?>