Forum Moderators: coopster

Message Too Old, No Replies

Need a PHP script or program or ideas

How can we make a program that will remind users to answer a question?

         

SEO practioner

1:00 pm on Jul 2, 2003 (gmt 0)

10+ Year Member



Hope anybody can help us here.

We are developing an interactive site where users need to come back and answer a simple yes or no question. They have to do it every 24 hours to make certain that their user and corporate data hasn't changed, as it is likely to change everyday.

All the program needs to do is send a simple email reminder where our users will login into the system and simply answer that yes or no question by simply clicking the appropriate box.

Where can we find or how can we build such a PHP script or program?

I know it can be done, I just dont't know how to do it.
Thanks for any help in advance.

vincevincevince

2:20 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Assuming a (connected) database, with a table list, containing a list of `email` and `name`, then just run this script to email them all.


$youradd = "SEO@practicioner.com";
$yourname = "SEO practicioner";
$subject = "A wee reminder...";
$message = "Dear Sir/Madam, please come to our site and answer that question... Luv ya";

$dh = mysql_query("SELECT email,name FROM list WHERE 1;");
while($r=mysql_fetch_row($dh))
{
$theirname = $r[0];
$theiradd = $r[1];
$headers =
"MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: $yourname <$youradd>\r\nTo: $theirname <$theiradd>\r\nReply-To: $yourname <$youradd>\r\nX-Priority: 1\r\nX-MSMail-Priority: High\r\n X-Mailer: VinceVinceVince's Amazing Code";
mail($theiradd, $subject, $message, $headers);
}

If it were me - I'd be tempted to give them two links in the email, one for yes, one for no - then they'll just need to click the link and once it says confirmed, they can just close the box (faster, easier).

And it wouldn't be hard to record who has answered the question in the last 24 hours - so you only email those who haven't remembered!

Get back to me if you have more questions :-) (This should be run as a cron job in eg perl really - but using cron or the windows task scheduler to launch the php page etc would be as good).

SEO practioner

2:48 pm on Jul 2, 2003 (gmt 0)

10+ Year Member



Hello vince

Thanks for the fast response!

Well here's what we want to do. We are trying to have as less intervention as possible from the admins of the application (the owners).

Ideally, the solution needs to automatically email all users that have transactions in progress (about 80% of them- this is a B2B application for a large vertical market).

Your idea of a yes-no click makes sense. I have to see with my PHP developer how we can achieve this. Any additional help or input from you or anybody else will be greatly appreciated.

The best thing I think is for the application to automatically send the emails, as the users will expect them like clock work anyway.

Thanks

SEO

lorax

3:15 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Why not have them simply reply to your email with a yes/no in the subject and use a script to parse it and enter the results?

SEO practioner

4:19 pm on Jul 2, 2003 (gmt 0)

10+ Year Member



Lorax: the application will send the email automatically. Our client prefers to have as less human intervention as possible.

We are trying to make it as automated and "intelligent" and free-standing as possible.

Thanks

vincevincevince

7:56 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I really advise you to write a perl script and call it using cron.

However, if you want this to be installed a) by the user, or b) on 3rd party hosting without shell access, then the php script could be an alternative

i am however unaware of any function to run a php script at a given point in time - however I overcame a similar problem by using cron on a `desktop` linux box to launch a perl script which just opens the php script url remotely and discards the result - this is seamless, however not for everyone. i've seen similar results using windows task scheduler to call a webpage that contains the script to be run in a frame - thus invoking the script on a regular schedule.

there may be a great way to schedule the running of php scripts without cron - i just don't know it.

lorax

8:16 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



>> Our client prefers to have as less human intervention as possible.

Put the question in the email to them with the instructions to reply if the answer is yes or ignore the email if the answer is no. If they reply, you know the answer is yes. They don't need to do anything other than hit "Reply" and send it. How much easier do you need it to be?

SEO practioner

10:14 pm on Jul 2, 2003 (gmt 0)

10+ Year Member



Thanks Lorax- I am having a meeting tomorrow with the people concerned, I will know more then.

Vince, what is cron? This is the first time I read or hear about it. Is it some sort of timer or something? What is it and where can I find / learn more about it?

thanks

jatar_k

10:18 pm on Jul 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



www.unixgeeks.org/security/newbie/unix/cron-1.html

or various searches for "cron" or "crontab"