View Full Version : guestbook trouble
novatake
August 22nd, 2005, 05:40 AM
hey ive got a flash guestbook and i have this code in it for making sure all the input fields are full
if (!isset($name) || !isset($email) || !isset($message) || empty($name) || empty($email) || empty($message)) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Input required for all fields.");
exit;
problem is when i fill the input fields it still says there not all full
ive tried just taking it out pecause i dont really need the function anyway but when i post it doesnt put any of the data into the entries section
any ideas
-Tom
Ben Smith
August 22nd, 2005, 06:07 AM
Why are you using urlencode?
novatake
August 22nd, 2005, 06:19 AM
i didnt write it its just sumthing i got off flash kit
Cello
August 22nd, 2005, 06:25 AM
You could try reducing the valildation requirement - I've just tested this and seems to work fine:
if (!isset($name) || !isset($message) || empty($name) || empty($message)) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Input required for name and message fields.");
exit;
}
novatake
August 22nd, 2005, 06:33 AM
here is the full code is there anyway i can comletely take it out so it doesnt try and validate what is inputed
<?
if (!isset($name) || !isset($message) || empty($name) || empty($message)) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Input required for name and message fields.");
exit;
}
$email = strtolower($email);
addentry($name, $email, $message);
function addentry($name, $email, $message) {
$posted = strftime("%D %I:%M %p");
$message = stripslashes($message);
$file = fopen('entry.txt', 'a+');
if (!$file) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
exit;
}
fputs($file, "<font color=\"#000000\">Name:</font> $name\n<font color=\"#000000\">Email:</font> <font color=\"#CCCCCC\"><u><A href=\"mailto:$email\">$email</A></u></font><br>\n<font color=\"#000000\">Posted:</font> $posted\n<font color=\"#000000\">Message:</font> $message\n\n");
fclose($file);
// Send admin an email when new entry occurs
// mailAdmin($name, $email);
}
function mailAdmin($name, $email) {
$mailTo = "Tom Colmer <tom@thepoorkidswithguns.co.uk>";
$mailFrom = "From: Guestbook <noreply@email.com>";
$mailSubject = "New Guestbook Entry";
$mailBody = "$name ($email) has just posted in your guestbook at http://www.thepoorkidswithgunsc.co.uk";
mail($mailTo, $mailSubject, $mailBody, $mailFrom);
}
print "&result=okay";
exit;
?>
Cello
August 22nd, 2005, 07:03 AM
Use this code which should send the data without validating that the fields have any content:
<?
$email = strtolower($email);
addentry($name, $email, $message);
function addentry($name, $email, $message) {
$posted = strftime("%D %I:%M %p");
$message = stripslashes($message);
$file = fopen('entry.txt', 'a+');
if (!$file) {
print "&result=Fail";
print "&errorMsg=" . urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
exit;
}
fputs($file, "<font color=\"#000000\">Name:</font> $name\n<font color=\"#000000\">Email:</font> <font color=\"#CCCCCC\"><u><A href=\"mailto:$email\">$email</A></u></font><br>\n<font color=\"#000000\">Posted:</font> $posted\n<font color=\"#000000\">Message:</font> $message\n\n");
fclose($file);
// Send admin an email when new entry occurs
// mailAdmin($name, $email);
}
function mailAdmin($name, $email) {
$mailTo = "Tom Colmer <tom@thepoorkidswithguns.co.uk>";
$mailFrom = "From: Guestbook <noreply@email.com>";
$mailSubject = "New Guestbook Entry";
$mailBody = "$name ($email) has just posted in your guestbook at http://www.thepoorkidswithgunsc.co.uk";
mail($mailTo, $mailSubject, $mailBody, $mailFrom);
}
print "&result=okay";
exit;
?>
novatake
August 22nd, 2005, 07:14 AM
that just kinda brings it all up in the posts section have a look www.thepoorkidswithguns.co.uk under book
mlk
August 22nd, 2005, 07:50 AM
The guestbook worked. I posted a stupid message. Oops.
novatake
August 22nd, 2005, 03:49 PM
yeh i changed to a xml driven guestbook that i found on kirupa i should never stray from what i know haha thanks for all your help every1
pete_zahut
December 14th, 2005, 07:18 AM
Is there a way to do the guestbook in combo with flash and xml only? So no PHP, because I have only some free webspace... that doesn't support PHP.
Is it possible to do a "save" function with Flash AS?
novatake
December 14th, 2005, 07:27 AM
hey man i ended up not using a php book but i changed to a xml guestbook see on my site http://www.thepoorkidswithguns.co.uk
works a treat must say i can try and find the files again if u want, i cant remember if it was off this site or flash kit im sure it was off here though
pete_zahut
December 14th, 2005, 10:50 AM
Cool site!
So you're not using PHP or ASP?
Just want to know how you save an external file with Flash.
I'll check Flash Kit tonight, thx.
novatake
December 14th, 2005, 04:27 PM
basically mate its a xml file which has been allowed so people can edit it or write in it so u click add message and they put the message in which is technically editing the xml file but as far as they know their just posting a message lol if u want the files ill take them off my ftp let me know it will be tommorrow before i can do it for u though
pete_zahut
December 15th, 2005, 04:03 AM
Yeah I would like to see them, if possible.
Because in an other thread ( http://www.kirupa.com/forum/showthread.php?p=1730893#post1730893 ) they think it's impossible to do it without PHP or ASP...
Thx, Pete
novatake
December 15th, 2005, 05:29 AM
lol ill have a look i might be totally wrong u know ive got a lot of Gbook files on my webspace dunno which is which atm ill have to figure it out
novatake
December 15th, 2005, 05:33 AM
made a error there im afraid i thought it was process.xml but its processxml.php damn it if u need somewhere to host ur php file u can put it in my webspace if u need to that is fine im sorry i totally miss read it, although i am sure u can do it without have a look on flash kit
but again if u need to host it on my space let me know and ill put it up for u and send u the link
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.