Jump to content

Tetenterre

New Members
  • Posts

    2
  • Joined

  • Last visited

About Tetenterre

  • Birthday 04/23/1950

Contact Methods

  • Website URL
    http://binocularsky.com

Profile Information

  • Gender
    Male
  • Location
    Between the New Forest and Cranborne Chase

Tetenterre's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Bingo! Cracked it at last: initialised $-SESSION variables in test.php <?php session_start(); $_SESSION['ishuman']= md5($_POST['human']); $_SESSION['randomnum']= md5($_SESSION['randomnr']); if ($_SESSION['ishuman'] == $_SESSION['randomnum']) { echo (etc) Not sure why I need to do that on the web server, but not on localhost, but hey... Now, how do I mark this as [sOLVED]..?
  2. I am trying to implement a simple CAPTCHA on my web site. It works as I intend on localhost (Apache server on my laptop), but $_POST['human'] appears to reach test.php as an empty string (MD5=d41d8cd98f00b204e9800998ecf8427e) when I upload the same files to my web server. The CAPTCHA image is of a random number; the number is stored as an MD5 string for comparison as $_SESSION['randomnum']. This bit seems to work properly, and test.php picks up this number (and, hence, MD5 string) correctly. The form HTML: <form action="test.php" method="post"> <img src="captcha02.php" align="absmiddle" /> <input type="text" size="20" name="human" /> <input type="submit" name="done" value="I'm human!" /> <br /><br /> </form> test.php: <?php session_start(); if (md5($_POST['human']) == $_SESSION['randomnum']) { echo '<script language="javascript"><!-- location.replace("astunit_course_booking_form.php") //--> </script>'; } else { echo '<script language="javascript"><!-- location.replace("astunit_course_human_test.php") //--> </script>'; } ?> I have used this to try to see what is happening: echo $_POST['human']; echo "<br />"; echo md5($_POST['human']); echo "<br /><br />"; echo $_SESSION['randomnr']; echo "<br />"; echo $_SESSION['randomnum']; randomnr is the number generated for the image: $randomnr = rand(10000, 99999); $_SESSION['randomnum'] = md5($randomnr); Confirms that the form passes human correctly when testing on localhost my laptop, but not when it is uploaded to the web server, where it passes an empty string. Sample output on localhost: 54052 67e3aa6a8dce9aaf1ec9563bbac40582 54052 67e3aa6a8dce9aaf1ec9563bbac40582 Sample output on web server: d41d8cd98f00b204e9800998ecf8427e 46850 1cb9a2cdf84ff27e0ff8aa17644b15e3 Any ideas? (This has flummoxed me for a day and a half! ) I have double-checked that files on the web server are latest versions and are in the correct directories.
  3. Hi All,. Pleased to find this forum; I'm a semi-retired "oldie", trying to learn PHP in order to build and maintain a website or two on the subject of my passion: astronomy.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.