FATAL ERROR : Could not connect to Griffon's MySQL Database.
" ); } mysql_select_db( "personals", $link ) or die ( "FATAL ERROR : Could not open Griffon's MySQL Database: ".mysql_error() ); } else { $link = mysql_connect("mysql13.powweb.com", "tpnpersonals", "c1048576h" ); if ( ! $link ) { die( "FATAL ERROR : Could not connect to the Teens Personals Network™ MySQL Database" ); } mysql_select_db( "tpnpersonals", $link ) or die ( "FATAL ERROR : Could not open the Teens Personals Network™ MySQL Database: ".mysql_error() ); } } function checkPass( $username, $password, $newmember ) { global $link; if ( $newmember == true ) { if (substr_count($newmember, ".") ) // Is there a '.' in $newmember ? If so then $random_no is set { $res1 = explode(".", $newmember); // split sequence number at '.' $newmember = $res1[0]; // so make $newmember first number - before the '.' $query1 = "AND RANDOM_NO='$res1[1]'"; // and add this to for random seed number in mySQL query } $row = mysql_query( "SELECT * FROM TEMP WHERE USERNAME='$username'",$link ); // get password from database $getrow = mysql_fetch_array( $row ); // make row of data into array $salt = substr($getrow[PASSWORD],0,2); // Extract salt from password $cryptedpwd = crypt( $password, $salt ); // encrypt form password and use in membership query $query = "SELECT ID, USERNAME, PASSWORD FROM TEMP WHERE USERNAME='$username' AND PASSWORD='$cryptedpwd' AND ID='$newmember' $query1"; $result = mysql_query( $query,$link ); if ( ! $result ) die ( "checkPass FATAL ERROR: ".mysql_error() ); if ( mysql_num_rows( $result ) ) return mysql_fetch_array( $result ); else return false; } else { $row = mysql_query( "SELECT * FROM USERS WHERE USERNAME='$username'",$link ); $geturow = mysql_fetch_array( $row ); $salt = substr($geturow[PASSWORD],0,2); $cryptedpwd = crypt( $password, $salt ); $query = "SELECT UID, USERNAME, PASSWORD FROM USERS WHERE USERNAME='$username' AND PASSWORD='$cryptedpwd'"; $result = mysql_query( $query,$link ); if ( ! $result ) die ( "Teen checkPass FATAL ERROR: ".mysql_error() ); if ( mysql_num_rows( $result ) ) { mysql_query( "UPDATE USERS set LOGINS = (LOGINS+1) where UID = $geturow[UID] ", $link ); return mysql_fetch_array( $result ); } else return false; } } function updateTable( $table,$column,$data,$tableid,$tid ) { global $link; $result = mysql_query( "update $table set $column='$data' where $tableid='$tid'", $link); if ( ! $result ) Print ( "updateTable Failed : ".mysql_error() ); return ( mysql_affected_rows($link) ); } function log_user ( $id, $username, $action, $log_ip, $address ) // log logins and logouts { global $link; $query = "INSERT into LOG ( UID, USERNAME, ACTION, LOG_IP, ADDRESS ) "; $query .= "VALUES ( '$id', '$username', '$action', '$log_ip', '$address' )"; mysql_query( $query, $link ); } function changePwd( $userid, $password ) { global $link; $result = mysql_query( "update USERS set PASSWORD='$password' WHERE UID='$userid'",$link ); if (!$result) return false; // not changed else return true; // changed successfully } function getRow( $table, $fnm, $fval ) { global $link; $result = mysql_query( "SELECT * FROM $table WHERE $fnm='$fval'",$link ); if ( ! $result ) { die ( "getRow FATAL error: ".mysql_error() ); } return mysql_fetch_array( $result ); } function countAds( $user_id ) // Counts the total number of Ads per UID & return Ad numbers { global $link; $count = mysql_query ("select COUNT(*) from PROFILES where UID='$user_id' ", $link ); return mysql_fetch_array( $count ); } function AdNumbers( $user_id ) // Gives Ad numbers - Used by contact.html { global $link; $result = mysql_query( "Select SID from PROFILES where UID='$user_id' AND STATUS=1 ", $link ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row[0] ); return $ret; } function getItem( $table, $column, $item, $itemvalue ) // In $table, retrieve $column value where item = itemvalue { global $link; $result = mysql_query( "SELECT $column FROM $table WHERE $item='$itemvalue'", $link ); if ( ! $result ) { die ( "getRow FATAL error: ".mysql_error() ); } return mysql_fetch_array( $result ); } function checkAdmin ( $username ) { global $link; $resultant = mysql_query("SELECT UID FROM USERS where USERNAME='$username'", $link ); if ( ! $result1 ) { Print ( "CheckAdmin Failed : " .mysql_error() ); } return $resultant; } function newUser( $username,$password,$random_no,$gender,$country, $dob,$email,$ip ) { global $link; $ts = mktime(); $timestamp = date("j M Y H:i:s", $ts ); $result = mysql_query( "INSERT INTO TEMP (USERNAME,PASSWORD,RANDOM_NO,TIMESTAMP,GENDER,COUNTRY,DOB,EMAIL,IP,REG_SITE) VALUES ('$username','$password','$random_no','$timestamp','$gender','$country','$dob','$email','$ip','TEENS' )", $link); if ( ! $result ) { die ( "newUser Insert Failed : " .mysql_error() ); } return mysql_insert_id( $link ); } function updateToAdult($defsite,$uid,$mage) { global $teen, $link; if ($uid == $teen[UID]) $resultant = mysql_query("UPDATE USERS set DEFSITE='$defsite', AGE='$mage' where UID='$teen[id]'", $link ); if ( ! $resultant ) { Print ( "updateToAdult Failed : " .mysql_error() ); } return ( mysql_affected_rows($link) ); } function updateMember( $username,$password,$ustat,$firstname,$lastname,$street,$suburb,$town,$state,$country,$postcode,$email,$dob, $age,$gender,$icqnum,$timestamp,$term_date,$reg_ip,$sw_icqnum,$uid,$defsite ) { global $link; $ts = mktime(); $tstamp = date("j M Y H:i:s", $ts ); if ( ! $uid ) // New member because $uid NOT set { $query = "INSERT INTO USERS ( USERNAME, PASSWORD, FIRSTNAME, LASTNAME, STREET, SUBURB, TOWN, STATE, COUNTRY, POSTCODE, EMAIL, DOB, AGE, GENDER, ICQNUM, TIMESTAMP, TERM_DATE, REG_IP, LASTTIMESTAMP, SW_ICQNUM, DEFSITE ) VALUES( '$username', '$password', '$firstname', '$lastname', '$street', '$suburb', '$town', '$state', '$country', '$postcode', '$email', '$dob', '$age', '$gender', '$icqnum', '$timestamp', '$term_date', '$reg_ip', '$tstamp', '$sw_icqnum', '$defsite' )"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "insertMember error #1 : ".mysql_error() ); return mysql_insert_id( $link ); // return id } if ( $uid ) // must be Update - $uid set { $query = "UPDATE USERS set FIRSTNAME='$firstname',LASTNAME='$lastname',USTATUS='$ustat',STREET='$street',SUBURB='$suburb', TOWN='$town',STATE='$state',COUNTRY='$country',POSTCODE='$postcode',EMAIL='$email',DOB='$dob',AGE='$age',GENDER='$gender', ICQNUM='$icqnum',TIMESTAMP='$timestamp',TERM_DATE='$term_date',LAST_IP='$reg_ip', SW_ICQNUM='$sw_icqnum' WHERE UID='$uid'"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "updateMember update Failed: ".mysql_error() ); return mysql_insert_id( $link ); // return id } } function writeOptionList( $table, $id ) { global $link; $query = "select * from $table "; if ( ( $table == CATADULT ) || ( $table == CATEGORIES ) || ( $table == CATTEEN ) ) $query .= "ORDER BY ORDER_BY, CATNAME"; $result = mysql_query( $query, $link ); if ( ! $result ) { print "Failed to open $table

"; return false; } while ( $a_row = mysql_fetch_row( $result ) ) { print "\n"; } } function updateAd( $teen_id, $firstname, $lastname, $street, $suburb, $town, $state, $country, $postcode, $email, $dob, $age, $gender, $timestamp, $term_date, $sw_icqnum ) { global $link; $query = "UPDATE USERS set FIRSTNAME='$firstname', LASTNAME='$lastname', STREET='$street', SUBURB='$suburb', "; $query = " TOWN='$town', STATE='$state', COUNTRY='$country', POSTCODE='$postcode', EMAIL='$email', DOB='$dob', AGE='$age', GENDER='$gender', TIMESTAMP='$timestamp', TERM_DATE='$term_date', SW_ICQNUM='$sw_icqnum' WHERE UID='$teen_id'"; $result = mysql_query( $query, $link ); if ( ! $result ) { die ( "updateAd update error: ".mysql_error() ); } } function insertAd( $ad_title, $sex_ori, $what_seek, $available, $occupation, $personality, $looks, $photo, $love, $loathe, $url, $appearcountry, $appearcity, $appearstate, $status, $last_update, $last_ip, $nickname, $incat1, $sw_chat, $my_say, $sitecode, $user_id, $ad_id ) { global $link; if ( ! $ad_id ) // LAST_UPDATE = TIMESTAMP & $LAST_IP = FIRST_IP on insert! { $timestamp = $last_update; $uptime = date("j M Y H:i:s", $timestamp ); // Set UPTIME to human readable form $query = "INSERT INTO PROFILES (AD_TITLE, SEX_ORI, WHAT_SEEK, AVAILABLE, OCCUPATION, PERSONALITY, LOOKS, LOVE, LOATHE, URL, STATUS, APPEARCOUNTRY, APPEARCITY, APPEARSTATE, UPTIME, TIMESTAMP, LAST_UPDATE, FIRST_IP, NICKNAME, INCAT1, SW_CHAT, MY_SAY, SITECODE, UID ) VALUES( '$ad_title', '$sex_ori', '$what_seek', '$available', '$occupation', '$personality', '$looks', '$love', '$loathe', '$url', '$status', '$appearcountry', '$appearcity', '$appearstate', '$uptime', '$timestamp', '$last_update', '$last_ip', '$nickname', '$incat1', '$sw_chat', '$my_say', '$sitecode', '$user_id' )"; } else { $query = "UPDATE PROFILES SET AD_TITLE='$ad_title', SEX_ORI='$sex_ori', WHAT_SEEK='$what_seek', AVAILABLE='$available', OCCUPATION='$occupation', PERSONALITY='$personality', LOOKS='$looks', PHOTO='$photo', LOVE='$love', LOATHE='$loathe', URL='$url', STATUS='$status', APPEARCOUNTRY='$appearcountry', APPEARCITY='$appearcity', APPEARSTATE='$appearstate', LAST_UPDATE='$last_update', LASTIP='$last_ip', NICKNAME='$nickname', INCAT1='$incat1', SW_CHAT='$sw_chat', MY_SAY='$my_say', SITECODE='$sitecode' WHERE SID='$ad_id' AND UID='$user_id'"; } $result = mysql_query( $query, $link ); if ( ! $result ) die ( "insertad error: ".mysql_error() ); return mysql_insert_id( $link ); } function deleteAd( $sid, $uid ) { global $link; $query = "UPDATE PROFILES SET UID='0', STATUS='99', OLD_UID='$uid' WHERE SID='$sid' and UID='$uid'"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "deleteAd FATAL error: ".mysql_error() ); return ( mysql_affected_rows( $link ) ); } function suspendUser( $user_id ) { global $link; $query = "UPDATE PROFILES set STATUS='2' where UID='$user_id'"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "suspendUser FATAL error: ".mysql_error() ); return ( mysql_affected_rows($link) ); } function getUsers( $country="", $lastname="", $id="" ) { global $link; $query = "SELECT * "; $query .= "FROM USERS, WHERE "; if ( $lastname != "" && ! empty( $lastname ) ) $query .= "USERS.LASTNAME='$lastname' "; if ( ( $lastname != "" ) && (! empty( $lastname ) ) && ($id != "" && ! empty( $id ) ) ) $query .= "AND "; if ( $id != "" && ! empty( $id ) ) $query .= "USERS.UID='$id' "; $query .= "ORDER BY USERS.UID"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getUsers Fatal Error: ".mysql_error() ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getUserJoined( $id ) { global $link; $query = "SELECT USERS.* "; $query .= "FROM USERS WHERE "; $query .= "USERS.UID='$id'"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getUserJoined Fatal Error: ".mysql_error() ); return mysql_fetch_array( $result ); } function retrieveAds ( $email, $username, $user_id, $firstname, $lastname, $nickname, $town, $state, $country, $category, $ad_id, $sitecode, $fromage, $toage ) { global $link; $nowdate = date("U")-31536000; $query = "Select PROFILES.*, USERS.*, SEEKTEEN.SEEK as WHATSEEK, gender.gender as GENDERTYPE "; $query .= "FROM PROFILES, USERS, SEEKTEEN, gender WHERE "; $query .= "PROFILES.UID=USERS.UID AND PROFILES.WHAT_SEEK=SEEKTEEN.ID AND PROFILES.SEX_ORI=gender.id "; if ( ! empty( $email ) ) $query .= "AND USERS.EMAIL like '$email%' "; if ( ! empty( $username ) ) $query .= "AND USERS.USERNAME like '$username%' "; if ( ! empty( $user_id ) ) $query .= "AND USERS.UID='$user_id' "; if ( ! empty( $firstname ) ) $query .= "AND USERS.FIRSTNAME like '$firstname%' "; if ( ! empty( $lastname ) ) $query .= "AND USERS.LASTNAME like '$lastname%' "; if ( ! empty( $nickname ) ) $query .= "AND PROFILES.NICKNAME like '$nickname%' "; if ( ! empty( $country ) && $country != "ANY" ) $query .= "AND USERS.COUNTRY like '$country' "; if ( ! empty( $category ) && $category != "ANY" ) $query .= "AND PROFILES.INCAT1='$category' "; if ( ! empty( $town ) ) $query .= "AND PROFILES.APPEARCITY like '$town%' "; if ( ! empty( $state ) ) $query .= "AND USERS.STATE like '$state%' "; if ( ! empty( $ad_id ) ) $query .= "AND PROFILES.SID='$ad_id' "; if ( ! empty( $fromage ) && ( empty( $toage ) ) ) $query .= "AND USERS.AGE='$fromage' "; if ( ! empty( $fromage ) && ( ! empty( $toage ) ) ) $query .= "AND USERS.AGE BETWEEN '$fromage' AND '$toage' "; $query .= "AND USERS.USTATUS = '1' "; // 1 = user status = active member $query .= "AND USERS.TERM_DATE >= '$nowdate' "; // and not not expired $query .= "AND PROFILES.STATUS = '1' "; // 1 = Visible $query .= "AND USERS.AGE<=19 "; // aged 20 or less $query .= "AND USERS.DEFSITE = 'TEENS' "; $query .= "ORDER BY PROFILES.LAST_UPDATE desc LIMIT 0,25 "; // Limit the output to 25 rows $result = mysql_query( $query, $link ); if ( ! $result ) die ( "retreiveAds Fatal Error: ".mysql_error() ); $teen[countrows] = mysql_num_rows( $result ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getAds( $user_id ) //Used by reviewads.php { global $link; $query = "Select PROFILES.*, USERS.*, "; $query .= "CATEGORIES.CATNAME as CATEGORIESNAME, "; $query .= "SEEK.SEEK as WHATSEEK, "; $query .= "gender.gender as GENDERTYPE "; $query .= "FROM PROFILES, USERS, SEEK, gender, CATEGORIES WHERE "; $query .= "PROFILES.UID=USERS.UID "; $query .= "AND PROFILES.INCAT1=CATEGORIES.CATID "; $query .= "AND PROFILES.WHAT_SEEK=SEEK.ID "; $query .= "AND USERS.GENDER=gender.id "; $query .= "AND PROFILES.UID='$user_id' "; $querey .= "AND PROFILES.STATUS=1"; $query .= "ORDER BY PROFILES.SID "; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getads Fatal Error: ".mysql_error() ); $teen[countrows] = mysql_num_rows( $result ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getAdverts( $ad_id ) { global $link; $query = "Select PROFILES.*, CATEGORIES.CATNAME as CATEGORIESNAME "; $query .= "FROM PROFILES, CATEGORIES WHERE "; $query .= "PROFILES.INCAT1=CATEGORIES.CATID "; $query .= "AND PROFILES.UID='$ad_id' "; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getads Fatal Error: ".mysql_error() ); $teen[countrows] = mysql_num_rows( $result ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getAd( $ad_id ) { global $link; $query = "Select PROFILES.*, USERS.*, CATEGORIES.CATNAME as CATEGORIESNAME "; $query .= "FROM PROFILES, USERS, CATEGORIES WHERE "; $query .= "PROFILES.INCAT1=CATEGORIES.CATID "; $query .= "AND PROFILES.UID=USERS.UID "; $query .= "AND PROFILES.SID='$ad_id' "; $query .= "AND USERS.USTATUS=1 "; $querey .= "AND PROFILES.STATUS=1"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getAd Fatal Error: ".mysql_error() ); return mysql_fetch_array( $result ); } ?> = "9" ) { $teen[data] = false; } else { $teen[data] = true; } return $user_row; } function checkUserData( $userarray ) // checks basic user data is valid { global $teen; if ( ! isset( $userarray[FIRSTNAME] ) || ! isset( $userarray[LASTNAME] ) || ! isset( $userarray[STREET] ) || ! isset( $userarray[EMAIL] ) || ! isset( $userarray[COUNTRY] ) || ! isset( $userarray[TOWN] ) ) { $teen[data] = false; // was $teen[details] ! 080202 10:24 header( "Location: updateuser.php?".SID ); exit; } } function html( $str ) { if ( is_array( $str ) ) { foreach ( $str as $key=>$val ) $str[$key] = htmlstr( $val ); return $str; } return htmlstr( $str ); } function htmlstr( $str ) { $str = htmlspecialchars( $str ); $str = nl2br( $str ); return $str; } ?> UNAUTHORISED
You MUST enter via the correct route.
", "bad_referer" ); $sitename = "MissingBadAccessAttempt"; include("counter2.php"); } return $found; } else return false; // must set if empty, otherwise it will be allowed } //if ($referers) // check to see it IS set // { // check_referer($referers); // check it ! // } //******************************* // handle the 'require' fields //******************************* // function requireFields( $require, $redirect ) { if ( isset( $require)) { $require = ereg_replace( " +", "", $require); // seperate at the commas $required = split(",",$require); for ($i=0;$iEMail Address appears to be invalid", "email_error" ); $sitename = "tpnBadEmail"; include("counter2.php"); } return; } else print_error ( " Your email address is empty !" ); } //************************************* // check the email fields for validity //************************************* function checkURL ($URL) { if ( $URL ) { $URL = strtolower( trim( $URL ) ); if ( ! eregi( "^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$", $URL ) ) { print_error( "Your URL appears to be Invalid", "URL_error" ); // $sitename = "TPNBadURL"; // include("counter2.php"); } return; } } //**************************** // The Humble Error function.. //**************************** function print_error( $reason, $type=0 ) { if ($type == "missing_data") // for missing required data { // include ("../teenerrorheader.inc"); ?> An error has occurred with the information you have submitted.
The reported error is :


Please use your browser's BACK button to return to your previous page.
The information submitted has NOT been processed An error has been detected in the EMail Address you submitted.



Please use your browser's BACK button to return to the previous page and
correct the error.

The form you submitted has NOT been processed. An error has been detected in the Referring Address you presented.



Please use your browser's BACK button to return to the previous page and
proceed correctly from there.

The request you submitted has been REFUSED. An error has been detected in the URL you submitted.



Please use your browser's BACK button to return to the previous page and
correct the error.

The form you submitted has NOT been processed. The Information was NOT processed because of the following reason(s):


Please use your Browser's 'BACK' button to return to the previous page.
\n"; exit; } class UsersOnline { /* public: connection parameters */ var $host = 'localhost'; var $database = 'websapp'; var $user = ''; var $password = ''; var $timeoutSeconds = 120; var $numberOfUsers = 0; function UsersOnline() { $this->refresh(); } function getNumber() { return $this->numberOfUsers; } function printNumber() { if($this->numberOfUsers == 1) { echo "$this->numberOfUsers User online"; } else { echo "$this->numberOfUsers Users online"; } } function refresh() { global $REMOTE_ADDR, $PHP_SELF; $currentTime = time(); $timeout = $currentTime - $this->timeoutSeconds; mysql_connect($this->host, $this->user, $this->password) or die('Error conecting to database'); mysql_db_query($this->database, "INSERT INTO usersonline VALUES ('$currentTime','$REMOTE_ADDR','$PHP_SELF')") or die('Error writing to database'); mysql_db_query($this->database, "DELETE FROM usersonline WHERE timestamp < $timeout") or die('Error deleting from database'); $result = mysql_db_query($this->database, "SELECT DISTINCT ip FROM usersonline WHERE file='$PHP_SELF'") or die('Error reading from database'); $this->numberOfUsers = mysql_num_rows($result); mysql_close(); } } ?> Send Email To Webmaster

Send Email to Webmaster


Email Subject :  Your Email Address : 

    Your Name : 

Email Message : (Note: minimum - 30 characters)