PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 307,168 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,564 people online right now. Registration is fast and FREE... Join Now!




SCForm PHP

 

SCForm PHP, email script gone bad?

GorillaCheif

10 Dec, 2007 - 10:26 AM
Post #1

D.I.C Head
**

Joined: 23 Apr, 2006
Posts: 62


My Contributions
Ok, I'm trying this new email PHP script out. Although I'm pretty new to PHP, it looks easy enough, but I have to admit, I'm not exactly sure what I'm supposed to be looking for. I'm getting the following errors:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www/vhosts/***.com/httpdocs/php/contactus.php on line 116

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/vhosts/***.com/httpdocs/php/contactus.php on line 116



Line 116 is pointed out below
Could it be the server can't handle PHP? I've ran into that issue before. What am I missing?


CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
    font: 100% Verdana, Arial, Helvetica, sans-serif;
    background: #FFFFFF;
    margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    padding: 0;
    text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    color: #000000;
}
.oneColFixCtr #container {
    width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
    background: #FFFFFF;
    margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    border: 1px solid #000000;
    text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtr #mainContent {
    padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.style3 { font-family:Veranda,Arial, Helvetica, sanserif; font-size: 9pt; color:333333;}
-->
</style></head>

<body class="oneColFixCtr">

<div id="container">
  <div id="mainContent"><?php
    // Web form spammers frequently either leave HTTP_REFERER empty, set it
    // equal to the form's own URL, or make something up out of thin air.
    // We don't do this "is it our own server" if it's blank, as the "is it
    // blank" check will get that one
    $selfChkStr = $_SERVER['PHP_SELF'];
    $serverChkStr = "http://" . $_SERVER['SERVER_NAME'];
    if(($chkFormRefNotBlank && !$_SERVER['HTTP_REFERER']) ||
       ($chkFormRefNotSelf && preg_match("#$selfChkStr$#i", $_SERVER['HTTP_REFERER'])) ||
       ($chkFormRefOwnServer && $_SERVER['HTTP_REFERER'] &&
        !preg_match("#^$serverChkStr#i", $_SERVER['HTTP_REFERER'])))
    {
    // Almost certainly web form spammers - let 'em wait for it;)
    sleep(10);
    // Crude, very crude (gracefully "terminate" the page early)
    print("<div align=\"center\"><font color=\"red\">Disallowed HTTP Referer! ("" .
        $_SERVER['HTTP_REFERER'] .
        "")</font></div>");
    print("</body></html>");
    exit;
    }

    if($requireVerify)
    print("<div align=\"center\"><font color=\"red\">Cookies must be enabled to use this form.</font></div><p />");
?>
<div align="center" width="700"><table><tr><td width="47"><table>
  <tr>
    <td align="right"><span class="style3"> Send To: </span></td>
    <td align="left">
    
    <?php
            // Get a pseudo-random alpha-numeric string (no zeros and O's)
            function pseudo_random_string($length) {
                $string = "";
                while($length--) {
                for($indx = rand(49, 90);
                    ($indx > 57 && $indx < 65) || $indx == 79;
                    $indx = rand(49, 90))
                   ;
                $string .= chr($indx);
                }

                return($string);
            }

            // Read a line from a config file, stripping comments
            // and blank lines
            function read_file_line($fp) {
                while(($inString = fgets($fp, 2048)) != false) {
                $inString = rtrim(preg_replace('/\s*#.*/', '',
                    $inString));
                if(!empty($inString))
                    break;
                }

                return $inString;
            }

            if(!$HTTP_SESSION_VARS['majik_string'])
                $HTTP_SESSION_VARS['majik_string'] = pseudo_random_string(5);

            // Read the contact list keys and descriptions into hash
            if(($fp = fopen($recipientFile, "r")) == false) {
                 die("Can't open data file '$recipientFile'.\n");
            }
            while($inString = read_file_line($fp)) {
                list($key, $description, $value) =
                explode(':', $inString);
                $options[$key] = $description;
            }
            fclose($fp);

            // If we've more than one choice: present a menu
            if(count($options) > 1) {
                // If we were given a single arg, that'll be the
                // selected menu item.
                if(count($_GET) == 1)
                $selected = strtolower(key($_GET));
                print("<select name=\"whoto\">\n");
                foreach($options as $key => $description) {
                print("<option ");
                if(strtolower($key) == $selected)
                    print("selected ");
    Line 116 ------>    print("value=\"" . trim($key) .  \">" .
                       trim($description) . "\n");
                }
                print("</select>\n");
            } else {
                // There'll be only one...
                foreach($options as $key => $description) {
                print("<input type=\"hidden\" name=\"whoto\" value=\"" .
                       trim($key) . "\">" . trim($description) . "\n");
                }
            }

            // Used by the form processor acknowledgment to create a
            // "take me back" link.
            if(!empty($_SERVER['HTTP_REFERER'])) {
                print("<input type=\"hidden\" name=\"orig_referer\" value=\"" .
                   $_SERVER['HTTP_REFERER'] . "\">\n");
            }
            ?>
    </td>
  </tr>
  <tr>
    <td align="right"><span class="style3"> Your name: </span></td>
    <td align="left"><input type="text" name="name" size="30" />
    </td>
  </tr>
  <tr>
    <td align="right" class="style3"> Email address: </td>
    <td align="left"><input type="text" name="email" size="30" />
    </td>
  </tr>
  <tr>
    <td align="right" class="style3"> Subject: </td>
    <td align="left"><input type="text" name="subject" size="30" />
    </td>
  </tr>
  <?php
        // Are we requiring CAPTCHA-style "is a human" verification?
        if($requireVerify) {
        print <<<End_Of_Data
            <tr><td> </td></tr>
            <tr>
            <td colspan="2">
                Please enter the verification string on the right into the box on the left.
            </td>
            </tr>
            <tr>
            <td align="right">
                Verification:
            </td>
            <td align="left">
                <input type="text" name="verify" size=10>
                <img src="scfgenimg.php" width="60" height="20" align="top" alt="Verification string image"/>
            </td>
            </tr>
End_Of_Data;
        }
    ?>
