Jump to content

moleyb

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by moleyb

  1. Thanks for taking a look Premiso, however, for some reason is still not redirecting.. (probably got something to do with it being Friday afternoon!)
  2. Hi there, If anyone has a spare minute, id really appreciate someone casting their eye over this and seeing if there's anything obviously wrong. Writing to the txt file works fine, but the redirect to the thankyou.html page doesn't. Cheers Guys. <?PHP $filename = "output.txt"; #CHMOD to 666 $forward = 1; # redirect? 1 : yes || 0 : no $location = "thankyou.html"; #set page to redirect to, if 1 is above ## set time up ## $date = date ("l, F jS, Y"); $time = date ("h:i A"); ## mail message ## $msg = ""; foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) .", ". $value . ", "; } $msg .= "\n"; $fp = fopen ($filename, "a"); # w = write to the file only, create file if it does not exist, discard existing contents if ($fp) { fwrite ($fp, $msg); fclose ($fp); } else { $forward = 2; } if ($forward == 1) { header ("Location:$location"); } else if ($forward == 0) { echo ("Thank you for submitting our form. We will get back to you as soon as possible."); } else { "Error processing form. Please contact the webmaster"; } ?> Many thanks, Mike
  3. Cheers Chris, yeah I did try that as well. Im guessing its down to my host and "not within the allowed path(s)". Thanks so much for taking the time to look at this. Really Appreciate it. Maybe one day ill resolve this issue! Cheers mate.
  4. Hi Chris, Thanks again for taking a look. I just can't see how its failing! Using the complete path I get this error: Warning: main() [function.main]: open_basedir restriction in effect. File(/ext/f/fo/fourthelement.com/html/includes/footer.php) is not within the allowed path(s): (.:/tmp/) in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Warning: main(/ext/f/fo/fourthelement.com/html/includes/footer.php) [function.main]: failed to open stream: Operation not permitted in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Warning: main() [function.include]: Failed opening '/ext/f/fo/fourthelement.com/html/includes/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Here's a URL to what im working on: http://www.fourthelement.com/sita/resources/members_area.php Many thanks Mike
  5. Hi Guys, didn't manage to resolve this yet. Any help would be very much appreciated. Mike
  6. Thanks PFMaBiSmAd, ill look into that for when I put it on its own hosting. Cheers Chris, didn't seem to like it again got this error: Warning: main() [function.main]: open_basedir restriction in effect. File(/ext/f/fo/fourthelement.com/html/sita/resources/../includes/footer.php) is not within the allowed path(s): (.:/tmp/) in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Warning: main(/ext/f/fo/fourthelement.com/html/sita/resources/../includes/footer.php) [function.main]: failed to open stream: Operation not permitted in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Warning: main() [function.include]: Failed opening '/ext/f/fo/fourthelement.com/html/sita/resources/../includes/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Any suggestions, thanks again.
  7. Cheers for looking at this Chris, Iv set the includes folder to 777 for now, and it still not happy : ( Actually my question is slight off for where im testing it right now. Im actually trying to access an includes folder that is 1 folder back (and not in the root folder of the site). Can I ask what do you use for that? Thanks again.
  8. Hi Guys, im really hoping one of you php guru's can shed some light on this as its being bugging me for months... Im trying you access a php include, in a page 1 directory deep into a site (say one down from the index.php) - with no luck. My includes are in a folder that is on the same level as the index.php file for the website. Iv tried using this way: <? include("../includes/footer.php"); ?> And this way: <?php include $_SERVER['DOCUMENT_ROOT'] . "includes/footer.php"; ?> It works locally (using MAMP), but not live on the net. Im getting this error: Warning: main() [function.main]: open_basedir restriction in effect. File(/ext/default/includes/footer.php) is not within the allowed path(s): (.:/tmp) in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Warning: main(/ext/default/includes/footer.php) [function.main]: failed to open stream: Operation not permitted in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Warning: main() [function.include]: Failed opening '/ext/default/includes/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /ext/f/fo/fourthelement.com/html/sita/resources/members_area.php on line 53 Really appreciate anyone who has a few minutes to look at this. Cheers Guys Mike
  9. Cheers for taking a look. Is that line 6 of the whole web page or line 6 of the php form code?
  10. Hi there, im guessing I done this completely wrong, but im getting an error appearing on the page at the start of the form: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /websites/123reg/LinuxPackage21/ne/xu/s_/nexus-defence.com/public_html/contact3.php:6) in /websites/123reg/LinuxPackage21/ne/xu/s_/nexus-defence.com/public_html/contact3.php on line 49 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /websites/123reg/LinuxPackage21/ne/xu/s_/nexus-defence.com/public_html/contact3.php:6) in /websites/123reg/LinuxPackage21/ne/xu/s_/nexus-defence.com/public_html/contact3.php on line 49 If anyone has a moment to look over it and see where iv cocked it up , id really appreciate it. Thanks <?php session_start(); if(!isset($_SESSION['processed'])){ // put your form processing code here ... #This is just a basic PHP e-mail form. #settings $youremail = "mikepostons@hotmail.com"; $thanks = "Thanks for your enquiry, we will get back to you shortly."; $emailnotvalid = "Please enter a valid e-mail address!"; $requiredfieldsempty = "Please fill in the required fields!"; #checks if email valid or not function checkemail($email) { if(ereg("^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.([a-zA-Z]{2,4})$", $email)) return true; else return false; } #email process is here. if (isset($_POST['submit'])) { #variables $name = $_REQUEST['name']; $email = $_REQUEST['email']; $url = $_REQUEST['url']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; #checks if fields are empty or not. if(!empty($name) && !empty($email) && !empty($message)) { #checkemail function for email validating. if(checkemail($email)==true) { #final email. $result ="Name: $name \n\nEmail: $email \n\nUrl: $url \n\nSubject: $subject \n\nMessage: $message"; #sending email. mail( "$youremail", "Nexus Enquiry", $result, "From: $email" ); echo "<p id='success'><strong>$thanks</strong></p>"; #clearing fields after sending email. $name=null; $email=null; $url=null; $subject=null; $message=null; } else echo "<p id='failure'><strong>$emailnotvalid</strong></p>"; } else echo "<p id='failure'><strong>$requiredfieldsempty</strong></p>"; } // at the point where your the processing code is compleately done, // set the session variable so that the processing code will be skipped until the session variable has been cleared - $_SESSION['processed'] = true; } ?>
  11. Thanks @PFMaBiSmAd I havent had a chance to try it out yet. Ill get round to that tonight and let you guys know how that went.
  12. Thanks for your time with this guys, just been testing and it seems its FF causing the problem as it only sent one in chrome. Also commented out the mail() and it didnt send anything so I ruled that out. Sorry my php knowledge is seriously limited. How do you: FYI This is the code im using: <?php #This is just a basic PHP e-mail form. #settings $youremail = "mikepostons@hotmail.com"; $thanks = "Thanks for your enquiry, we will get back to you shortly."; $emailnotvalid = "Please enter a valid e-mail address!"; $requiredfieldsempty = "Please fill in the required fields!"; #checks if email valid or not function checkemail($email) { if(ereg("^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.([a-zA-Z]{2,4})$", $email)) return true; else return false; } #email process is here. if (isset($_POST['submit'])) { #variables $name = $_REQUEST['name']; $email = $_REQUEST['email']; $url = $_REQUEST['url']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; #checks if fields are empty or not. if(!empty($name) && !empty($email) && !empty($message)) { #checkemail function for email validating. if(checkemail($email)==true) { #final email. $result ="Name: $name \n\nEmail: $email \n\nUrl: $url \n\nSubject: $subject \n\nMessage: $message"; #sending email. mail( "$youremail", "Nexus Enquiry", $result, "From: $email" ); echo "<p id='success'><strong>$thanks</strong></p>"; #clearing fields after sending email. $name=null; $email=null; $url=null; $subject=null; $message=null; } else echo "<p id='failure'><strong>$emailnotvalid</strong></p>"; } else echo "<p id='failure'><strong>$requiredfieldsempty</strong></p>"; } ?> <form method="post" action="contact2.php" id="contactform"> <fieldset> <label for="name">Name *</label> <input type="text" name="name" id="name" value="<?php echo $name; ?>" tabindex="1" /> <label for="email">Email *</label> <input type="text" name="email" id="email" value="<?php echo $email; ?>" tabindex="2" /> <label for="url">Company</label> <input type="text" name="url" id="url" value="<?php echo $url; ?>" tabindex="3" /> <label for="subject">Subject</label> <input type="text" name="subject" id="subject" value="<?php echo $subject; ?>" tabindex="4" /> <label for="message">Message *</label> <textarea name="message" id="message" tabindex="5" rows="5" cols="25"><?php echo $message; ?></textarea> <input type="submit" name="submit" value="Send" id="form-submit" class="submit-enquiry" tabindex="6" /> </fieldset> </form> Cheers again for your time guys.
  13. Cheers for looking at that mate, what will commenting out the mail () part do? (and whats 508 compliant! sorry noob here)
  14. Hi everyone, just getting into php and im still a complete noob. Iv got an php email form and its pissing me right off. Basically sending the same enquiry email twice (or more). Tried a few different forms I had with the same result. Just wondering if anyone can take a look at the following code, and see if its OK? Any help with this would be so much appreciated. Mike <?php #This is just a basic PHP e-mail form. #settings $youremail = "admin@nexus.com"; $thanks = "Thanks for your enquiry, we will get back to you shortly."; $emailnotvalid = "Please enter a valid e-mail address!"; $requiredfieldsempty = "Please fill in the required fields!"; #checks if email valid or not function checkemail($email) { if(ereg("^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.([a-zA-Z]{2,4})$", $email)) return true; else return false; } #email process is here. if (isset($_POST['submit'])) { #variables $name = $_REQUEST['name']; $email = $_REQUEST['email']; $url = $_REQUEST['url']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; #checks if fields are empty or not. if(!empty($name) && !empty($email) && !empty($message)) { #checkemail function for email validating. if(checkemail($email)==true) { #final email. $result ="Name: $name \n\nEmail: $email \n\nUrl: $url \n\nSubject: $subject \n\nMessage: $message"; #sending email. mail( "$youremail", "Nexus Enquiry", $result, "From: $email" ); echo "<p id='success'><strong>$thanks</strong></p>"; #clearing fields after sending email. $name=null; $email=null; $url=null; $subject=null; $message=null; } else echo "<p id='failure'><strong>$emailnotvalid</strong></p>"; } else echo "<p id='failure'><strong>$requiredfieldsempty</strong></p>"; } ?> <form method="post" action="contact.php" id="contactform"> <fieldset> <label for="name">Name *</label> <input type="text" name="name" id="name" value="<?php echo $name; ?>" tabindex="1" /> <label for="email">Email *</label> <input type="text" name="email" id="email" value="<?php echo $email; ?>" tabindex="2" /> <label for="url">Company</label> <input type="text" name="url" id="url" value="<?php echo $url; ?>" tabindex="3" /> <label for="subject">Subject</label> <input type="text" name="subject" id="subject" value="<?php echo $subject; ?>" tabindex="4" /> <label for="message">Message *</label> <textarea name="message" id="message" tabindex="5" rows="5" cols="25"><?php echo $message; ?></textarea> <input type="submit" name="submit" value="Send" id="form-submit" class="submit-enquiry" tabindex="6" /> </fieldset> </form> Cheers guys, hope I can return the favor in the future!
×
×
  • 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.