Killersites.com Homepage Welcome Guest   |   Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 11
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1312 times and has 10 replies Next Thread
Male aviaf
Stranger




Joined: Jul 18, 2008
Post Count: 12
Status: Offline
Reply to this Post  Reply with Quote 
Fixinf form and php server script

Ok, so I have a form for contact us at:
www.corradocomputers.com/feedback.html
and its fine but i used a site's wizard to create it and the php sever side script. Now I want to create another form on the error page, see it by going to:

www.corradocomputers.com/ with any text after the forward slash

but i dont know what to do in the new php script for it. I tried to go through the one that I have and change it to fit my needs but I get:

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' in /homepages/42/d251459630/htdocs/notfound.php on line 55.

Here is my coding:

PHP coding under filename: 'notfound.php' :

<?php
/*


*/

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "youremailaddress@example.com";

$mailto = 'corrado.cioci@gmail.com';

// $subject - set to the Subject line of the email, eg
//$subject = "Broken Link Form";

$subject = "Broken Link Form";

// the pages to be displayed, eg
//$formurl = "http://www.example.com/error404.html";
//$errorurl = "http://www.example.com/error.html";
//$thankyouurl = "http://www.example.com/thankyou.html";

$formurl = "http://www.corradocomputers.com/error404.html";
$errorurl = "http://www.corradocomputers.com/error.html";
$thankyouurl = "http://www.corradocomputers.com/thankyou_broken_link.html";

$uself = 0;
$broken_link_url_is_required = 1;
$name_is_required = 1;
$use_utf8 = 1;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n";
$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"';
$name = $_POST['name'];
$broken_link_url = $_POST['brokenlink'];
$comments = $_POST['comments'];
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['brokenlink'])) {
header( "Location: $formurl" );
exit;
}
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name))) {
header( "Location: $errorurl" );
exit;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit;
}
if (empty($broken_link_url)) { ************************************************************ This is line 55
$broken_link_url = $mailto;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Broken Link/URL: $broken_link_url\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n";

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$broken_link_url>" . $headersep . "Reply-To: \"$name\" <$broken_link_url>" . $headersep . "X-Mailer: chfeedback.php 2.11.0" .
$headersep . 'MIME-Version: 1.0' . $headersep . $content_type );
header( "Location: $thankyouurl" );
exit;

?>

**********
**********
**********

Html scripting in: 'error404.html' :

<form action="notfound.php" method="post">
<p class="style10">The page you are looking for is not available.</p>
<p class="style10">Please help us correct this problem by filling out the form below:</p>
<table border="0" align="center" cellpadding="8" cellspacing="8" summary="brokenlink form">
<tr>
<td width="132">Name:</td>
<td width="401"><input type="text" name="name" size="65" /></td>
</tr>
<tr>
<td>Current URL:</td>
<td><input type="text" name="brokenlink" size="65" /></td>
</tr>
<tr>
<td colspan="2"> Comments (How did you get here?):<br />
<br />
<textarea rows="5" cols="69" name="comments"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" value="Send Feedback" />
<br />
</td>
</tr>
</table>
</form>


You can view it at
www.corradocomputers.com/ with any text after the forward slash
----------------------------------------
[Edit 5 times, last edit by aviaf at Aug 20, 2008 8:46:41 PM]
[Aug 20, 2008 8:08:04 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

Can you point out which line in the code sample above is line 55? It would make looking for the problem much easier.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Aug 20, 2008 8:10:10 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aviaf
Stranger




Joined: Jul 18, 2008
Post Count: 12
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

oops, ok done
[Aug 20, 2008 8:46:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

Try this... instead of this line:

if (empty($broken_link_url)) {

use this:

if ($broken_link_url == "") {

Looks like the "empty" function you are calling can't be used with strings, only with variables, which is why you are getting the error.

http://us2.php.net/empty

Try that code, and post again if it doesn't fix your problem.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Aug 20, 2008 9:27:31 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aviaf
Stranger




Joined: Jul 18, 2008
Post Count: 12
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

ok changed it, now no error appears, the page seems to submit but instead of going to the thank you page, it then goes to **/error404.html and no email is received
[Aug 20, 2008 9:58:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

The easiest way to debug this is probably to add echo statements into your PHP script, and see where any issues might be occurring.

One other thing to note... if you are testing the script on your local machine (not on your hosting server) you most likely won't receive emails. In that case, test this script on your server.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Aug 20, 2008 10:08:38 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aviaf
Stranger




Joined: Jul 18, 2008
Post Count: 12
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

ok, i dont know what u mean by adding echo statements and what would that do exactly as in how do i use it

also, everytime i change the script i update it on the server and test it there

edit at 12:08 EST: goin to bed, talk to u tomorrow, thx for the help so far, again
----------------------------------------
[Edit 3 times, last edit by aviaf at Aug 20, 2008 11:08:45 PM]
[Aug 20, 2008 10:12:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

I just tested this out... The form seems to work fine for me, and redirects correctly to the thank you page.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Aug 21, 2008 5:38:11 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aviaf
Stranger




Joined: Jul 18, 2008
Post Count: 12
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

i tried it and it still doesnt redirect me properly and i didnt receive any message from when you tested it either
[Aug 21, 2008 10:40:28 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male falkencreative
Advanced Member
Member's Avatar

USA
Joined: Aug 14, 2007
Post Count: 1129
Status: Offline
Reply to this Post  Reply with Quote 
Re: Fixinf form and php server script

i tried it and it still doesnt redirect me properly and i didnt receive any message from when you tested it either


That's because I changed the script so it pointed to my email address. I received the email just fine.

Have you made sure that the redirect links that you are using actually exist and point to the proper files? Secondly, have you tried to use a different email address in your script? Perhaps the period in the middle of your email address is throwing things off?

Otherwise... I'm out of ideas. As I said, the script worked fine for me.
----------------------------------------
Benjamin Falk | student : designer : developer
Twitter: falkencreative
[Aug 21, 2008 11:10:02 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread