I seem to have lost ground since yesterday in that now I'm getting a Warning that's pretty hard to understand. So, unable to get past it, I'm starting there and will go back to my original query when I can get past this one. I would swear I've done nothing to the code since yesterday but ... obviously I did but darned if I can see it!
Following are three PHP sections: form.php which works fine (I think), formcheck.php where I want to show the user their entry information (and shows some notes to myself in the process), plus a text-output from my browser, which is served by my localhost.
form.php:
Xampp 1.7.3 and PHP 5.3.x
This script operates OK; no errors, notices or warnings. It's the next page, formcheck.php that pops up errors, warnings or notices, depending on what I'm trying to do.
These scripts contain none of the other problem codes I'm trying to use; figured I'd first get this one out of the way as the warning makes 0 sense to me. The Warning claim I might be using something from PHP 4.2.3 but I've checked everything and it seems to be available in PHP 5.3 unless I've missed it. The rest of the warning means nothing at all to me.
Whatever I've done to cause that Warning is beyond me; it worked perfectly yesterday.
Three files follow: form.php, formcheck.php, and the text data from the formcheck.php output via localhost which contains the Warning.
form.php:
Xampp 1.7.3 and PHP 5.3.x
This script operates OK; no errors, notices or warnings. It's the next page, formcheck.php that pops up errors, warnings or notices, depending on what I'm trying to do.
These scripts contain none of the other problem codes I'm trying to use; figured I'd first get this one out of the way as the warning makes 0 sense to me. The Warning claim I might be using something from PHP 4.2.3 but I've checked everything and it seems to be available in PHP 5.3 unless I've missed it. The rest of the warning means nothing at all to me.
Whatever I've done to cause that Warning is beyond me; it worked perfectly yesterday.
Three files follow: output.php, formcheck.php, and the text data from the formcheck.php output via localhost.
<?php
session_start();
// prevent page caching in PHP:
header('Cache-Control: no-cache, no-store, must-revalidate'); //HTTP/1.1
header('Expires: Sun, 01 Jul 2011 00:00:00 GMT');
header('Pragma: no-cache'); //HTTP/1.0
echo "<p>Todays date is ".date(" jS F Y ")."</p>";
?>
<!DOCTYPE html>
<head>
<title> Contact Form</title>
</head>
<body>
<html>
<?php
echo "<H1> Webmaster Contact Form </H1>";
$a= mt_rand(-900,999);
$b= mt_rand(-999,999);
$c= mt_rand(-999,999);
$d=($a.$b.$c);
echo "Your Temporary Code is : " . $d;
// put $d into the session so you can check it on subsequent pages
$_SESSION["d"] = $d;
?>
<form action="formcheck.php" method="post">
<p> Enter your <b>Temporary Code </b> here : </b> <input type="text" name="code" size="14 " maxlength="12"> , including dashes. <br />
How many DASHES are there in your <b> Temporary Code? </b> <input type="text" name="dash" size="3" maxlength="5">
<?php
$e = substr_count($d, '-');
$_SESSION["e"] = $e;
echo "<br />"." Number of Dashes is: "." ".$e;
?>
<p> Enter Your Name : <input type="text" name="name" length="20" maxlength="25" value="Robert"> </p>
<?php
$_SESSION["name"] = $name;
?>
<p> Your E-mail Address : <input type="text" name="email" size="30" maxlength="40" value="nobody@spamcop.net"> <br />
<?php
$SESSION["email"] = $email;
?>
<br /><br /> Do you want a Response to your e-mail? <br />
<input type="radio" name="respond" value="Yes" checked="checked" > Yes, please. <br />
<input type="radio" name="respond" value="No"> No, please don't <br />
<input type="radio" name="respond" value=" It does not matter"> It does not matter<br /><br />
<b>COMMENTS:</b> <br />
<textarea name="comments" rows="10" cols="55" wrap="physical"> </textarea> > </p>
<p> <input type="submit" value="NEXT">
<input type= "reset" value="Clear Form" />
</p>
</form>
</body>
</html>
Then formcheck, where I think the problen is:
<?php
$respond = $_POST['respond'];
echo "<br /><br />" . "Wants e-mail Response? " . $respond . "<br /><br />";
$comments=$_POST['comments'];
echo "comments"."<br />";
echo str_replace("/",$_POST['comments'],"");
$comments= stripslashes($_POST['comments']);
echo $comments;
$ip=$_SERVER['REMOTE_ADDR'];
echo "<br /><br />" . "Your ip is: " . $_SERVER['REMOTE_ADDR'] . "<br />";
?>
And finally browser output served from localhost (XAMPP 1.7.3):
formcheck.php
I have removed the mail() function code to concentrate on the present errors.
The intent is to let the user see his input for one last verification before it gets mailed. I plan to simply add the mail() to this page.
Please Continue:
My E-mail: web-master@hcs-classof64.net
Your Entered Name is: Robert
Your stripped name is : Robert
nobody@spamcop.net is valid
Please confirm your e-mail address: [INPUT BOX SHOWN HERE ] <---- Nothing is echoed here.
Wants e-mail Response? Yes
comments
This is the comments textarea. It will echoe to the browserpage.
Your ip is: [B]::1 [/B] <--- localhost <---- Apparently this is what you get when using localhost; uses real IP when tried on remote server.
* [B]Warning[/B]: [B]Unknown[/B]: Your script possibly relies on a session side-effect [B]which existed until PHP 4.2.3.[/B] Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in[B] Unknown on line 0[/B]
Final note: Yes, I know the "value=..." used in form.php isn't for the user to see; it's there for my own benefit right now and to make TSing easier. The only field that has to be filled in to get the form to work is the number of dashes; the others all have values assigned to them.
Many thinks for reading,
Rivet`