// Copyright 2001,2002,2003,2004,2005,2006, Chris Heart - ALL RIGHTS RESERVED WORLDWIDE
include("../tpnsecurity.inc"); // Security function - checks nearly EVERYTHING !
include("../tpndblib.inc"); // enable DB library
include("../tpnuserlib.inc"); // set up user library
checkSessionActive(); // Is session active ? - Security #1
$user_row = checkUser($HTTP_USER_AGENT,$HTTP_REFERER,$REQUEST_URI,$REMOTE_ADDR,$PHP_SELF,$SERVER_NAME); // Check user credentials - Security #2
checkuserData( $user_row ); // Double check user data - Security #3
$countem = true; // for security, set to ON (MORE than two ads !) by default
unset ($message); // reset $message
if ( $ad_id ) // If $ad_id set - get row
{
$ad_row = getRow( "PROFILES", "SID", $ad_id );
$countem = false;
}
else // otherwise . . . .
{
$count = countAds( $user_row[UID] ); // count number of ads user has already
if ( ( $count[0] >= 2 ) && ( ! ( $tpn[id] == 1 ) ) ) // if >= 2 and NOT Admin . . . .
{
$countem = true; // User already has Two or more ads !
$message = "You are permitted TWO Ads only.
You currently have $count[0] Ads.
"; // set message
}
else // User has 0 or 1 Ads
$countem = false;
}
if ( ( isset( $actionflag ) && $actionflag=="update_ad" ) && ($countem != true) && ( $message == "" ) ) // If all okay - actionflag set correctly AND user has < 2 Ads AND $message (error message) NOT set
{
if ( $form[URL] == "http://" ) // Empty it if not filled in
$form[URL]="";
$form[TOWN] = ucwords( strtolower( stripslashes( html( $form[TOWN] ) ) ) ); // Set format
$form[STATE] = ucwords( strtolower( stripslashes( html( $form[STATE] ) ) ) ); // Set format
$form[AD_TITLE] = ucwords( strtolower( stripslashes( html( $form[AD_TITLE] ) ) ) ); // Set format
$form[NICKNAME] = ucwords( strtolower( stripslashes( html( $form[NICKNAME] ) ) ) ); // Set format
$form[AVAILABLE] = "Email Only"; // Force Value !
if ( ( $form[INCAT1] == "" ) OR $form[INCAT1] == "0" )
$form[INCAT1] = "21"; // set default INCAT1
// $catresult = checkAdCat( $user_id, $ad_id, $form[INCAT1] ); // check INCAT1 and category
// if ( $catresult == false )
// $message .= "Sorry - Only one Ad in each category permitted.
";
if ( $form[SEX_ORI] == "" ) // Just in case not set
$form[SEX_ORI] = 0;
/* Now check the category for obvious errors ie - male setting into 'Female Seeking ...' category */
if ( ( $form[SEX_ORI] == 0 ) AND ( $form[INCAT1]==4 OR $form[INCAT1]==31 OR $form[INCAT1]==32 OR $form[INCAT1]==34 OR $form[INCAT1]==54 OR $form[INCAT1]==33 ) ) // for males
$message = "Ad Category ERROR - you cannot have that Category! You said you are a Male ?";
elseif ( ( $form[SEX_ORI] == 1 ) AND ( $form[INCAT1]==3 OR $form[INCAT1]==18 OR $form[INCAT1]==19 OR $form[INCAT1]==21 OR $form[INCAT1]==53 OR $form[INCAT1]==20 ) ) // for females
$message = "Ad Category ERROR - you cannot have that Category! You said you are a Female ?";
if ( $form[WHAT_SEEK] == "") // and again just in case
$form[WHAT_SEEK] == 3;
if ( $form[SITECODE] == "")
$form[SITECODE] = $user_row[COUNTRY];
if ( trim( $form[AD_TITLE] ) == "")
$form[AD_TITLE] = "No Title Given";
else
$form[AD_TITLE] = eregi_replace("\'","", $form[AD_TITLE] ); //strip ' char
$form[LAST_UPDATE] = date("U", time()+64800); // Set datestamp to current time in UNIX time
$nowtime = date("jS M Y G:i:s", time()+64800); // Set now time in 'day/mth/yr time' format
if ( $message=="" )
{
/* Store it in DB */
$form[NICKNAME] = eregi_replace("\'","", $form[NICKNAME] ); // strip any ' chars
$result = insertAd( $form[AD_TITLE], $form[SEX_ORI], $form[WHAT_SEEK], $form[AVAILABLE],
$form[OCCUPATION], $form[PERSONALITY], $form[LOOKS], $form[PHOTO], $form[LOVE], $form[LOATHE], $form[URL],
$form[APPEARCOUNTRY], $form[APPEARCITY], $form[APPEARSTATE], $form[STATUS], $form[LAST_UPDATE], $REMOTE_ADDR,
$form[NICKNAME], $form[INCAT1], $form[SW_CHAT], $form[MY_SAY], $form[SITECODE], $tpn[id], $ad_id );
/* $sexori $gender and $seeking */
$gender_array = array('Male','Female','Couple');
foreach ( $gender_array as $key=>$val )
{
if ( $form[SEX_ORI] == $key )
$sexori = $val;
}
foreach ( $gender_array as $key=>$val )
{
if ( $form[GENDER] == $key )
$gender = $val;
}
$seeking_array = array('Nothing','Male','Female','Either','Casual','Couple','Penpal','Group');
foreach ( $seeking_array as $key=>$val )
{
if ( $form[WHAT_SEEK] == $key )
$seeking = $val;
}
if ($ad_id == false) // Has $ad_id been set ?
{
$ident = $result; // no ? ... Set $ident to returned result
$action = "a NEW Ad at";
}
else // else must be set so ...
{
$ident = $ad_id; // ... set $ident to $ad_id
$action = "UPDATED an Ad at";
}
// email webmaster with details of ad.
$to = "ads@personals.net.au";
$subject = "$ident ADULT Personal Ad Submitted";
$option = "From: updatead@personals.net.au\r\nReally_From: updatead.html\r\nX_Keyword: ADULT_updatead\r\n";
mail( $to, $subject, "User - $tpn[id] : \"$tpn[login]\" has $action https://personals.powweb.com/adminviewad.html?ad_id=$ident (ID=$ident) at $nowtime ($form[LAST_UPDATE]).
Details:
========
Site: $user_row[DEFSITE]
Age: $user_row[AGE]
Name: $user_row[FIRSTNAME] $user_row[LASTNAME]
= = = = = = = = = = = = = = = = =
Title: $form[AD_TITLE]
Gender: $sexori
Seeking : $sexori ---> $seeking
Available: $form[AVAILABLE]
Occupation: $form[OCCUPATION]
Nickname: $form[NICKNAME]
Personality:$form[PERSONALITY]
Looks: $form[LOOKS]
My_Say: $form[MY_SAY]
Love: $form[LOVE]
Loathe: $form[LOATHE]
URL: $form[URL]
AppearCity: $form[APPEARCITY]
AppearState: $form[APPEARSTATE]
AppearCountry: $form[DEFSITE]
Status: $form[STATUS]
Last_Update: $form[LAST_UPDATE]
RemoteAddr: $REMOTE_ADDR
INCAT1: $form[INCAT1]
ChatSwitch: $form[SW_CHAT]
SiteCode: $form[SITECODE]
User_ID: $tpn[id]
Ad_ID: $ident"
, $option ); // finish the mail call
header( "Location: reviewads.html?".SID ); // after sending email to Webmaster with details for history
}
}
elseif ( ! empty( $ad_id ) ) // $ad_id IS set ...
{
$form = $ad_row; // set $form to $ad_row values
if ( $form[UID] != $tpn[id] ) // then check - Security #4
{
include("../tpnheader.inc");
require("../tpnpublicnav.inc"); // Set up public Navigation buttons
mail("webmaster@personals.net.au", "Unauthorised attempt at Viewing/Editing Ads", "Adult user $tpn[id] has attempted to View/Edit Ad_ID = $ad_id", "From: UpdateAd.html@personals.net.au");
print "
You are not permitted to view or edit Ads that are not your own !!
";
print "The webmaster has been notified of your attempt to view or edit someone elses Ad via unauthorised means and you will be logged out automatically.
";
$result = session_unregister("tpn");
session_destroy();
if ($result)
{
print "
You have been Logged Out.";
}
exit;
}
}
/* Now, we set up the page for the browser */
?>
if ( $countem == true ) // If $countem is 2+ - there IS a problem { print "Last updated on print date( "d M Y \a\\t H:i:s", filemtime( basename( $PHP_SELF ) ) ) ?> Australian EST.
$message"; } if ( $countem == false ) // Does NOT have more than two ads OR is Admin. { ?>$form[NICKNAME] = ucwords( strtolower( stripslashes( html( $form[NICKNAME] ) ) ) ); $form[AD_TITLE] = ucwords( strtolower( stripslashes( html( $form[AD_TITLE] ) ) ) ); // Set defaults for new Ads or where info is not set.// if ( ! $form[SITECODE] ) // Old site compatibility $form[SITECODE] = $user_row[DEFSITE]; if ( ! $form[APPEARCITY] ) // Set to User default $form[APPEARCITY] = $user_row[TOWN]; if ( ! $form[APPEARSTATE] ) // Set to User default $form[APPEARSTATE] = $user_row[STATE]; if ( ! $form[SEX_ORI] ) // Set to User default $form[SEX_ORI]= $user_row[GENDER]; if ( ! $form[NICKNAME] ) // Set to User default $form[NICKNAME] = $user_row[USERNAME]; if ( ! $form[APPEARCOUNTRY] ) // Set to User default $form[APPEARCOUNTRY] = $user_row[COUNTRY]; // End of default set section // if ( ( ! $form[WHAT_SEEK] ) && ( ! $form[INCAT1] ) ) // set defaults to match GENDER { if ( $user_row[GENDER] == "0" ) // Is Male ? { $form[SEX_ORI]="0"; // Set to Male $form[WHAT_SEEK]= "2"; // Set to Female $form[INCAT1]= "21"; // Set Men Seeking Women } elseif ( $user_row[GENDER] == "1" ) // Is Female ? { $form[SEX_ORI]="1"; // Set to Female $form[WHAT_SEEK]= "1"; // Set to Male $form[INCAT1]= "34"; // Set Women Seeking Men } elseif ( $user_row[GENDER] == "2" ) // Is Couple ? { $form[SEX_ORI]="2"; // Set to Couples $form[WHAT_SEEK]= "5"; // Set to Couples $form[INCAT1]= "26"; // Set Couples Seeking Couples } else { $form[SEX_ORI]="0"; // Last ditch stand for defaults $form[WHAT_SEEK]="4"; // This has =gotta= work ! $form[INCAT1] = "38" ; } } if ( $form[STATUS]==1 ) // 1 = Visible { $status="Visible"; $adstatus1="1\" checked"; $adstatus2="2\""; } elseif ( $form[STATUS]==2 ) // 2 = Invisible { $status=""; $adstatus1="1\""; $adstatus2="2\" checked"; } elseif ( (! $form[STATUS] ) || $form[STATUS]==0 ) // Brand new Ad { $form[STATUS]=2; $status="New Ad"; $adstatus1="1\" checked"; $adstatus2="2\""; } else // otherwise it is Webmaster Locked ! $status=""; ?> if ( file_exists( "photo1/$form[SID]_1.jpg" ) ) // Are there photos with this ad ? { include("../tpnphotos2.inc"); // if so - display them } } require ("../tpnfooter.inc"); ?>
You are permitted a maximum of TWO ads only.
Please enter all information about you, and in the correct fields.
Photos vastly increase the chances of a reply !
Please send any photos to webmaster@personals.net.au in '.jpg' format ONLY. You may have up to 2 (two) photos per Ad.
Quote your AD_ID number = print $ad_id ?> as well as your Membership Number = print $tpn[id] ?> so we know where to put it !!
A new Ad will have the Ad number available AFTER it has been submitted.
Send the image from your registered Email address please. Any photos are not to be explicit or excessively suggestive.
Answer all questions truthfully and accurately for the greatest chance of a good response.
DON'T put in "Ask Me" or similar - I've already asked you - ok ?
Also, do NOT put Contact details - Email addresses, Phone numbers etc - anywhere in the Ad.
if ( $message != "" ) { print "
$message"; } ?>