Jul 25, 2008

Php Error When Running Script - Php error when running script

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Php Error When Running Script - Php error when running script

adly3000
Hello,

I get the following error:

Parse error: syntax error, unexpected T_STRING in /usr/local/psa/home/vhosts/club-amigos.co.uk/httpdocs/contact.php on line 44

when l run the following script:
Any help would be appreciated.

CODE

<?php
/* PHP Form Mailer - phpFormMailer v2.1, last updated 30th Nov 2005 - check back often for updates!
(easy to use and more secure than many cgi form mailers) FREE from:
www.TheDemoSite.co.uk
Should work fine on most Unix/Linux platforms */

// ------- three variables you MUST change below -------------------------------------------------------
$valid_ref1="http://adly3000.trap17.com/contact_test.html";// chamge "Your--domain" to your domain
$valid_ref2="http://adly3000.trap17.com/contact_test.html";// chamge "Your--domain" to your domain
$replyemail="EMAIL REMOVED - Send PM to This User Instead";//change to your email address
// ------------------------------------------------------------

//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/\n/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
//NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
return preg_replace($patterns, "", strtolower($value));
}

$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$themessage = clean_input_4email($_POST["themessage"], false);

$error_msg='ERROR - not sent. Try again.';

$success_sent_msg='{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}


// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--\n ";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}

$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$themessage = "name: $name \nQuery: $themessage";
[code]<?php
/* PHP Form Mailer - phpFormMailer v2.1, last updated 30th Nov 2005 - check back often for updates!
(easy to use and more secure than many cgi form mailers) FREE from:
www.TheDemoSite.co.uk
Should work fine on most Unix/Linux platforms */

// ------- three variables you MUST change below -------------------------------------------------------
$valid_ref1="http://www.club-amigos.co.uk/contact_test.html";// chamge "Your--domain" to your domain
$valid_ref2="http://www.club-amigos.co.uk/contact_test.html";// chamge "Your--domain" to your domain
$replyemail="EMAIL REMOVED - Send PM to This User Instead";//change to your email address
// ------------------------------------------------------------

//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
$patterns[0] = '/content-type:/';
$patterns[1] = '/to:/';
$patterns[2] = '/cc:/';
$patterns[3] = '/bcc:/';
if ($check_all_patterns)
{
$patterns[4] = '/\r/';
$patterns[5] = '/\n/';
$patterns[6] = '/%0a/';
$patterns[7] = '/%0d/';
}
//NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
return preg_replace($patterns, "", strtolower($value));
}

$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$themessage = clean_input_4email($_POST["themessage"], false);

$error_msg='ERROR - not sent. Try again.';

$success_sent_msg='{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}


// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
echo "<script language=\"JavaScript\"><!--\n ";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}

