Jump to content

rstrik

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rstrik's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=383567:date=Jun 13 2006, 08:27 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 13 2006, 08:27 PM) [snapback]383567[/snapback][/div][div class=\'quotemain\'][!--quotec--] Change: [code]"at http://$_SERVER['SERVER_NAME']/login.php\n\n}".[/code] to [code]"at http://{$_SERVER['SERVER_NAME']}/login.php\n\n}".[/code] [/quote] Works perfectly, thanks alot for your help.
  2. Hello, I'm trying to embed a link in a form I'm creating but keep getting an error message that says: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\web\lostpw.php on line 61 Here is the code portion I'm using: I'm not including the entire document, don't think it's relevant to my error. [code] $mailer->Message = "Dear $first_name,\n\n". "You have requested a new password for My PHP Site. ". "Below is your new login information:\n\n". "==========================\n". "Username: $username\n". "New Password: $newpass\n". "==========================\n\n". "You may login at any time ". "at http://$_SERVER['SERVER_NAME']/login.php\n\n}". "Thank You!\n". "My PHP Site Administrator"; $mailer->SendMail(); [/code] Line 62 error is pointing to the "at http://$SERVER['SERVER_NAME']/login.php\n\n" Is there a better way to write this line? I'm using a book to help me and I think it may be wrong. Thanks for your help.
  3. [!--quoteo(post=382675:date=Jun 11 2006, 06:00 PM:name=WendyLady)--][div class=\'quotetop\']QUOTE(WendyLady @ Jun 11 2006, 06:00 PM) [snapback]382675[/snapback][/div][div class=\'quotemain\'][!--quotec--] rstrik -- While I'm sure there are reasons why you will get "headers already sent" as opposed to "cannot modify headers" -- in my experience so far these errors have been nearly interchangeable in that they have been caused by the same thing. I sent you the link since it goes into more detail. Did you even try the solutions from my earlier post or the other link? Wendy [/quote] Yes they fixed the problem, I had extra spaces before I started the PHP engine. I removed them and it fixed the errors. Thanks for the help.
  4. [!--quoteo(post=382668:date=Jun 11 2006, 05:22 PM:name=WendyLady)--][div class=\'quotetop\']QUOTE(WendyLady @ Jun 11 2006, 05:22 PM) [snapback]382668[/snapback][/div][div class=\'quotemain\'][!--quotec--] When you get the message "headers already sent" -- the VERY first thing you do is check every included & required file & make sure there aren't any spaces before the first "<?php" or after the last "?>". Also make sure that nowhere in any of those files have you sent anything to be printed or echoed. Then try surrounding your session code with OB_start(); and OB_flush();. But try the first things first. Wendy Edited: HEY! I'm not the first person to figure this out: Go have a look-see: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=37442\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=37442[/a] [/quote] Thanks for the help. Just a FYI the link you so nicely posted says "cannot modify header info" and my skill level doesn't allow me to make assumptions yet and the links are broken in the thread.
  5. Hey, I had a quick question maybe somebody could answer for me. When loading my login page for my members I get these session errors that display at the top of the page. I'm using WAMP5 and haven't had any problems with it so far, so I think it may be in the code. I have checked my Info file and the settings in the php.ini file match the settings listed in the PHP Manual session help section under table 1.0 Any help would be appreciated. [code] Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\web\layout.php:2) in C:\web\includes\session.php on line 7 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\web\layout.php:2) in C:\web\includes\session.php on line 7 Warning: Cannot modify header information - headers already sent by (output started at C:\web\layout.php:2) in C:\web\includes\session.php on line 12[/code] This is the where I am creating my session variables in: login.php [code] <?php include $_SERVER['DOCUMENT_ROOT'].'/layout.php'; switch($_REQUEST['req']){ case "validate":     $validate = @mysql_query("SELECT * FROM members             WHERE username='{$_POST['username']}'             AND password = md5('{$_POST['password']}')             AND verified='1'"); if(mysql_num_rows($validate) == 1){         while($row = mysql_fetch_assoc($validate)){             $_SESSION['login'] = true;             $_SESSION['userid'] = $row['id'];             $_SESSION['first_name'] = $row['first_name'];             $_SESSION['last_name'] = $row['last_name'];             $_SESSION['email_address'] = $row['email_address']; if($row['admin_access'] == 1){             $_SESSION['admin_access'] = true;             }             $login_time = mysql_query("UPDATE members             SET last_login=now()             WHERE id='{$row['id']}'");             } header("Location: /loggedin.php");         } else {             myheader("Login Failed!");             echo '<p align ="center">Login Failed</p>';             echo '<p align ="center">If you have already joined '.                  'out website, you may need to validate '.                  'your email address. '.                  'Please check your email for instructions. ';             footer();         }     break; default:         myheader("Login!");             include $_SERVER['DOCUMENT_ROOT'].'/html/forms/login_form.html';         footer();     break; } ?> [/code]
  6. Just curious if anybody had a chance to look at this? I have no idea why it would work fine in one form but not another.
  7. [!--quoteo(post=380668:date=Jun 6 2006, 12:07 PM:name=rstrik)--][div class=\'quotetop\']QUOTE(rstrik @ Jun 6 2006, 12:07 PM) [snapback]380668[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thanks for the help guys, that seemed to do the trick. It now displays blank and also displays form data when you click the back button. I'll be sure I use the <?php echo... from now on. [/quote] This method worked great for one form but I have a simple login_form.html that it won't work with for some reason. I'm using the same method from above but it still displays the php code in the input box. Any ideas why it would do this on one form and not another using the same <?php echo...method? login_form.html [code]<div align="center"><strong><font size="4" face="Verdana, Arial, Helvetica, sans-serif">Please Login </font></strong></div> <form action="/login.php" method="post">     <table width="30%" border="0" align="center" cellpadding"4" cellspacing"0">          <tr>         <td width="19%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">             <strong>Username:</strong></font></td>             <td width="81%"><input name="username" type"text" id="username"             value="<?=$_POST['username'];?>"></td>         </tr>         <tr>             <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">             <strong>Password:</strong></font></td>             <td><input name="password" type="password" id="password"></td>         </tr>         <tr>             <td>&nbsp;</td>             <td><div align="center">                 <input type="hidden" name="req" value="validate">                 <input type="submit" name="Submit" value="Submit">             </div></td>         </tr>     </table> </form> [/code]
  8. [!--quoteo(post=380662:date=Jun 6 2006, 11:48 AM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Jun 6 2006, 11:48 AM) [snapback]380662[/snapback][/div][div class=\'quotemain\'][!--quotec--] The "<?=" is a short hand for "<?php echo". IMHO, it is one of the worst contructs in the langauge. I believe it will be going away along with short tags "<?" in version 6, so start making sure you stop using them now. Ken [/quote] Thanks for the help guys, that seemed to do the trick. It now displays blank and also displays form data when you click the back button. I'll be sure I use the <?php echo... from now on.
  9. Hello, I was curious to see if maybe one of you may be able to help me with an issue I'm having. I am creating a membership signup form, data is entered into the form and then it is inserted into MySQL tables after all error checks have been completed. I am using WAMP5 1.6.1. Problem: The fields are displaying the $_POST php code instead of a blank field in the form. It is suppose to allow users to enter the information and if an error is encountered with their information it will allow them to click the back button in their browser and their info that was entered should remain in the form fields. But instead it is displaying "<?=$_POST['first_name'];?>" , "<?=$_POST['last_name'];?>" and etc for each field. Here is my Html form [code] <p><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong>Become   a Member!</strong></font></p> <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Join our website   and enjoy the benefits of becoming a member!</font></p> <?php if($errors){ echo "<p align=\"center\"><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#FF0000\">$errors</font></p>\n"; } ?> <div align="center"></div> <form method="post" action="/join.php">   <table width="50%" border="1" align="center" cellpadding="4" cellspacing="0">     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">First         Name</font></td>       <td width="179" align="left" valign="top"><input name="first_name" type="text" id="first_name" value="<?=$_POST['first_name'];?>"></td>     </tr>     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Last         Name</font></td>       <td align="left" valign="top"><input name="last_name" type="text" id="last_name" value="<?=$_POST['last_name'];?>"></td>     </tr>     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email Address</font></td>       <td align="left" valign="top"><input name="email_address" type="text" id="email_address" value="<?=$_POST['email_address'];?>"></td>     </tr>     <tr>       <td align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Verify Email Address</font></td>       <td align="left" valign="top"><input name="email_address2" type="text" id="email_address3" value="<?=$_POST['email_address2'];?>"></td>     </tr>     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Desired         Username</font></td>       <td align="left" valign="top"><input name="username" type="text" id="username" value="<?=$_POST['username'];?>"></td>     </tr>     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password</font></td>       <td align="left" valign="top"><input name="password" type="password" id="password" value="<?=$_POST['password'];?>"></td>     </tr>     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password         Again</font></td>       <td align="left" valign="top"><input name="password2" type="password" id="password2" value="<?=$_POST['password2'];?>"></td>     </tr>     <tr>       <td width="200" align="left" valign="top" nowrap><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Tell         us about yourself!</font></td>       <td align="left" valign="top"><textarea name="bio"><?=$_POST['bio'];?></textarea></td>     </tr>     <tr>       <td align="left" valign="top">&nbsp;</td>       <td align="left" valign="top"><input name="req" type="hidden" id="req" value="process">         <input type="submit" name="Submit" value="Submit Information!"></td>     </tr>   </table> </form> [/code] And here is my Join.php file. [code] <?php include $_SERVER['DOCUMENT_ROOT'].'/layout.php'; switch($_REQUEST['req']){ case "process":     myheader("Become a Member: Step 2");          // Validate all required fields were posted     if(!$_POST['first_name'] ||        !$_POST['last_name'] ||        !$_POST['email_address'] ||        !$_POST['email_address2'] ||        !$_POST['username'] ||        !$_POST['password'] ||        !$_POST['password2'] ||        !$_POST['bio']){                  $error = true;           $errors .= "<strong>Form Input Errors:".                        "</strong>\n\n";                                               if(!$_POST['first_name']){                $errors .= "Missing First Name\n";           }                      if(!$_POST['last_name']){                $errors .= "Missing Last Name\n";           }                      if(!$_POST['email_address']){                $errors .= "Missing Email Address\n";              $email_error = true;           }                      if(!$_POST['email_address2']){                $errors .= "Missing Email Address".                            "Verification\n";              $email_error = true;           }                      if(!$_POST['username']){                $errors .= "Missing Username\n";           }                      if(!$_POST['password']){              $errors .= "Missing Password\n";              $password_error = true;                        }                      if(!$_POST['password2']){              $errors .= "Missing Password Verification\n";              $password_error = true;                        }                      if(!$_POST['bio']){                $errors .= "Missing Information About ".                          "Yourself\n";           }     }          // If both emails were posted, validate they match.         if($email_error == false){             if($_POST['email_address'] !=                     $_POST['email_address2']){               $error = true;               $errors .= "Email addresses do not match!\n\n";               $email_error = true;           }     }          // If both passwords were posted, validate they match.     if($password_error == false){             if($_POST['password'] != $_POST['password2']){                     $error = true;                     $errors .= "Passwords do not match!\n\n";                     $password_error = true;           }     }          if($email_error == false){        // Verify if email address has been used already.        $ecount = mysql_result(mysql_query("SELECT COUNT(*)                        AS ecount FROM members                     WHERE email_address =                     '{$_POST['email_address']}'"),0);                          // If email exists, generate error and message.     if($ecount > 0){        $error = true;        $errors .="This email address has already ".                     "been used ".                  "please choose another.\n\n";           }     }          // Verify if user name already exists     $ucount = mysql_result(mysql_query("SELECT COUNT(*)                     AS ucount FROM members                     WHERE username = '{$_POST['username']}'"),0);                          // If user name exists, generate error and message.     if($ucount > 0){        $error = true;        $errors .= "User name already exists, ".                      "please choose another.\n\n";     }          // If $error is TRUE, then include the signup form     // and display the errors we found.          if($error == true){        $errors = nl2br($errors);        include $_SERVER['DOCUMENT_ROOT'].                   '/html/forms/membership_signup.html';        footer();        exit();     }          // All checks have passed, insert user in database          // Email User          // Email Admin          // That's it! Done!      break;               default:         myheader("Become a member!");         include $_SERVER['DOCUMENT_ROOT'].                 '/html/forms/membership_signup.html';         footer();     break; } ?> [/code] Any help would be much appreciated, the form works as far as not generating any errors it's just displaying the code instead of a blank field.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.