SetFetchMode(ADODB_FETCH_ASSOC); $cn->PConnect($HOST, $DBUSER, $PASS, $DBNAME); $cn->execute("SET CLIENT_ENCODING TO 'LATIN1'"); //echo $cn->execute("SHOW client_encoding"); $strSQL = "SELECT * FROM $tablename "; if (!empty($whereclause)) { $strSQL .= "WHERE $whereclause"; } $rs = &$cn->Execute($strSQL); return $rs; $rs->Close(); $cn->Close(); } function getSQLrow($xSQL) { include ("global.php"); include ("parseform.php"); //database connection $cnTemp = &ADONewConnection($DRIVER); $cnTemp->SetFetchMode(ADODB_FETCH_ASSOC); $cnTemp->PConnect($HOST, $DBUSER, $PASS, $DBNAME); $cnTemp->execute("SET CLIENT_ENCODING TO 'LATIN1'"); $rsTemp = &$cnTemp->Execute($xSQL); return $rsTemp; $cnTemp->Close(); } function getValue($tablename, $fieldname, $whereclause) { include ("global.php"); include ("parseform.php"); //database connection $cnTemp = &ADONewConnection($DRIVER); $cnTemp->SetFetchMode(ADODB_FETCH_ASSOC); $cnTemp->PConnect($HOST, $DBUSER, $PASS, $DBNAME); $cnTemp->execute("SET CLIENT_ENCODING TO 'LATIN1'"); $strSQL = "SELECT $fieldname FROM $tablename "; if (!empty($whereclause)) { $strSQL .= "WHERE $whereclause"; } $rsTemp = &$cnTemp->Execute($strSQL); $valreturn = $rsTemp->fields[$fieldname]; return $valreturn; $rsTemp->Close(); $cnTemp->Close(); } function checkEmail($email) { if ((eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))) { return true; } return false; } function resizeImage($n_width,$n_height,$filename,$target) { // these are the max sizess $width = $n_width; $height = $n_height; // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output // $tn = "fanphotos/" . $fileid . "_tn.jpg"; imagejpeg($image_p, $target, 100); // return $target; } function setTransparency($new_image,$image_source) { $transparencyIndex = imagecolortransparent($image_source); $transparencyColor = array('red' => 255, 'green' => 255, 'blue' => 255); if ($transparencyIndex >= 0) { $transparencyColor = imagecolorsforindex($image_source, $transparencyIndex); } $transparencyIndex = imagecolorallocate($new_image, $transparencyColor['red'], $transparencyColor['green'], $transparencyColor['blue']); imagefill($new_image, 0, 0, $transparencyIndex); imagecolortransparent($new_image, $transparencyIndex); } //--< GET REAL IP ADDRESS //--< eal @ 15feb2012 function bl_get_userIP() { $priv_ip = $pub_ip = ""; if (!empty($_SERVER['HTTP_CLIENT_IP'])) { //--< check ip from share internet $priv_ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //--< to check ip if pass from proxy $priv_ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $priv_ip = $_SERVER['REMOTE_ADDR']; } $pub_ip = $_SERVER['REMOTE_ADDR']; return array($priv_ip,$pub_ip); } //--< bl_get_userIP() ?>