PHP Classes

Couldn't make it work

Recommend this page to a friend!

      AntiSpam Feedback  >  All threads  >  Couldn't make it work  >  (Un) Subscribe thread alerts  
Subject:Couldn't make it work
Summary:Doesn't seem to do anything
Messages:4
Author:Bob Squires
Date:2007-01-28 13:12:19
Update:2007-02-22 07:51:34
 

  1. Couldn't make it work   Reply   Report abuse  
Picture of Bob Squires Bob Squires - 2007-01-28 13:12:19
I think this class would make a very useful addition to our newsletter sign-up procedure but I can't make it work the way I think it is intended to (I don't get any confirmation code showing anywhere). Please can you tell me whether it will work on PHP v4 and, if so, give me additional instructions on how to set it up (with example code if possible? Thank you.

(I am almost a beginner on php)

Bob

  2. Re: Couldn't make it work   Reply   Report abuse  
Picture of Dmitry Sheiko Dmitry Sheiko - 2007-01-29 07:23:12 - In reply to message 1 from Bob Squires
If you haven't confirmation graphical code, you haven't GD Lib PHP extension.

You should:
1) Add GD Lib extension to you PHP configuration (change php.ini and restart HTTP-server)
2) Turn off graphical code confirmator -
delete following lines in the asf_controller.php
if(md5($_POST["gencode"])!==$_SESSION["Md5OfGenCode"]) $this->respond("Incorrect confirmation code");
unset($_POST["gencode"]);

And following lines in the feedback.html

Enter confirmation code<br />
<center style="padding: 5px;"><img src="asf_gencode.php" /></center>
<input name="gencode" type="text" />

  3. Re: Couldn't make it work   Reply   Report abuse  
Picture of Jan Gorba Jan Gorba - 2007-02-22 06:10:08 - In reply to message 2 from Dmitry Sheiko
Hi there,
Same here. Couldn't get it to work. Even if I follow your hint to delete some lines in those two files, I actually get different other messages (e.g. Invalid POST) as well, but no success. I reckon this is correct, because of these lines of code:

asf_controller.php:

if(!isset($_POST["email"])) $this->respond("Invalid POST");
if(!isset($_POST["gencode"])) $this->respond("Invalid POST");
session_start();
$this->MessageID = time();
$this->MessageBODY = $this->getMessageBody();
$this->deleteExpiredMessages();

and:

function getMessageBody() {

/* used only if GDLib extension support in PHP */
//if(md5($_POST["gencode"])!==$_SESSION["Md5OfGenCode"]) $this->respond("Incorrect confirmation code");
//unset($_POST["gencode"]);
/* used only if GDLib extension support in PHP */

$text = "<table border=\"0\" width=\"100%\">";
foreach($_POST as $key => $val) {
$val = nl2br(htmlspecialchars(stripslashes($val)));
$text .= "<tr><td valign=\"top\">{$key}</td><td width=\"100%\">{$val}</td></tr>";
}
$text .= "</table>";
return $text;
}

How can I get it to work then?

Cheers
Jan

  4. Re: Couldn't make it work   Reply   Report abuse  
Picture of Dmitry Sheiko Dmitry Sheiko - 2007-02-22 07:51:34 - In reply to message 3 from Jan Gorba
Sure, if you have removed the lines:

<center style="padding: 5px;"><img src="asf_gencode.php" /></center>
<input name="gencode" type="text" />

the line

if(!isset($_POST["gencode"])) $this->respond("Invalid POST");

will finish the script with the error code "Invalid POST"

So, delete line

if(!isset($_POST["gencode"])) $this->respond("Invalid POST");