database_query($query); if(!$result){ //print "Query Failed"; } for($i=0;$idatabase_num_fields($result);$j++){ $retval[$i][$database->database_field_name($result,$j)] = $database->database_result ($result,$i,$database->database_field_name($result,$j)); }//end inner loop }//end outer loop return $retval; } function nonce_tock($nlife=220000) { $life_of_a_nounce = $nlife; return ceil(time() / ( $life_of_a_nounce )); } function randomcode($len=8) { $code = NULL; for( $i=0; $i<$len; $i++ ) { $char = chr(rand(48,122)); while( !preg_match("~[a-zA-Z0-9]~", $char) ) { if( $char == $lchar ) continue; $char = chr(rand(48,90)); } $pass .= $char; $lchar = $char; } return $pass; } function getRealIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; } function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "textnn": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "''"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'".doubleval($theValue)."'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } //curl using http://mailboxlayer.com phil's email and a mammal function getUrlContent($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $data = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ($httpcode>=200 && $httpcode<300) ? $data : false; } function yearsDifference($endDate, $beginDate) { $date_parts1=explode("-", $beginDate); $date_parts2=explode("-", $endDate); return $date_parts2[0] - $date_parts1[0]; } $dbhost = "localhost"; $dbuser = "db.bateworldcom"; $dbname = "bateworldcom"; $dbpass = "sDIE8U8!5n*4%Ue_x.Pq"; if(!isset($_SESSION["reguid"])){$reguserid=uuid();$_SESSION["reguid"]=$reguserid;} function dbconnect($dbhost,$dbuser,$dbname,$dbpass) {} ?>