$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
exit;
}
$themessage = "name: $name \nQuery: $themessage";
mail("$replyemail",
"$thesubject",
"$themessage",
"From: $email\nReply-To: $email");
mail("$email",
"Receipt: $thesubject",
"$replymessage",
"From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
/*
PHP Form Mailer - phpFormMailer (easy to use and more secure than many cgi form mailers)
FREE from:

www.TheDemoSite.co.uk */
?>

 

 

 


Reply

jlhaslip
This might not be the solution, but I noticed that the following post array element uses only single quotes while the ones above this line (which didn't error) use double quotes to contain the array element name. And the ones below it also use double quotes, too, so maybe I'm on to something here.

Try changing this code to double quotes.
CODE
if (!isset($_POST['email']))

I am just learning php, so I might be wrong on this. Post back if this doesn't work and you still need a hand.

Reply

Spectre
It makes no difference whether you use double or single quotes when referencing indexes in an array. In fact, unless you absolutely have to, I would recommend using single quotes wherever possible (and not just when working with arrays, but in all aspects of PHP), as it's processed faster.

Anyway, as with most errors in PHP, the actual problem is not on the mentioned line, but prior to that. Take a look at lines 38 to 40:
CODE
$success_sent_msg='{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}


I think you'll find therein lies your error (note the opening quote, but lack of a closing one - I'm also not sure why the squigly braces have been added). I took a quick look at the original script, and the equivalent code was:

CODE
$success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
   <p align="center"><strong>Your message has been successfully sent to us<br>
   </strong> and we will reply as soon as possible.</p>
   <p align="center">A copy of your query has been sent to you.</p>
   <p align="center">Thank you for contacting us.</p>';


Hope that helps.

 

 

 


Reply

adly3000
thanks all.that is helping me to the right way thanks.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php, error, running, script, php, error, running, script

  1. Wordpress Error - Bytes Exausted
    NextGEN Gallery (4)
  2. Php Guest Online Script
    (2)
    make an index.php copy and paste this code CODE <?php $db_host = "localhost";
    $db_user = "root"; $db_pass = ""; $db_name = "test";
    $dbc = mysql_connect($db_host, $db_user, $db_pass); $dbs =
    mysql_select_db($db_name); $tm = time(); $timeout = $tm -
    (30*60);
    if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR
    "];} else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}....
  3. Help Me _ Error Message: "could Not Retrieve Session Record"
    IPB-Forum error message (2)
    Hi ... Please I need help quickly ... I am an administrator of a "IPB-Invision Power Board Forum"
    and I cannot login in the ACP (Admin Control Panel) anymore. When I write the user name and password
    both are accepted and the login is successfull but then suddenly I get an error message that says:
    Could not retrieve session record What can I do to solve the problem ? Please help me
    !!!!!....
  4. Phpbb3 - Error 28
    (5)
    I get the following error when I try changing a users group of my Phpbb3 powered forums. QUOTE
    SQL ERROR Got error 28 from storage engine SQL SELECT ug.*, g.* FROM groups g, user_group ug
    WHERE ug.user_id = 83 AND g.group_id = ug.group_id ORDER BY g.group_type DESC, ug.user_pending ASC,
    g.group_name BACKTRACE FILE: includes/db/mysql.php LINE: 158 CALL: dbal->sql_error() FILE:
    includes/acp/acp_users.php LINE: 1881 CALL: dbal_mysql->sql_query() FILE:
    includes/functions_module.php LINE: 471 CALL: acp_users->main() FILE: adm/index.php LINE: 74 CALL:
    p_master->l....
  5. Phpizabi Social Network Script
    (1)
    Hello everyone not been on for AGES! we had net problems and i had to move to qupis and now
    I've got problems. I'm making a social networking site using this script and I cant get it
    to install Everytime I go to the install page i get this QUOTE Warning: session_start() :
    open_basedir restriction in effect. File(/home/kasiks1/tmp) is not within the allowed path(s):
    (/home/karlos:/usr/lib/php:/usr/local/lib/php:/tmp) in
    /home/karlos/public_html/phpazi/install/index.php on line 1 Fatal error: session_start() : Failed
    to initialize storage module: file....
  6. How To Make A View New Post Script?
    (5)
    Ok so i'm still working on the forum software i posted about a while back, but I have no idea
    how to do this. I want to make a view new post script, as this is one of the main things that my
    forum software dose not have that all other forums have. so does any body have an idea on how i
    would do this? Thanks.....
  7. Error 28 (on Phpmyadmin)
    What does this error message mean? (6)
    I have a shopping cart system on my website. It always worked before, but all of a sudden, when I
    try to access it i get "Got error 28 from storage engine". Has that got something to do with the
    recent problems again, or can someone tell me what this error message means? Thanks. After posting
    this I noticed I cannot get into my PHPAdmin anymore. It gives loads of errors: QUOTE Warning:
    session_write_close() : SQLite: session write query failed: database is full in
    /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 42 Warning: session_write_close() :
    Fai....
  8. Page Load Error When Accessing Cpanel
    (0)
    Not sure what the issue is. I cannot even load up any of the cpanel's to allow me to put in a
    password. I have tried the link that is located in the Credit System 2.0 I have tried the links
    with subdomain/cpanel I have tried the links with subdomain:2082 All 3 of these just give page
    load errors. Please note : This isn't a "my password doesn't work" thread. This is a "I
    can't even get cpanel to TRY to load" thread. Thanks in advance.....
  9. Coppermine Gallery Error
    (2)
    Okay.. so i have my gallery set up at photos.chantellepaige.org and everytime i try to access it i
    get this error "Coppermine critical error: Unable to connect to database ! MySQL said: Access
    denied for user 'giselle_copp1'@'localhost' (using password: YES)" how do i change
    the password etc?? or fix the problem??....
  10. Cannot Open Display - Error
    (2)
    I basically have some problems in accessing xWindow applications(SAS and nedit in particular) in the
    server. i get "Cannot open display" when i try to access nedit and other applications. I did some
    findings on this and thought this might be of some help to you. But I was not able to zero in on
    the problem yet. The problem I guess, is the remote not able to enable the display to the server.
    The display settings has to be set properly in the remote machine. Commands I tried
    setenv DISPLAY xhost + DISPLAY=gl5705rk02:10.0 ....
  11. Error
    I REALLY NEED HELP! (0)
    Well .. I got a problem.. I got an error in the compiler.. Do you know where i can get JDK 5.0? ....
  12. Need Help Installing Dolphin Community Script!
    (5)
    I'm not sure if this is the right place to post this but I really need help in installing the
    dolphin community script. I have absolutely no previous experience of scripts or programming. I
    would really appreciate if someone could walk me through it step-by-step, or even do it for me by
    logging into my cpanel. I have tried to install it my self but I'm a little confused. I'm
    sure it won't take very long at all for someone who has done this before.....
  13. Running, Jogging, Training
    How much to do so you don't overdo it. (38)
    Does anyone know just how much someone should run, Jog, Or do personal training to keep fit WITHOUT
    over doing it. I see older people jogging through the street and i sometimes look at them and
    think god they should not be doing that at there age as they look tired out and that they should not
    be running so much to try keep fit ? I might be wrong this is why i started this post as someone
    might know more about it. Im only young (25) and play 11-aside football on a saturday and 5-aside
    football on a Thursday. I do go running through the week prob about twice a week on....
  14. Loaing Script
    (3)
    hello, I'm looking for a preloader script for my site. like it will display an loading
    image while the site is loading and the once the page has loaded the image will disapear. i tryed
    searching for one on google but i could not find one, i think i searched for the worng thing. if
    some one knows how to make one or where i can find one that would be great. Thanks....
  15. Error E74? (xbox 360)
    (7)
    Okay so me and my friend were playing guitar hero and all of a sudden the screen got all block like
    and the graphics all turned into green swirly squares. So we thought maybe the A/v cord was loose or
    something i turned off the xbox and re-plugged the a/v cords in now every time i turn the xbox on it
    flashes 1 red light and says Error E74 in about every language i know of... I have called
    1-800-4myxbox and all they said is that they only fix xbox's with the 3 red light error.... what
    do i do? thanks.....
  16. Invite Script..
    (2)
    I didn't know where else to put it /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" /> If moderators find another forum more suitable plz move this one
    /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> I am looking
    for some sort of sript or program that let's people on your website invite friends. Like they
    put in their Emailadress and mails are send to everyone in their list.. I hope someone can help me
    /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Greetzz....
  17. Background Image Swap Script
    Change a Background Image based on clock time (15)
    Background Image Changer Script To swap the background image from your CSS file according to the
    Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
        background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
    folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
    create an index.php file and copy/paste the following script. CODE <?php $hour =
    date('H'); if ($hour < 12 ) {     $image =
    "morning.png"; } ....
  18. Html Code Tester. Online Script
    (15)
    Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
    this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
    Current script: CODE <?php //Save this as something like htmltest.php function
    CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
    input $html_safe=str_replace("<?php"," ",$html_unsafe);
    //Starts security measures $html_safe=str_replace("?>","
    ",$html_sa....
  19. Psp Error- Tut On How To Fix
    When you try to use the internet does your psp get an internal error? (28)
    First of all, psp can browse the internet with its simple browser. BUT! What you may not know
    is that there is a bug where when you try to search or use a wireless lan connection (WLAN) the psp
    may say something like: Internal Error (80410A0B) To fix this without any memory loss, take out
    the UMD which is in the psp, and also take out the memory card. Next, go to settings, then system
    settings and click restore settings, the psp may freeze up, but it is not broken, take out the
    batter pack and put it back in, the settings should be restored and all should work.....
  20. Running Bios Setup On A Dell Inspiron 8000 Laptop
    How do you do it? Dell wants money to tell me (8)
    My aunt gave me her old laptop, and I want to reinstall Windows on it. For sarters, the DVD-ROM
    drive is not first in the boot order. So I need to open the BIOS Setup program to change it. I tried
    pressing about half a dozen key combos, and couldn't get it to run. I called Dell, and they gave
    me some garbage, saying that I would have to pay to get help. So I come here, to ask you, how does
    one open the BIOS Setup program on a Dell Inspiron 8000 laptop?....
  21. Watermark Your Image With Simple Php Script
    found it on the net (34)
    This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
    Scripts site. Just in case the site may not show, I will include the code here: List of things
    needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
    script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
    image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
    transparent gif image with the watermark - goes in the same directory as this script // ....
  22. Gmail: 502 Server Error
    GMail: 502 Server Error (20)
    Hey The topic name says it all. Well I have been trying for the last half an hour to log into my
    GMail account, but it kept on occuring a Server 502 error. Just wondering if it is just me
    or....yeah. QUOTE Server Error The server encountered a temporary error and could not complete
    your request. Please try again in 30 seconds. Yep I have tried every minute..for the last half
    an hour...(The Time now is 12.13pm Australian Eastern Standard Time) ....
  23. New System Shuts Down After Running About 1 Minute
    new ecs extreme (13)
    I have a new ecs extreme motherboard with an apthlon 939 3000+ processor, with 512mb ram a new power
    supply and new hardrrive. I have a 128m AGP video card from a good machine. All of the itemes I am
    using have either come from a running system or have been tested in a working computer. My computer
    will turn on and I can get to cmos setup or to boot from cd, however, after about 1-2 minutes the
    system just shuts down.....
  24. Operating System Not Found
    Error Displayed On Start Up (13)
    So I've been having some difficulties with my Laptop computer. Not the least significant of
    them was this problem of not being able to find the O/S. What to do about it? How does the
    computer not find the Operating System? I know that it is in there someplace, I had just
    re-installed it, but the BIOS was not able to locate it. On the phone to the Manufacturer's
    Help Centre. Explain the problem. Real nice guy. Had the answer right handy. Send me an email right
    away. Good thing I had another machine available,huh? On startup, the powering on of the machine
    tri....
  25. Error Installing Windows Xp -error 7 Ntkrnlmp.exe
    (10)
    i have tried to install windows xp on my pc and i get an error right after it ask at the bottom of
    the screen to press f2 to restore an error pops up saying FILE
    \$win_nt$.~bt\NTKRNLMP.EXE cannot be open error 7 setup cannot complete and has
    to close i have had windows xp on the pc before so i know its compatible but i used a different
    version of windows before ,this tinme im using a new one and i get this error i seem to find no
    solution anywhere about how to resolve this and I was wondering if possible theres something i need
    to do,I am not to sm....
  26. Running Midp Applications
    (3)
    I've downloaded Java Wireless Toolkit 2.2 and it has an emulator to run Java midlets without
    creating a new project... But I couldn't get it to work when I open a *.jar file with it...
    However, it could work when I run via from a project source... Is it suppose to work this way? How
    can I make the emulator to run the *.jar file directly? Assuming the *.jar & *.jad files are on the
    desktop.......
  27. Free Weather Feed Script
    (1)
    If you are tired of providing your clients with weather feeds that take visitors off of their site
    or slam their site with ads, I finally found one after searching for hours. Here's a link to a
    FREE php script that pulls the feed directly from any airport in the world to your site. It is easy
    to customize and has simple, well documented installation instructions.
    http://www.mattsscripts.co.uk/mweather.htm hope you find it helpful... a good one for designers
    to archive as you will most likely need it some day for a client. Check out Matt's other free
    scripts....
  28. Error Not A Valid Win32 Application
    (10)
    I get this error message when I try to open some files for example
    C:\Downloads\Games\James_Bond_007 is not a valid win32 application or some other
    files the error message is always "is not a valid win32 application" What can I do to open these
    files so that the error message does not come up? How can I open this kind of file? I am using
    Windows Me Pentium 4 1.3 Gigs 256 dram....
  29. Php Quiz Script
    Make quizzes for your site. (20)
    Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
    doesnt do anything special but I am going to make an email mod for it so that it will email results
    to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
    editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
    <html> <head> <title><? echo "Gamers Pub $qid";
    ?></title> </head> <body> <p><h3><? echo "....
  30. Could Someone Make A Php Script For Me?
    Script to manage clans and players (3)
    Does someone know a script where you can 1. Add clans to a roster 2. Edit clans on a roster 3. Add
    players too a clan 4. Edit players 5. Schedule matches 6. Add clan Leaders to manage their own clan
    + members 7. Add members to edit their own information And maybe some sort of scoreboard integrated
    where you can put Wins, Draws and loses and that automaticly puts best clans on the top? If there
    isnt such a script could someone create 1 for me? (its for a league ^^)....

    1. Looking for php, error, running, script, php, error, running, script

Searching Video's for php, error, running, script, php, error, running, script
advertisement



Php Error When Running Script - Php error when running script



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE