I am trying to set up some code to reference files in a folder from the site root (/).
Everything I try says the path is Home/domainrootname/Public_HTML/folder name.
In my code I am trying to use a relative path.
Ex:
A page loads from Public_HTML
In that page's code, I call another page, this page is located at /forms (before public_html).
So I am using the path ../forms
But when the error comes up (php error) it says that the path indicated on row 11 of my referring php document is home/vanduzee/public_html/forms .... which does not exist.
It seems my captcha cannot work for some of my forms because the actual form submission document is on the Root of public_html. I have tried putting the form submission documents into a subfolder of public_html, but the spam bots still find the document and post spam to my db.
Here is my captcha file - located in public_html/captcha - this is called from a button on the index.php file. While I had insert_com_db on the root (public_html), I received about 200 spam every 10 minutes, so I removed the file from the public_html root and removed the buttons on the index page.
Code: Select all
<?php
session_start();
$PHP_SELF = $_SERVER['PHP_SELF'];
$errore = 0;
if(isset($_POST['submit']) && isset($_SESSION['captcha'])) {
if(isset($_POST['code'])){
$_code = $_POST['code'];
if($_SESSION['captcha'] == $_code){
header("Location: /index.php?page=mycaptcha/goothercomments");
exit;
} else {
$errore = 1;
}
} else {
$errore = 1;
}
}
if(!isset($_SESSION['captcha'])){session_register('captcha');}
$PHP_SELF = $_SERVER['PHP_SELF'];
$stringa = '';
$cifre = 5;
for($i=1;$i<=$cifre;$i++){
$letteraOnumero = rand(1,2);
if($letteraOnumero == 1){
// lettera
$lettere = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$x = rand(1,11);
$lettera = substr($lettere,$x,1);
$stringa .= $lettera;
} else {
$numero = rand(3,7);
$stringa .= $numero;
}
}
$_SESSION['captcha'] = $stringa;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Captcha entrance page</title>
<style media="all" type="text/css">
#captcha{margin:0 auto;text-align:center}
.errore{color:#f00}
.style2 {
font-size: 14px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style3 {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000099; }
</style>
</head><body>
<div id="captcha">
<p><img src="captcha.php" />
</p>
<p class="style3"><strong>To proceed to the web form please<br />
insert the code you see above into the Code field below<br />
and then click the enter button.
</strong> <br />
[ any letters you see should be inserted as CAPITALS and if you<br />
have difficulty in reading the image above then refresh your browser <br />
a few times until you see an image that is clear enough to copy
] </p>
<p class="style2">If you get the code wrong, you will be allerted and can try again </p>
<p class="style2"><strong>It is necessary to click "Submit", not just hitting Enter</strong>.</p>
<form id="captchaform" action="<?php echo $PHP_SELF ?>" method="post">
<p><label for="code">Code: </label><input type="text" name="code" id="code" /></p>
<p><input type="submit" id="submit" name="submit" value="Enter" /></p>
</form>
<?php if($errore == 1){ ?>
<p class="errore">The code you inserted was not correct .<br />
<a href="<?php echo $PHP_SELF ?>">Click here to generate a new Captcha code and try again</a></p>
<?php } ?>
</div>
</body></html>
The line header("Location: /index.php?page=mycaptcha/goothercomments"); calls another file in the same folder -goothercomments. Here is its code:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title> After captcha verification, this page must link to your renamed web form </title>
<meta name="description" content="last captcha verification redirect page">
<meta name="keywords" content="how to use captcha, captcha example ">
<style type="text/css">
<!--
.style1 {
color: #000066;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
text-decoration: underline;
}
a:visited {
text-decoration: underline;
color: #660000;
}
a:hover {
text-decoration: none;
color: #CC0000;
}
a:active {
text-decoration: underline;
}
.style4 {
color: #FF0000;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style7 { font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000099;
}
.style11 {color: #FF0000; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
-->
</style>
</head>
<body>
<font size="5" color="Black"> You have passed the "Real Person" Verification.</font>
<blockquote>
<blockquote>
<p align="left" class="style4"><strong><em><font color="black">You can now proceed to share your comments with us... Please click the link below:</font></em></strong></p>
<p align="left" class="style4"><span class="style1"><a href="index.php?page=../../forms/othercommentsinsert">Share Your Comments</a> <br>
</span></p>
<p align="left" class="style7"> </p>
<h3 align="left"> </h3>
</blockquote>
</blockquote>
</body>
</html>
Here is the code for the othercommentsinsert file - which will then call the file to do the insert.
Code: Select all
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Submit Your Comments</title>
<META name=author content="Terry VanDuzee">
<META name=copyright content="Copyright Terry VanDuzee">
<META name=revisit-after content="14 days">
<META name=distribution content="Global">
<meta name=rating content="general">
<meta name=keywords content="INS DHS Bush USA US Canada Government Immigration Immigrate Waiver Visa I-130 I-129F I-601 I-192 US Government Bush Department of Homeland Security US Immigration US Consulate Sign our Petition INS DHS Department of Homeland Security Immigrate Immigrant Visa Waiver I-301 I-129F I-601 I-192 Marriage between countries Wedding Marriage Kept apart Without my wife Couple Unfair Law Love Bible Jesus Prayer God Holy Spirit Drive North Carolina Canada NC Senator David Price Edwards Dole State Department Criminal Record,Pardon Visit the US US Border Patrol Live in the US Automobile sports children child boy girl Our Story Radio Interview Newspaper Article Orange County Hillsborough Raleigh Durham President Email Fax Contact Congressman Vice President Department of Liaison Department of State American Canadian">
<meta name=description content="You can submit your comments about the site or about your outrage to the US Immigration Department or any comment you would like to make regarding our fight.">
<meta name="MSSmartTagsPreventParsing" content="True">
</head>
<body background="BG2.gif">
<basefont face="Arial">
<p> </p>
<p>We are always interested in your thoughts and ideas.<br>
Please comment about any topics covered on this site or/and topics you feel
would benefit this site and people who may be in similar situations as described
on this site.</p>
<p>It is important for us to mention that we are petitioning and fighting to
bring reform to the immigration laws as they pertain to drug offenses.</p>
<p><b><font color="Black" size="3">Other Comments/Suggestions</font></b></p>
<p><font size="3" color="Black">All comments will be displayed on the site, but without names or any identification other than what you supply in the comment itself</font></p>
<form name="strothercomments" method="post" action="insert_com_sug.php">
<table background="../images/New/1pxbg.gif" width="100%">
<tr>
<td>
<textarea rows="7" name="strothercomments" cols="120"></textarea></p>
</td>
</tr>
<tr>
<td>
<p><input type="submit" value="submit" name="submit"></p>
</td>
</tr>
</table>
</form>
<p>Thank you for your Comments and Suggestions</p>
</body>
</html>
Code: Select all
<?php
#$link = mysql_connect($dbhost, $dbuser, $dbpwd) or die("Could not connect : " . mysql_error());
include 'OpenDB.php';
#mysql_select_db($dbname);
## Database Info ##
# id | com_sug
#$SQLString = "INSERT INTO othercomments (com_sug,dte)
# VALUES('" . $_REQUEST['strothercomments'] . "',Now())";
$SQLStringNum = 2;
include 'DBPageInfo.php';
#echo $SQLString . "<br><br><br>";
mysql_query($SQLString) or die("Query failed : " . mysql_error());
# mysql_close($link);
include 'CloseDB.php';
header("Location: index.php");
# mysql_close($link);
?>
Any suggestions?
Thank you
Terry