hello and thank you for taking a look at this.
i, no matter what id do can not get variables to echo a value
or inserted into my db. i uploaded the original file and parse error
line by parse error line had to remove all brackets, which doesn't
make sense to me right now, except for the two encompassing header:.
one of many forms submitted to this will actually process and
post now with no errors but will not, as i mentioned, print any of my
echo. here is the thing in it's entirety and i very much appreciate
your time and efforts. best regards, addison ellis
<?
session_start();
if (@$auth != "yes")
{
header("Location: login.php");
exit();
}
include("config.php");
$sql = "SELECT first_name,last_name FROM accounts
WHERE email='$logname'";
$result = mysql_query($sql)
or die("Couldn't execute query 1.");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
extract($row);
echo "
<head><title>Create an Ad</title></head>
<h3 align='center' style='margin-top: .05in'>
$first_name $last_name</h3>";
echo " id=$id, HTTP_POST_VARS=$HTTP_POST_VARS, key=$key,
value=$value, category=$category, subcategory=$subcategory,
logname=$logname<br>";
foreach ($HTTP_POST_VARS as $key => $value)
$key = stripslashes($key);
/* is there a better way to do this? the below if ($key !=...) are
all fields from all the various forms that submit to this page that
are not required to be filled in. so if ($value == "") checks all the
other fields, which are the required fields. there are almost as many
required as not, so i opted to go with if ($key !=...)*/
if ($key != "destination" and $key != "depart_city" and $key
!= "quantity" and $key != "depart_time" and $key != "depart_date" and
$key != "arrival_time" and $key != "return_date" and $key !=
"return_depart" and $key != "return_arrive" and $key != "price" and
$key != "other" and $key != "contact" and $key != "condition" and
$key != "color" and $key != "date_available" and $key != "distance"
and $key != "pets" and $key != "deposit" and $key != "lease" and $key
!= "mileage" and $key != "dates_available")
if ( $value == "" )
echo "<font face=verdana size=1 color=red>Required information is
missing.\n Please click your browser's back button, try
again.</font><br>\n";
exit();
if (ereg("^[A-Za-z' -]{1,50}$",$key))
echo "<font face=verdana size=1 color=red>Some information is not
processing.\n Please click your browser's back button, check you
entries and try again.</font><br>\n";
exit();
$$key = strip_tags(trim($value));
/*this next section checks the contact field to see if it is an
irregular phone or email address. i would prefer to have two seperate
fields(phone,email) to be checked individually but only one or the
other is required and i don't know how to have it check; if one field
is filled in and if it contains no irregularities, it is ok if the
other field is not filled in. then, on to "else."*/
if (ereg("^[0-9)(xX -]{7,20}$",$contact))
echo "<font face=verdana size=1 color=red>It appears your Contact
Phone Number may be entered incorrectly.\n Please click your
browser's back button, check your entry and try again.</font><br>\n";
exit();
if (!ereg("^.+@.+\\..+$",$contact))
{
echo "<font face=verdana size=1 color=red>It appears your eMail
Address may be entered incorrectly.\n Please click your browser's
back button, check your entry and try again.</font><br>\n";
exit();
}
else
foreach($HTTP_POST_VARS as $column_name => $column_value)
$column_names .= $column_name . ',';
$column_values .= "'$column_values',";
$today = date("yyyy-mm-dd");
$query = "insert into ads values ($column_names,createdate)
values ($column_values,'$today')";
$result = mysql_db_query($dbname,$query)
or die (mysql_error());
/* send email to account holder */
$emess1="\n\n\tUsername:$email\n\n";
$emess2="A new Vanderbilt Register Classified Ad has been
setup for you.";
$emess3="We appreciate your Placing an ad with us.\n\n";
$emess4="If you have any questions or problems, email ";
$emess5="ads@vanderbilt.edu";
$emess =
$emess1.$emess2.$emess3.$emess4.$emess5;
$ehead="From: ads@vanderbilt.edu\r\n";
$subject = "Your Vanderbilt Register Classified Ad";
$mailsend=mail("$email","$subject","$emess","$ehead");
$body = "A new ad has been added to the que.
You may add the store to the site by going to
http://www.vanderbilt.edu/ca/admin/index.php
";
mail("addison@bellsouth.net", "New Ad", $body);
?>
--
Addison Ellis
small independent publishing co.
114 B 29th Avenue North
Nashville, TN 37203
(615) 321-1791
addison@bellsouth.net
info@smipco.com
subsidiaries of small independent publishing co.
info@gloabaldog.com
info@momandpocentral.com