The Community Forums

Interact with an entire community of cPanel & WHM users.
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

need help writing a php file

Discussion in 'General Discussion' started by ahwatechee, Apr 20, 2005.

  1. ahwatechee

    ahwatechee Registered

    Joined:
    Apr 19, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Phoenix, Arizona
    Hello,

    I'm trying to write a php script that will allow visitors to my site to sign up for a free email account. The following code composes my signup.php file

    <?php
    $ok = TRUE;
    $file = fopen ("http://user: pass@612.32.88.178:2082/frontend/X/mail/doaddpop.html?email=$NewEmail&domain=$domain&password=$Password&qyata=2"a=50", "r");
    if (!$file) {
    $ok = FALSE;
    $target = "error.htm";
    }
    while (!feof ($file)) {
    $line = fgets ($file, 1024);
    if (ereg ("already exists!", $line, $out)) {
    $ok = FALSE;
    $target = "error.htm";
    }
    }
    fclose($file);
    if ($ok) {
    $target = "done.htm";
    $form_fields=array_keys($HTTP_POST_VARS);
    $temp="\n";
    while($field=array_pop($form_fields)){
    $temp.=" $field : = $HTTP_POST_VARS[$field] \n";
    }
    mail($HTTP_POST_VARS['to'],"Free Email",$temp);
    }
    header("location:$target");
    ?>

    but for some reason I'm getting a

    Parse error: parse error, unexpected T_STRING in /home/carbyfam/public_html/signup.php on line 3

    and I cant figure it out. Any help would be greatly appreciated.

    Thank You!!
     
  2. rachweb

    rachweb Well-Known Member

    Joined:
    Jun 26, 2004
    Messages:
    268
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    amsterdam
    Change this on line 3 qyata=2"a=50", "r"); to qyata="2"a="50", "r");
     
  3. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Actually that won't work as its the double quote after the 2 that is causing the problem. Adding another double quote won't resolve the issue.

    You should actually change:

    Code:
    qyata=2"a=50", "r");
    to

    Code:
    qyata=2a=50", "r");
     
  4. ahwatechee

    ahwatechee Registered

    Joined:
    Apr 19, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Phoenix, Arizona
    thanks :)

    thanks for everyone's help, I was able to make the script work. :D
     
  5. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    May I also point out that if you are having problems getting a PHP script to work, you would probably be better off consulting a PHP-dedicated forum if the issue is not specifically related to Cpanel, as was the case here.

    This would be a good idea for two reasons:

    1. A PHP-dedicated forum would probably get you a decent response more quickly. You would expect most people browsing a PHP-dedicated forum to have a fair knowledge of PHP, whereas that might not be the case here.

    2. Its quite possible that if you post a thread in the Cpanel forums not related to Cpanel, your queries would go unanswered.

    There are undoubtedly many PHP-dedicated forums around, however one that I find quite useful from time to time is located at http://www.devshed.com.

    Saying that, it you plan to develop PHP scripts it would be in your own interests to either purchase a decent book on the subject if you are still a beginner, or otherwise read and understand the numerous free tutorials around. I say this as the error message presented by PHP in this case is really quite simple to comprehend once you know the basics and so getting a good understanding of PHP will enable you to troubleshoot and resolve your own issues in no time at all.
     
Loading...

Share This Page