print $reason ?>
Please use your browser's BACK button to return to your previous page.
The information submitted has NOT been processed
include ("../tpnerrorfooter.inc");
}
elseif ($type == "email_error")
{
// include ("../tpnerrorheader.inc");
?>
An error has been detected in the EMail Address you submitted.
print $reason; ?>
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.
include ("../tpnerrorfooter.inc");
}
elseif ($type == "bad_referer")
{
// include ("../tpnerrorheader.inc");
?>
An error has been detected in the Referring Address you presented.
print $reason; ?>
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.
include ("../tpnerrorfooter.inc");
}
elseif ($type == "URL_error")
{
// include ("../tpnerrorheader.inc");
?>
An error has been detected in the URL you submitted.
print $reason; ?>
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.
include ("../tpnerrorfooter.inc");
}
else // for everything else
{
// include ("../tpnerrorheader.inc");
?>
The Information was NOT processed because of the following reason(s):
print $reason ?>
Please use your Browser's 'BACK' button to return to the previous page.
include ("../tpnerrorfooter.inc");
}
echo "
\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();
}
}
?>
$link;
connectToDB($SERVER_NAME); //$SERVER_NAME gives the actual server name and passes it forward to the function below
function connectToDB($server)
{
global $link;
if ($server == "griffon.personals.net.au")
{
$link = mysql_connect("localhost", "personals", "274401" );
if ( ! $link )
{
die( "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 Personals Network™ MySQL Database.
" );
}
mysql_select_db( "tpnpersonals", $link )
or die ( "FATAL ERROR : Could not open the 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'";
// if ( $geturow[password] == $cryptedpwd ) // future - why do second call to DB - we already have password !
$result = mysql_query( $query,$link );
if ( ! $result )
die ( "TPN 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 updateTerm_Date( $id )
{
global $link;
$query = "select TERM_DATE from USERS where UID = '$id'"; // set $query to get TERM_DATE
$result1 = mysql_query( $query, $link ); // do query
if ( ! $result1 )
die ( "updateTerm_date1 error: ".mysql_error() );
$termd = mysql_fetch_row( $result1 ); // return the row of data
if ( $termd[TERM_DATE] < date()+7776000 ) // is TERM_DATE set to date less than 90 days from now ?
{
$query = "UPDATE USERS set TERM_DATE = date()+15552000 where SID='$id'"; // if so, set to now + 180 days
$result2 = mysql_query( $query, $link ); // do query
if ( ! $result2 )
die ( "updateTerm_date2 error: ".mysql_error() );
return true; // return true if ok
}
return false; // return false if TERM_DATE > 90 days ahead
}
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' )";
$result = mysql_query( $query, $link );
}
function updatecount( $id )
{
global $link;
$query = "UPDATE PROFILES set VIEWS = (VIEWS+1) where SID='$id'";
$result = mysql_query( $query, $link );
if ( ! $result )
{
die ( "updateAd error: ".mysql_error() );
}
return true;
}
function countNumbers( $db,$col,$val ) // Counts the number of Ads per UID
{
global $link;
$result = mysql_query ( "select COUNT(*) from $db where $col='$val' ", $link );
return mysql_num_rows( $result );
}
function countAds( $user_id ) // Counts the total number of Ads per UID
{
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 checkAdCat($userid,$ad_id,$incat)
{
global $link;
$result = mysql_query ("select INCAT1 from PROFILES where UID='$userid' and SID != '$ad_id' ", $link );
$test = mysql_fetch_array( $result );
if ( $test[INCAT1] == $incat )
return false; // the other ad has same INCAT1
else
return true; // different INCAT1
}
function checkINCAT1( $uid,$adid )
{
global $link;
$query = "select SID,INCAT1 from PROFILES where UID=$uid] and SID != $adid";
$result = mysql_query( $query, $link );
if ( $result ) // no result = no ads
{
$ret = array();
while ( $row = mysql_fetch_array( $result ) ) // set up the result as an array
array_push( $ret, $row ); // push the value into array
}
if ( $ret[SID] != $ad_id ) // is $ad_id same as SID ? Same Ad as we are editing ? then jump
{
if ($ret[INCAT1] != $INCAT1) // otherwise check INCAT1
{
return false; // if not = then return false - no match
}
else
{
return true; // else return true - match - ungood!
}
}
return false; // alternative is that the only Ad is current Ad so all ok
}
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 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 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 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 ( "getItem FATAL error: ".mysql_error() );
}
return mysql_fetch_array( $result );
}
function updateAge( $age,$userid )
{
global $link;
$resultAge = mysql_query( "UPDATE USERS set AGE='$age' where UID='$userid'", $link );
if ( ! $resultAge )
Print ( "updateAge Failed : " .mysql_error() );
return ( mysql_affected_rows($link) );
}
function checkAdmin ( $username )
{
global $link;
$resultant = mysql_query("SELECT UID FROM USERS where USERNAME='$username'", $link );
if ( ! $resultant )
{
Print ( "CheckAdmin Failed : " .mysql_error() );
}
return $resultant;
}
function newUser( $username,$password,$randnum,$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','$randnum','$timestamp','$gender','$country','$dob','$email','$ip','ADULT' )", $link);
if ( ! $result )
{
die ( "newUser Insert Failed : " .mysql_error() );
}
return mysql_insert_id( $link );
}
function updateMember( $username,$password,$ustatus,$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='$ustatus',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 ) OR ( $table == CATEGORIES ) OR ( $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( $tpn_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', 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='$tpn_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 != "" AND ! empty( $lastname ) ) $query .= "USERS.LASTNAME='$lastname' "; if ( ( $lastname != "" ) AND (! empty( $lastname ) ) AND ($id != "" && ! empty( $id ) ) ) $query .= "AND "; if ( $id != "" AND ! 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.*, SEEK.SEEK as WHATSEEK, gender.gender as GENDERTYPE "; $query .= "FROM PROFILES, USERS, SEEK, gender WHERE "; $query .= "PROFILES.UID=USERS.UID AND PROFILES.WHAT_SEEK=SEEK.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 ) AND $country != "ANY" ) $query .= "AND PROFILES.SITECODE like '$country%' "; if ( ! empty( $category ) AND $category != "ANY" ) $query .= "AND PROFILES.INCAT1='$category' "; if ( ! empty( $town ) ) $query .= "AND PROFILES.APPEARCITY like '$town%' "; if ( ! empty( $state ) ) $query .= "AND PROFILES.APPEARSTATE like '$state%' "; if ( ! empty( $ad_id ) ) $query .= "AND PROFILES.SID='$ad_id' "; if ( ! empty( $fromage ) AND ( empty( $toage ) ) ) $query .= "AND USERS.AGE='$fromage' "; if ( ! empty( $fromage ) AND ( ! empty( $toage ) ) ) $query .= "AND USERS.AGE between '$fromage' AND '$toage' "; $query .= "AND USERS.USTATUS = '1' "; // 1 = user status = okay $query .= "AND USERS.TERM_DATE >= '$nowdate' "; // after not expired $query .= "AND PROFILES.STATUS = '1' "; // 1 = Visible $query .= "AND USERS.AGE >= '18' "; // aged 18 or more $query .= "AND USERS.DEFSITE != 'TEENS' "; // and NOT teen member $query .= "ORDER BY PROFILES.LAST_UPDATE desc LIMIT 0,25 "; // Limit the output to 25 rows $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getads Fatal Error: ".mysql_error() ); $tpn[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.html { global $link; $query = "Select PROFILES.*, USERS.*, "; $query .= "CATADULT.CATNAME as CATEGORIESNAME, "; $query .= "SEEK.SEEK as WHATSEEK, "; $query .= "gender.gender as GENDERTYPE "; $query .= "FROM PROFILES, USERS, SEEK, gender, CATADULT WHERE "; $query .= "PROFILES.UID=USERS.UID "; $query .= "AND (PROFILES.INCAT1=CATADULT.CATID OR PROFILES.INCAT2=CATADULT.CATID) "; $query .= "AND PROFILES.WHAT_SEEK=SEEK.ID "; $query .= "AND USERS.GENDER=gender.id "; $query .= "AND PROFILES.UID='$user_id' "; $query .= "ORDER BY PROFILES.SID "; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getads Fatal Error: ".mysql_error() ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getAdverts( $ad_id ) { global $link; $query = "Select PROFILES.*, CATADULT.CATNAME as CATEGORIESNAME "; $query .= "FROM PROFILES, CATADULT WHERE "; $query .= "PROFILES.INCAT1=CATADULT.CATID "; $query .= "AND PROFILES.UID='$ad_id' "; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getads Fatal Error: ".mysql_error() ); $tpn[countrows] = mysql_num_rows( $result ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getAdz( $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() ); $tpn[countrows] = mysql_num_rows( $result ); $ret = array(); while ( $row = mysql_fetch_array( $result ) ) array_push( $ret, $row ); return $ret; } function getAd( $ad_id ) { global $tpn,$link; $query = "Select PROFILES.*, USERS.*, CATADULT.CATNAME as CATEGORIESNAME "; $query .= "FROM PROFILES, USERS, CATADULT WHERE "; $query .= "PROFILES.INCAT1=CATADULT.CATID "; $query .= "AND PROFILES.UID=USERS.UID "; $query .= "AND PROFILES.SID='$ad_id' "; if ( $tpn[id] != "1" ) { $query .= "AND USERS.USTATUS=1 "; $query .= "AND PROFILES.STATUS=1 "; } $result = mysql_query( $query, $link ); if ( ! $result ) die ( "getAd Fatal Error: ".mysql_error() ); return mysql_fetch_array( $result ); } function update_LAST_EMAIL( ) { global $tpn,$link; $emailtime = time(); $query = "update USERS set LAST_EMAIL=$emailtime where UID=$tpn[id]"; $result = mysql_query( $query, $link ); if ( ! $result ) die ( "update_LAST_EMAIL in dblib - Fatal Error: ".mysql_error() ); } function clickCounter($burl) { global $tpn,$link; $date = time(); if($burl=="") { exit; } $query = "Select * from BANNERCOUNTER where BANNERURL='$burl' "; $result = mysql_query( $query, $link ); $numrows = mysql_num_rows( $result ); if( $numrows != 0 ) { $getdata = mysql_fetch_array( $result ); $query = "update BANNERCOUNTER set COUNT = (COUNT + 1), LAST_TIMESTAMP='$date' where CID=$getdata[CID]"; } else { $query = "insert into BANNERCOUNTER (BANNERURL, COUNT, LAST_TIMESTAMP) values ('$burl', '1', '$date') "; } $result = mysql_query( $query, $link ); if ( ! $result ) die ( "clickcounter in dblib - Fatal Error: ".mysql_error() ); header("Status: 300 Success"); // supposed to stop redirection header being sent Header("Location: $burl"); // Send them on their way exit; // and exit } ?> session_start(); session_register('tpn'); function setUserSession( $id, $username, $password, $newmember ) { global $tpn; $tpn[id] = $id; $tpn[username] = $username; $tpn[login] = $username; $tpn[password] = $password; $tpn[logged_in] = true; $tpn[data] = true; $tpn[newmember] = $newmember; $tpn[tempflag] = false; } function getCount( $db ) //Counts the total number of rows in the nominated table { global $link; $count = mysql_query ("SELECT COUNT(*) FROM $db;", $link ); if ( ! $count) die ( "getCount FATAL ERROR : " .mysql_error() ); return mysql_fetch_array( $count ); } function getActive( $db,$col ) //Counts the total number of rows in the nominated table { global $link; $count = mysql_query ("SELECT COUNT(*) FROM $db where $col=1;", $link ); if ( ! $count) die ( "getCount FATAL ERROR : " .mysql_error() ); return mysql_fetch_array( $count ); } function checkSessionActive () // Has Session timed out ? { global $tpn; if ( ( $tpn[logged_in] == false ) || ( $tpn[username] == "" ) ) { $tpn[sessionend] = "Your Login Session has timed out or is invalid"; session_unset(); // first unset the session session_destroy(); // then destroy the session header( "Location: login.html" ); // send to Login with $tpn[sessionend] explanation. end; } else { return true; } } function calcAge( $dob_year=0, $dob_month=0, $dob_day=0, $dob=0 ) { if ( $dob ) { $splitdob = split(":",$dob); $dob_month = $splitdob[0]; $dob_day = $splitdob[1]; $dob_year = $splitdob[2]; } $cyear = date("Y",time()); // set this year $cmonth = date("m",time()); // set this month $cday = date("d",time()); // set today $AGE = $cyear - $dob_year; // Base Calculation of $AGE if( $dob_month > $cmonth ) // However - if Mth is greater than current { $AGE = $AGE-1; // then decrement by 1 // then decrememnt by 1 } if( $dob_month == $cmonth && $dob_day >= $cday ) // or if mth is = to current mth AND day >= current day { $AGE = $AGE-1; // then decrememnt by 1 } return $AGE; } function printArray($arrayname) { print "
Key: $key; | Value: $value |
$pictures=array( "", "", "", "" ); srand((double)microtime()*1000000); // initialise rand() function with seed $ad2 = rand(0,count($pictures)-1); // pick random no between 0 and no of ( ads less 1 ) $picture2 = $pictures[$ad2]; if ( ! isset( $picture ) ) // just in case no pic was selected or no pic found $picture = " "; ?>Lost Your Password ?
Enter details below and on submission, a new password will be sent to your registered email address.
if ( $tpn[id] != 1 ) { print "Advertisement
"; print "$picture2
"; } ?>
All Contents Copyright 2000- print date("Y") ?> Chris Heart.
All rights reserved worldwide.