</table></td>
      <td width="423"><form action="scformproc.php" method="post">
        <p class="style3"> <span class="style3">Please enter your comments below.  Click "Submit" when done. </span><br />
            <textarea name="comments" rows=10 cols=50></textarea>
        </p>
        <p>
          <input type="submit" name="s" value="Send" size="20" />
        </p>
      </form></td>
</tr></table>
</div>
</body>
</html>

    
    </th>
  </tr>
    <!-- end #mainContent --></div>
<!-- end #container --></div>
</body>
</html>


User is offlineProfile CardPM
+Quote Post


Posts in this topic
GorillaCheif   SCForm PHP   10 Dec, 2007 - 10:26 AM
GorillaCheif   ok, I got one issue figured out..I think. The issu...   10 Dec, 2007 - 10:51 AM
DilutedImage   Not complicated at all. You need a double-quote b...   10 Dec, 2007 - 01:41 PM
GorillaCheif   Not complicated at all. You need a double-quote ...   14 Dec, 2007 - 08:13 AM
no2pencil   Not complicated at all. You need a double-quote...   14 Dec, 2007 - 08:17 AM
GorillaCheif   Just as in C/C++, in PHP the back-slack is consi...   14 Dec, 2007 - 08:51 AM
DilutedImage   [quote name='DilutedImage' post='287971' date='10...   14 Dec, 2007 - 12:15 PM
snoj   The last one on that line.   14 Dec, 2007 - 08:58 AM
GorillaCheif   "Are you serious", meaning I didn't ...   14 Dec, 2007 - 01:12 PM
DilutedImage   Ah, okay. Your previous post reads a lot nicer no...   14 Dec, 2007 - 01:26 PM
GorillaCheif   LOL, after looking at it, I do see how that can be...   14 Dec, 2007 - 02:29 PM
snoj   You have one extra " in there. I will leave y...   14 Dec, 2007 - 02:34 PM
GorillaCheif   You have one extra " in there. I will leave ...   14 Dec, 2007 - 03:40 PM
DilutedImage   I see four. And a space and comma that you'll...   14 Dec, 2007 - 02:50 PM
snoj   *looks again* Hmm, it looks like you're right,...   14 Dec, 2007 - 02:55 PM
snoj   Were you expecting a fully working copy just spit ...   14 Dec, 2007 - 03:56 PM
GorillaCheif   Man, I'm not a programmer, I'm a Marketing...   14 Dec, 2007 - 04:41 PM
DilutedImage   If a double-quote opens (begins) a string, then th...   14 Dec, 2007 - 06:13 PM
GorillaCheif   That helps a lot. Thanks a million for explaining.   15 Dec, 2007 - 12:44 AM
DilutedImage   Happy to help. So did you find the extra double-q...   15 Dec, 2007 - 02:43 AM
GorillaCheif   Well, it's monday morning and I'm back to ...   17 Dec, 2007 - 08:54 AM
GorillaCheif   Scratch that...it all totally dawned on me what I ...   17 Dec, 2007 - 02:17 PM
DilutedImage   Scratch that...it all totally dawned on me what I ...   18 Dec, 2007 - 11:10 AM
GorillaCheif   The missing period? :) .. . Nice work cleaning ...   30 Dec, 2007 - 09:12 AM
GorillaCheif   Ok, Form was working good for a while, then this e...   4 Jan, 2008 - 04:27 PM
Martyr2   Since you are dealing what is known as "relat...   4 Jan, 2008 - 04:42 PM
GorillaCheif   Since you are dealing what is known as "rela...   7 Jan, 2008 - 09:10 AM

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 06:38PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month