iOrig = $fth[$postImage]; $this -> type = $this -> imageType( ); $picInfos = getimagesize( $this -> iOrig[ 'tmp_name' ] ); $width = $picInfos[0]; $height = $picInfos[1]; if( $width > $maxWidth & $height <= $maxHeight ) { $ratio = $maxWidth / $width; } elseif( $height > $maxHeight & $width <= $maxWidth ) { $ratio = $maxHeight / $height; } elseif( $width > $maxWidth & $height > $maxHeight ) { $ratio1 = $maxWidth / $width; $ratio2 = $maxHeight / $height; $ratio = ($ratio1 < $ratio2)? $ratio1:$ratio2; } else { $ratio = 1; } $nWidth = floor($width*$ratio); $nHeight = floor($height*$ratio); if( $this -> type == 'jpg' ) $origPic = imagecreatefromjpeg( $this->iOrig[ 'tmp_name' ] ); elseif( $this -> type == 'png' ) $origPic = imagecreatefrompng( $this->iOrig[ 'tmp_name' ] ); elseif( $this -> type == 'gif' ) $origPic = imagecreatefromgif( $this->iOrig[ 'tmp_name' ] ); //echo "Width: ".$nWidth." - Height: ".$nHeight; $this->iNew = imagecreatetruecolor($nWidth,$nHeight); imagecopyresampled($this->iNew, $origPic, 0, 0, 0, 0, $nWidth, $nHeight, $width, $height); } // function imageType(); return JPG/PNG (so cool !) function imageType( ) { if( eregi( "jpeg", $this -> iOrig[ 'type' ]) ) // JPG return "jpg"; elseif( eregi( "png", $this -> iOrig[ 'type' ] ) ) // PNG return "png"; elseif( eregi( "gif", $this -> iOrig[ 'type' ] ) ) // GIF return "gif"; } // function saveTo( STRING name [, STRING path ] ) // save the new image in the specified path, with the specified name function saveTo( $name = '', $path = "./" ) { if( empty( $name ) ) echo "name!"; elseif( !is_dir( $path ) ) echo "$path is not a directory!"; else { if( $this -> type == 'jpg' ){ @imagejpeg( $this->iNew, $path.$name,100 ); @chmod($path.$name, 0777); } elseif( $this -> type == 'png' ) { @imagepng( $this->iNew, $path.$name ); @chmod($path.$name, 0777); } elseif( $this -> type == 'gif' ) { @imagegif( $this->iNew, $path.$name ); @chmod($path.$name, 0777); } } } } ?>innercall){ $strmsg = "!Error occurred while processing your request,
\nhowever we have recorded your IP address:".$_SERVER['REMOTE_ADDR'] . " for security/debugging reasons
"; die($strmsg); } // connect to the database $dbname on $dbhost with the user/password pair // $dbuser and $dbpass. function db_connect($dbhost, $dbname, $dbuser, $dbpass) { global $CFG; $errors_msg = ""; if (! $dbh = mysql_connect($dbhost, $dbuser, $dbpass)) { if ($CFG->db_debug) { $errors_msg .= "
  • Can't connect to $dbhost as $dbuser
  • "; $errors_msg .= "
  • MySQL Error: ". mysql_error() . "
  • "; $CFG->dbstatus = false; } else { //$errors_msg .= "
  • Database error encountered
  • "; $CFG->dbstatus = false; } if ($CFG->db_die) { $errors_msg .= "
  • This script cannot continue, terminating.
  • "; //print_error($errors_msg); $CFG->dbstatus = false; //die(); } else{ $CFG->dbstatus = false; } if(!empty($errors_msg)) print_error($errors_msg); } if (! mysql_select_db($dbname)) { if ($CFG->db_debug) { //$errors_msg = "
  • Can't select database $dbname
  • "; //$errors_msg .= "
  • MySQL Error: ". mysql_error() . "
  • "; $CFG->dbstatus = false; } else { //$errors_msg .= "
  • Database error encountered
  • "; $CFG->dbstatus = false; } if ($CFG->db_die) { $errors_msg .= "This script cannot continue, terminating."; //print_error($errors_msg); $CFG->dbstatus = false; //die(); } else{ $CFG->dbstatus = false; } } if(!empty($errors_msg)) //print_error($errors_msg); return $dbh; } // disconnect from the database, we normally don't have to call this function // because PHP will handle it function db_disconnect() { mysql_close(); } // run the query $query against the current database. if $debug is true, then // we will just display the query on screen. if $die_on_debug is true, and // $debug is true, then we will stop the script after printing he debug message, // otherwise we will run the query. if $silent is true then we will surpress // all error messages, otherwise we will print out that a database error has // occurred function db_query($query, $debug=false, $die_on_debug=true, $silent=false) { global $CFG; $errors_msg = ""; if ($debug) { $errors_msg .= "
    " . htmlspecialchars($query) . "
    "; //print_error($errors_msg); if ($CFG->db_die) { //die; $CFG->dbstatus = false; } } $qid = mysql_query($query); if (! $qid && ! $silent) { if ($CFG->db_debug) { $errors_msg .= "

    Can't execute query

    \n"; $errors_msg .= "
    " . htmlspecialchars("".$query) . "
    \n"; $errors_msg .= "

    MySQL Error: ". mysql_error(); $err = mysql_error(); //echo $errors_msg; } else { $errors_msg .= "

  • Database error encountered
  • "; $err = mysql_error(); $CFG->dbstatus = false; } if ($CFG->db_die) { $errors_msg .= "

    This script cannot continue, terminating"; $err = mysql_error(); //print_error($errors_msg); //die(); } else{ $CFG->dbstatus = false; } if($errors_msg != ''){ //echo $error_msg; //echo $err; mail_db_error($errors_msg,$err); } //print_error($errors_msg); } return $qid; } //grab the next row from the query result identifier $qid, and return it //as an associative array. if there are no more results, return FALSE function db_fetch_array($qid) { return mysql_fetch_array($qid); } // grab the next row from the query result identifier $qid, and return it // as an array. if there are no more results, return FALSE function db_fetch_row($qid) { return mysql_fetch_row($qid); } // grab the next row from the query result identifier $qid, and return it // as an object. if there are no more results, return FALSE function db_fetch_object($qid) { return mysql_fetch_object($qid); } /* return the number of records (rows) returned from the SELECT query with * the query result identifier $qid. */ function db_num_rows($qid) { return mysql_num_rows($qid); } /* return the number of rows affected by the last INSERT, UPDATE, or DELETE * query */ function db_affected_rows() { return mysql_affected_rows(); } /* if you just INSERTed a new row into a table with an autonumber, call this * function to give you the ID of the new autonumber value */ function db_insert_id() { return mysql_insert_id(); } /* free up the resources used by the query result identifier $qid */ function db_free_result($qid) { mysql_free_result($qid); } /* return the number of fields returned from the SELECT query with the * identifier $qid */ function db_num_fields($qid) { return mysql_num_fields($qid); } /* return the name of the field number $fieldno returned from the SELECT query * with the identifier $qid */ function db_field_name($qid, $fieldno) { return mysql_field_name($qid, $fieldno); } /* move the database cursor to row $row on the SELECT query with the identifier * $qid */ function db_data_seek($qid, $row) { if (db_num_rows($qid)) { return mysql_data_seek($qid, $row); } } function db_get_insert_query($qid_fields, $qid_values, $tableName){ $qid_query = ""; $temp = " INSERT INTO " . $tableName . " ( "; $temp2 = ") VALUES ("; $temp3 = " "; if(count($qid_fields) == count($qid_values)){ for($i=0; $i Error:".$error,"From: admin@mountviewestate.com.au"); @mail("kunalgandhi24@gmail.com","Database Error !!, Dte:".date("d/m/Y H:i:s"),"Error Message Displayed:".$msg."
    Error:".$error,"From: admin@mountviewestate.com.au"); } function db_get_page($page){ if($page <= 0){ $page = 1; } return $page; } function db_get_limit($limit){ if(intval($limit) <= 0){ $limit = 10; } return intval($limit); } function db_get_limitvalue($page, $limit){ return $page * $limit - ($limit); } function db_check_orderby($orderBy, $validSortOrders){ if(is_array($validSortOrders)){ if(!in_array($orderBy, $validSortOrders)){ $orderBy = "id"; } } return $orderBy; } ?>innercall){ $strmsg = "!Error occurred while processing your request,
    \nhowever we have recorded your IP address:".$_SERVER['REMOTE_ADDR'] . " for security/debugging reasons
    "; die($strmsg); } function setdefault(&$var, $default="") { if (!isset($var) || empty($var)) { $var = $default; } } /* if $var is undefined, return $default, otherwise return $var */ function nvl(&$var, $default="") { return isset($var) ? $var : $default; } /* returns $var with the HTML characters (like "<", ">", etc.) properly quoted, * or if $var is undefined, will return an empty string. note this function * must be called with a variable, for normal strings or functions use o() */ function ov(&$var) { return isset($var) ? htmlSpecialChars(stripslashes($var)) : ""; } /* prints $var with the HTML characters (like "<", ">", etc.) properly quoted, * or if $var is undefined, will print an empty string. note this function * must be called with a variable, for normal strings or functions use p() */ function pv(&$var) { echo isset($var) ? htmlSpecialChars(stripslashes($var)) : ""; } function pv_br(&$var) { echo isset($var) ? "
    ".htmlSpecialChars(stripslashes($var)) : ""; } function pv_comma(&$var) { echo isset($var) ? ",".htmlSpecialChars(stripslashes($var)) : ""; } function pv_lim(&$var, $lim) { echo isset($var) ? htmlSpecialChars(stripslashes(substr(($var), 0, $lim)))."..." : ""; } /*this function can be used to print an entire word if the user has specified a limit which breaks a single word*/ function pv_lim1(&$var,$lim) { //to find the last position of space in a string $pos1 = strrpos($var," "); //to get the substring with the specified limit $substring = htmlSpecialChars(stripslashes(substr(($var), 0, $lim))); //to check the next char of the string which was returned using the limit specified by the user $s2 = substr($var,0,$lim+1); //to get the last position of space in string s2 $pos = strrpos($s2, " "); //if limit specified by user is greater than pos1 then print the whole string submitted as a parameter if($lim > $pos1) { echo $var; }//go on checking the next char of the substring returned using the limit specified else{ if($pos!= $lim) { pv_lim1($var,$lim+1); if($pos== $lim){ break; } } else{ echo $s2."..."; } } } function pv_err(&$var) { echo ""; echo isset($var) ? (stripslashes($var)) : ""; echo ""; } /* returns $var with HTML characters (like "<", ">", etc.) properly quoted, * or if $var is empty, will return an empty string. */ function o($var) { return empty($var) ? "" : htmlSpecialChars(stripslashes($var)); } /* prints $var with HTML characters (like "<", ">", etc.) properly quoted, * or if $var is empty, will print an empty string. */ function p($var) { echo empty($var) ? "" : htmlSpecialChars(stripslashes($var)); } /* this is an internal function and normally isn't called by the user. it * loops through the results of a select query $query and prints HTML * around it, for use by things like listboxes and radio selections * * NOTE: this function uses dblib.php */ function db_query_loop($query, $prefix, $suffix, $found_str, $default="") { $output = ""; $result = db_query($query); while (list($val, $label) = db_fetch_row($result)) { if (is_array($default)) { $selected = empty($default[$val]) ? "" : $found_str; } else { $selected = $val == $default ? $found_str : ""; } $output .= "$prefix value='$val' $selected>$label$suffix"; } return $output; } /* generate the