Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Everything posted by phpretard

  1. I have people registering on my site and for what ever reason they leave there computer after registration and this conflicts with some other reporting sofware I am using. I need to set a cookie and give them X amount of time with $_SESSION['PoolID']; Set. I then would like to redirect them to somewhere else (off of my site). My problem is seting the cookie. I can set the seeion of course but setting the session and settin it as a cookie troubles me? <?php session_start(); $_SESSION['PoolID']="Stuff"; if (!isset($_COOKIE['session'])) { session_destroy(); // if not, destroy session header ('Location: http://www.google.com'); exit; } if (!empty($_SESSION['PoolID'])) { setcookie('session', 'active', time()+3600); } else { header ('Location: http://www.google.com'); exit; // exit the current script } ?> Everytime I open my test page it just send me to google... Can someone help me here?
  2. I forgot the script that prints the actual sql error code. Anybody?
  3. How do you do it? Thank you!!!!
  4. I need some formula that will take this set of radio button and increment them up. The name should start at $i=1; and end at $max=31; $values=1 to 4; The only only real value that needs to change is "value" I know there is an easy script for this I just can't get it put together and I'm embarrassed to show my work thus far. My brain hurts trying to figure this. In theary I believe since the value is simply 1 to 4 I could set a variable (minimum maximum for that). The name is 1 - 32 I could set a variable (minimum maximum for that) The loop Help me... <input type="radio" name='1' value=1> 1 <input type="radio" name='1' value=2> 2 <input type="radio" name='1' value=3> 3 <input type="radio" name='1' value=3> 3 <input type="radio" name='1' value=4> 4 <input type="radio" name='2' value=1> 1 <input type="radio" name='2' value=2> 2 <input type="radio" name='2' value=3> 3 <input type="radio" name='2' value=3> 3 <input type="radio" name='2' value=4> 4 This just repeats up to 32 inside of a table Could someone get me started. I'll be searching until then. Thanks!
  5. With your example... function a($var) { echo $var; } $var = 'Hello'; a($var); // 'Hello'; function DisplayForm($values, $errors){ how do I echo "Hello" it in here }
  6. So this part of the code would be it's own function? $ID=$_GET['ID']; include ("connect.php"); $result = mysql_query("SELECT * FROM table WHERE ValKey='$ID'"); while($row = mysql_fetch_array($result)) { $APCompany=$row['APCompany']; $APEmail=$row['APEmail']; } //END WHILE
  7. I am trying to get the page title to read the value of $APCompany I can't get the value from the while loop into the function that displays the form... Please Help. <? $ID=$_GET['ID']; include ("connect.php"); $result = mysql_query("SELECT * FROM table WHERE ValKey='$ID'"); while($row = mysql_fetch_array($result)) { $APCompany=$row['APCompany']; $APEmail=$row['APEmail']; } //END WHILE echo $APCompany; <<<<<<<<<<<<< IT WILL DISPLAY HERE function VerifyForm(&$values, &$errors) { // VALLIDATION if ($_POST['pass']!=$_POST['pass2']) $errors['pass'] = "ERROR 1"; if (!$_POST['pass']) $errors['pass'] = "ERROR 2"; return (count($errors) == 0); } function DisplayForm($values, $errors) { ?> <html> <head> <title><? echo $APCompany; ?></title> <<<<<<<<<<<<<<<<<< HERE IS THE PROBLEM NO DISPLAY <style> TD.error { color: red; font-weight: bold; } </style> </head> <body> <div align="center"> <table> <form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST"> <tr> <td colspan=2 height='30' style='padding-left:50px;'><?= $errors['pass'] ?><?= $errors['pass2'] ?></td> </tr> <tr> <td align=right>New Password:</td> <td><input class='input' type="text" size="30" name="pass" value="<?= htmlentities($values['pass']) ?>" autocomplete='off' /> </tr> <tr> <td>Confirm:</td> <td><input class='input' type="text" size="30" name="pass2" value="<?= htmlentities($values['pass2']) ?>" autocomplete='off'/> </tr> <tr><td colspan="2" align="center"><input class='select' type="submit" value="Submit"></tr> </form> </table> </div> </body> </html> <?php } function ProcessForm($values) { $TO = ""; $from = ""; $subject = ""; $body= ""; mail($TO, $subject, $body, "From: <$from>"); echo " <html> <head> <title>$APCompany</title> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<, AND AGAIN </head> <body> <div align='center'> <table bgcolor='#FFFFFF'> <tr> <td><center>SUCCESS</center> </td> </tr> </table> </div> </body> </html> "; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formValues = $_POST; $formErrors = array(); if (!VerifyForm($formValues, $formErrors)) DisplayForm($formValues, $formErrors); else ProcessForm($formValues); } else DisplayForm(null, null); ?> <? mysql_close($con); ?>
  8. So somthing like this? $price=round($multiplier*.0275, 2 ,",",".");
  9. This works fine for a remainder. I can't figure a way to display Zeros the result is for instance $100.00 Now it will only display $100 $price=round($multiplier*.0275, 2); Any help, pointer, quick code snips...?
  10. Correction The DB field holds: Randal&#039;sAppraisals, LLC The from Line Reads: "Randal\\" (In the email)
  11. No I am using PHP Mailer and the line is: $CompanyName="Randal&#039;s Appraisals, LLC"; $mail->FromName = "$CompanyName"; In the email Sent it now doesn't stop at "Randal" (Thank you) The From Line Reads " Randal\'s Appraisals, LLC " (In The Email)
  12. Good Call! How can I apply this the the From line in an email? It stops at the single quote.
  13. I would like to insert "htmlspecialchars" into my DB when a user puts in single or double quotes. I can't make it work in testing...(darn it) So if: $insert="Randal's Appraisals, LLC"; I would like to INSERT ->Randal&#039;s Appraisals, LLC OR " = " I have been all over and here I am am again... Any help? NONE OF THESE WORK: $CompanyName="Randal's Appraisals, LLC"; $CompanyName2="Randal's Appraisals, LLC"; $Com=htmlentities($CompanyName, ENT_QUOTES); $Com2=htmlspecialchars_decode($CompanyName2, ENT_QUOTES); echo $Com; echo "<br><br>"; echo $Com2;
  14. This does not do what it says... $str = "A 'quote' is <b>bold</b>"; // Outputs: A 'quote' is <b>bold</b> echo htmlentities($str); echo "<br><br>"; // Outputs: A &#039;quote&#039; is <b>bold</b> echo htmlentities($str, ENT_QUOTES);
  15. I am displaying it in the "From" Line in an email. $CompanyName="Randal's Appraisals, LLC"; $mail->FromName = "$CompanyName";
  16. OK. But when I try to use it in a "FROM" line in an email it stops where the apostrophe starts. any thoughts there? So instead of being FROM - Randal's Appraisals, LLC It is FROM - Randal
  17. $result = mysql_query("SELECT * FROM table1 WHERE name='john' "); $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n"; ref = http://www.php.net/mysql_num_rows
  18. Should I add/strip slashes when putting text into the DB or pulling them out? I have read into this...just need a little help here.
  19. Should I addslashes when I call it from the DB? It is in the DB just like this--> Randal's Appraisals, LLC
  20. I am pulling info from a DB and emailing it based on variable names. Randal's Appraisals, LLC <--EXAMPLE When it gets emailed the company name stops at the apostrophe. So the "From" Line in the Email reads "Randal". Any other company names works great. So I guess the question is how can I get the PHP variable to (for lack of better words) ignore and still print the apostrophe? I think the only real significant script is: $mail->FromName = "$CompanyName"; If you need more please let me know... Thanks.
  21. I found this. I don't know if it helps though. // session garbage collection: function mysql_sess_gc ($sess_maxlife) { global $mysql_sess_conn_id; $time=date("format_of_date_used_in_t_column",now()-$sess_maxlife); $query="SELECT * FROM sessions WHERE t<'$time' "; $r=mysql_query($query,$mysql_sess_conn_id); for ($i=0; $i<mysql_numrows($r); $i++) { // here you store sessions in saved_sessions table } $query = "DELETE FROM sessions WHERE t < '$time' ", mysql_query ($query, $mysql_sess_conn_id); return; }
  22. I appreciate the quick response but this code validates all the posts as one. There could be up to 4 and it is posted as an array.
  23. I am trying to vslidate a date format to this - MM-DD-YYY The catch is that the date is submitted like this: <input name='LICEXP[$i]' value='$LICEXP[$i]'> There can be up to 4 dates. Here's my current code: $LICEXP=$_POST['LICEXP']; if (!ereg ("([0-9]{2})-([0-9]{2})-([0-9]{4})", $LICEXP)) { echo"error"; } It just echo error for erthang? Any help... I have searched but can't find. So here I am.
×
×
  • 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.