Jump to content

funkgut

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

funkgut's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. last question I promise.....and by the way thanks you guys are great.......how would I format the date and where would I do that using the 'origTime' coookie proposed by W3
  2. Thanks for the quick replies W3, I understand you point just not how to implement. If I set another cookie should I do that in the contact.php or the action page? The second question would be how would I retireve the time value for that cookie......sorry obviously I am a noob....... Zhadus, I agree a DB would be a better implementation but not really an option.
  3. I am having an issue with cookies in my php. Here is the scenario. I have a form that when you access it you are entering as a guest. When you fill out the form and submit you are shown the date submitted and all the info you typed in. Now, when you go back to the form page, it recognizes the cookie and tells you cannot send another email in a 24 hours period. All this works fine. What I can't figure out is how to tell the user what time they submitted the original email on. I assume it can be retrieved form the cookie, but for the life of me I can't figure out how. Here is the form page contact.php <?php setcookie("assign", "ProfClower", time()+86400); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Messer Consulting Services .: Contact Us :.</title> <link rel="STYLESHEET" type="text/css" href="styles.css"> <style type="text/css"> <!-- td.form { color: #ffffff; font-family: "Verdana","Arial"; font-size: 11; } td.main { color: #000000; font-family: "Verdana","Arial"; font-size: 12; } font.form_check { color: red; } input { font-family: "Verdana","Arial"; color:#606060; font-size: 11px; } textarea { font-family: "Verdana","Arial"; color:#606060; font-size: 11px; } div#form_box { margin: 2px; width: 651px; border: 1px; border-style: solid; border-color: #606060; background: #64798B; padding: 5px; } --> </style> </head> <body> <div align="center"> <div class="contentBorder"> <div class="mainContent"> <br> <table width="651" cellpadding="2" cellspacing="3" border="0"> <tr> </td> <?php if (isset($_COOKIE["assign"])) echo "Welcome " . $_COOKIE["assign"] . "!<br />"; else echo "Welcome guest!<br />"; ?> </td> </tr> <tr> <td class="bodyText">We would love to hear from you! Please feel free to fill out the form below with any questions or comments you may have</td></tr> <tr> <td class="bodyText">Please fill out and submit the form on this page to contact us. We will get back to you as soon as we can. Note that fields marked with (<font class="form_check">*</font>) are required fields. </td> </tr> <tr> <td class="bodyText"> <form method="post" action="sendeail.php"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); $todayis = date("l, F j, Y, g:i a") ; ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <input type="hidden" name="todayis" value="<?php echo $todayis ?>" /> Your Name: <br /> <input type="text" name="visitor" size="35" /> <br /><br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /><br /> Mail Message: <br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /><br /> <?php if (isset($_COOKIE["assign"])) echo "You sent an email on ". $_COOKIE["todayis"] ." with the subject Contact Inquiry. You may not send more than one email in any 24 hour period."; else echo "<input type=submit value=Send Mail>"; ?> </form> </td> </tr> </table> </div> </div> </div> </body> </html> and here is the action page. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; if (eregi('http:', $notes)) { die ("Do NOT try that! ! "); } if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; die ("Go back! ! "); } if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Use Back - fill in all fields</h2>\n"; die ("Use back! ! "); } $todayis = date("l, F j, Y, g:i a") ; $subject = "Contact Inquiry"; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; mail("nofx@gti.net", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> </p> </body> </html> Any help would be appreciated.
  4. here is db_connect.php [code]<?php //require the PEAR::DB classes. require_once '/usr/bin/pear/DB.php'; $db_engine = 'mysql'; $db_user = 'ply_mess'; $db_pass = 'bill1022'; $db_host = 'localhost'; $db_name = 'plymovent'; $datasource = $db_engine.'://'.   $db_user.':'.   $db_pass.'@'.   $db_host.'/'.     $db_name; $db_object = DB::connect($datasource, TRUE); /* assign database object in $db_object, if the connection fails $db_object will contain the error message. */ // If $db_object contains an error: // error and exit. if(DB::isError($db_object)) { die($db_object->getMessage()); } $db_object->setFetchMode(DB_FETCHMODE_ASSOC); // we write this later on, ignore for now. include('check_login.php'); ?>[/code]
  5. when I go to this page nothing shows up I get no errors, just a blank page [code]<?php require 'db_connect.php'; // require above script // change the path to match wherever you put it. $table = "CREATE TABLE users ( id int(10) DEFAULT '0' NOT NULL auto_increment, username varchar(40), password varchar(50), fullname varchar(65), address varchar(150), city varchar(50), state varchar(4), zip varchar(15), email varchar(100), chiefemail(100) location varchar(150), show_email int(2) DEFAULT '0', last_login varchar(20), PRIMARY KEY(id))"; $create = $db_object->query($table); //perform query if(DB::isError($create)) { die($create->getMessage()); } else { echo 'Table created successfully.'; } $db_object->disconnect(); ?>[/code]
  6. Hello all, I am a pear newbie.  I am having my site hosted on a virtual server with plesk and my host host says they have PEAR support. My problem is where to find DB.php that is included in all the files.  This has all the db variables so none of pages work. Is there a place that PEAR is usually nstalled on a host or what? Thanks,
×
×
  • 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.