PHP - Php Form Script And Godaddy
Hi I was wondering if anybody could help me. I have used this form script on other hosting packages and it work well however I can not get it to work on Godaddy. I have not written the script i got it off the web and therefore i am having trouble implementing the advise from Godaddy.
"It appears that the form in question allows you to define the To address for the message, but that in most cases the From address is designated as the email address entered by the party submitting the form. For anti-spam purposes, emails using a major provide as the From address (e.g. @hotmail, @gmail, @yahoo, etc) will often be rejected. As a result, we recommend that the From address for your message be a dedicated address utilizing your hosted domain; for example, contactform@your-directories.com. We recommend that you update your configuration to use a defined From address as previous indicated in order to resolve the issues which you are encountering" I guess what I am asking for is a fairy godmother/father to look at my code and tell me what I need to do to make it work. If anybody can help me I would be really greatful as I have been trying to make this work for day. Thanks for your time Kelly Code: [Select] <?php // ------------- CONFIGURABLE SECTION ------------------------ $mailto = 'kpayne@your-directories.com' ; $subject = "ContactForm" ; $formurl = "http://www.your-directories.com/contact.html" ; $thankyouurl = "http://www.your-directories.com/Forms/Thankyoucontact.html" ; $errorurl = "http://www.your-directories.com/Forms/Errorcontact.html" ; $email_is_required = 1; $name_is_required = 1; $comments_is_required = 1; $uself = 0; $use_envsender = 1; $use_sendmailfrom = 1; $smtp_server_win = '' ; $use_webmaster_email_for_from = 1; $use_utf8 = 1; $my_recaptcha_private_key = '' ; // -------------------- END OF CONFIGURABLE SECTION --------------- define( 'MAX_LINE_LENGTH', 998 ); $headersep = (!isset( $uself ) || !$uself) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (!isset( $use_envsender )) { $use_envsender = 0 ; } if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } if (isset( $smtp_server_win ) && strlen($smtp_server_win)) { ini_set( 'SMTP', $smtp_server_win ); } $envsender = "-f$mailto" ; $fullname = (isset($_POST['fullname']))? $_POST['fullname'] : $_POST['name'] ; $phone = $_POST['phone'] ; $email = $_POST['email'] ; $department = $_POST['department'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) { header( "Location: $errorurl" ); exit ; } if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) { header( "Location: $errorurl" ); exit ; } if (strlen( $my_recaptcha_private_key )) { require_once( 'recaptchalib.php' ); $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] ); if (!$resp->is_valid) { header( "Location: $errorurl" ); exit ; } } if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "------------------------------------------------------------\n" . "Name of Sender: $fullname\n" ."------------------------------------------------------------\n" . "Phone Number of Sender: $phone\n" ."------------------------------------------------------------\n" . "Email of sender: $email\n" ."------------------------------------------------------------\n" . "For the Attention of Department: $department\n" . "------------------------- COMMENTS -------------------------\n\n" . "------------------------------------------------------------\n" . "------------------------------------------------------------\n" . wordwrap( $comments, MAX_LINE_LENGTH, "\n", true ) . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.16.1" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($use_envsender) { mail($mailto, $subject, $messageproper, $headers, $envsender ); } else { mail($mailto, $subject, $messageproper, $headers ); } header( "Location: $thankyouurl" ); exit ; ?> MOD EDIT: [code] . . . [/code] tags added. Similar TutorialsHello, I have a script that will resize all images in a directory.. the script functions properly on my normal hosting (through hostgator) but when I try to run the script on a GoDaddy site, the script will only get about half way done and then just stop without any errors. I've checked the max_execution_time and it's set to 90 but the script seems to stop after around 25 seconds. I wrote another script that was just a for loop with sleep(1) to run 90 times and it did without any issues.. I was thinking it was a memory error but I don't get any fatal errors saying so... I know its something to do with the config of GoDaddy but I can't figure out the exact cause. the server does have PHP5 installed and the only error i can even get to throw through the GoDaddy logs is a warning about ./json.so not being able to load.. Can anyone think of anything off the top of their head that could cause this to happen only on GoDaddy? this is the gist of the function but its been modified a tiny bit... (only filenames that are created etc) <?php // The file $filename = 'test.jpg'; // Set a maximum height and width $width = 200; $height = 200; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width_orig, $height_orig) = getimagesize($filename); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // Resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // Output imagejpeg($image_p, null, 100); ?> thanks! Is there a PHP "API" that can connect to GoDaddy, list domains, change the dns and whois? Possibly add new domains? I highly doubt it, and if not, I'll start writing one. However, GoDaddy uses what must be the worst HTML code EVER. WHO THE @$%^ uses javascript FOR EVERY LINK. That is just plain unnecessary. And I have a feeling GoDaddy wouldn't like such an API, and would make any attempt to break it Thanks I'm so angry right now. Just want to vent a little.
Godaddy sucks. They are currently taking an blow torch to their servers, or them damn gremlins. Our shared host cpanel server is on for a few seconds then down again. If it is up, it can't connect to mysql. Then it works, then back. Why? oh ohhh ohhhh! Cause yesterday, from 7pm to this morning, 5 am they did what ever it is those nuts do and well now my client, our customers and I can't use the site. YAY!
No idea when it will be back. Work to do. But...why would that piss me off so much? That's not it!!
The day before yesterday, which would be Tuesday they had already started screwing things up. What ever they did caused the sql settings in my php.ini file to no longer mesh with the server. SO, I get the call from client and employees, "it's not working." Can't get to mysql. Call GoDaddy, they disable my php.ini and the timezone for the server changed and some odd hours later employees where calling me saying the data changed early.
72 hours, roughly of on edge, what's going to be next from GoDaddy.
This is just the past few days!
The 2 weeks before that I was trying to get a asp.net c# MVC application to run on another of their servers. Nope. Ended up getting a new host. 2 weeks!! Those 2 weeks were filled with godaddy saying "Everything is ok on our end.. something is wrong with your code." Upload the code to new server and it just worked. Hum?
Over the past 6+ years I have had nothing but head aches dealing with godaddy. Their normal solution is found in the next pay package, or it isn't their problem in the first place.
We had issues sending emails out from PHP. This was a big one. 5+ years of dealing with it. Sometimes they got the email, sometimes they didn't. Looked around the net, use a php mailer plug in. Same problem. Tweaked sent froms and return's to. Same thing. Years of godaddy saying they are setup right. Guess what! Nope! Found out they had a setting hidden deep in the horrid control panels that tweaked something I don't even know what and that seemed like a fix. Nope. So we start doing an in depth look at our server reputation and logging the ip's emails came from. Testing those IP's to see if they were black listed showed us that yes some of them were black listed. We send maybe 25 emails out a month? All legit, clean. But shared server so, someone did it. GoDaddy said there was nothing they could or would do about it. That's right! Their server's were blacklisted, shucks!
My last 2 clients on godaddy are making the switch. Soon I will be godaddy free and will strongly recommend new clients away.
Sorry that this was a big long BLAH of garbage. Thank you for listening. I feel better now.
For the first time in my life, I can't open a webpage with curl: $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //curl_setopt($ch, CURLOPT_SSLVERSION, 3); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.02; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/godaddycokie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/godaddycokie.txt'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $url = 'https://auctions.godaddy.com'; curl_setopt($ch, CURLOPT_REFERER, $url); echo curl_exec($ch); Any clues? Some Javascript trick?! Hi I've created my website, I'm hosting it on Godaddy but my email doesn't work at all, it shows the errors so it looks like it works and the mail has been sent, but i don't get any emails at all. I used different emails, one from Gmail and one from Godaddy. I've been loking for the solution for that for last few days... can you help, please? Hello, I am new. I have created a very simple webpage that has content the changes when a link is clicked. The site works perfectly on my "localhost". I am running Apache 2.2 and PHP 5.3 on localhost. When I upload to my GoDaddy shared hosting, ( I beleive Apahe 1.3 and PHP 5.2) my "index.php" displays fine on load. However, when any of the links are clicked the content area where it is supposed to change disapeears. Here is a sample of the code that I am using: // These are the links in the index.php html code... <li><a href="index.php?id='home'" id="home" name="home">Home</a></li> <li><a href="index.php?id='form'" id="form" name="form">Register</a></li> <?php include("form1.php"); getPage(); ?> html.... Then on the form1.php page is the following code... function getPage() { $linkID = $_GET['id']; if ($linkID == NULL) { changeBool("'home'"); } else changeBool($linkID); } //end example The function "changeBool()" has a switch structure that is determined by the $_GET[] var. I beleive this has something to do with the php.ini settings, possibly the apache settings...any ideas would be greatly appreciated. Hello, I have been working on my website lateley and realized that godaddy only allows a 1000 email limit. I am sure this will be fine when the site first launches but if I get more and more users it will cause some issues. How can I fix this? Is there like a function that can bypass this or something??? Thanks in advance :-) Hey guys, bit of a newb here. But I am having a brutal time trying to get the php mail() function to work with GoDaddy. I contacted them and they said I must use their PHP gdform.php script to send out emails. My script sends the emails from register.php and functions.php. Does anyone know how I can integrate godaddy's gdform.php to work with my functions.php mail() script. Doesn't make sense to me my go daddy makes this so difficult to use a simple function. Thanks in advance!!! My register.php script Code: [Select] <?php include ('config.inc.php'); include ('functions.php'); // Those two files can be included only if INCLUDE_CHECK is defined session_name('wkLogin'); // Starting the session session_set_cookie_params(2*7*24*60*60); // Making the cookie live for 2 weeks session_start(); if($_SESSION['id'] && !isset($_COOKIE['wkRemember']) && !$_SESSION['rememberMe']) { // If you are logged in, but you don't have the wkRemember cookie (browser restart) // and you have not checked the rememberMe checkbox: $_SESSION = array(); session_destroy(); // Destroy the session } if(isset($_GET['logoff'])) { $_SESSION = array(); session_destroy(); header("Location: tester.php"); exit; } if($_POST['submit']=='Login') { // Checking whether the Login form has been submitted $err = array(); // Will hold our errors if(!$_POST['username'] || !$_POST['password']) $err[] = 'All the fields must be filled in!'; if(!count($err)) { $_POST['username'] = mysql_real_escape_string($_POST['username']); $_POST['password'] = mysql_real_escape_string($_POST['password']); $_POST['rememberMe'] = (int)$_POST['rememberMe']; // Escaping all input data $row = mysql_fetch_assoc(mysql_query("SELECT id,usr FROM wk_members WHERE usr='{$_POST['username']}' AND pass='".md5($_POST['password'])."'")); if($row['usr']) { // If everything is OK login $_SESSION['usr']=$row['usr']; $_SESSION['id'] = $row['id']; $_SESSION['rememberMe'] = $_POST['rememberMe']; // Store some data in the session setcookie('wkRemember',$_POST['rememberMe']); } else $err[]='Wrong username and/or password!'; } if($err) $_SESSION['msg']['login-err'] = implode('<br />',$err); // Save the error messages in the session header("Location: tester.php"); exit; } else if($_POST['submit']=='Register') { // If the Register form has been submitted $err = array(); if(strlen($_POST['username'])<4 || strlen($_POST['username'])>32) { $err[]='Your username must be between 3 and 32 characters!'; } if(preg_match('/[^a-z0-9\-\_\.\@]+/i',$_POST['username'])) { $err[]='Your username contains invalid characters!'; } if(!checkEmail($_POST['email'])) { $err[]='Your email is not valid!'; } if(!count($err)) { // If there are no errors $pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6); // Generate a random password $_POST['email'] = mysql_real_escape_string($_POST['email']); $_POST['username'] = mysql_real_escape_string($_POST['username']); // Escape the input data mysql_query(" INSERT INTO wk_members(usr,pass,email,regIP,dt) VALUES( '".$_POST['username']."', '".md5($pass)."', '".$_POST['email']."', '".$_SERVER['REMOTE_ADDR']."', NOW() )"); if(mysql_affected_rows($link)==1) { send_mail( 'noreply@mygodaddydomain.com', $_POST['email'], 'Registration System Demo - Your New Password', 'Your password is: '.$pass); $_SESSION['msg']['reg-success']='We sent you an email with your new password!'; } else $err[]='This username is already taken!'; } if(count($err)) { $_SESSION['msg']['reg-err'] = implode('<br />',$err); } header("Location: tester.php"); exit; } $script = ''; if($_SESSION['msg']) { // The script below shows the sliding panel on page load $script = ' <script type="text/javascript"> $(function(){ $("div#panel").show(); $("#toggle a").toggle(); }); </script>'; } ?> My Mail() funtions.php script Code: [Select] <?php function checkEmail($str) { return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str); } function send_mail($from,$to,$subject,$body) { $headers = ''; $headers .= "From: $from\n"; $headers .= "Reply-to: $from\n"; $headers .= "Return-Path: $from\n"; $headers .= "Message-ID: <" . md5(uniqid(time())) . "@" . $_SERVER['SERVER_NAME'] . ">\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Date: " . date('r', time()) . "\n"; mail($to,$subject,$body,$headers); } ?> Godaddys gdform.php Code: [Select] <?php $request_method = $_SERVER["REQUEST_METHOD"]; if($request_method == "GET") { $query_vars = $_GET; } elseif ($request_method == "POST") { $query_vars = $_POST; } reset($query_vars); $t = date("U"); $file = $_SERVER['DOCUMENT_ROOT'] . "\ssfm\gdform_" . $t; $fp = fopen($file,"w"); while (list ($key, $val) = each ($query_vars)) { fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\r\n"); fputs($fp,"$val\r\n"); fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\r\n"); if ($key == "redirect") { $landing_page = $val; } } fclose($fp); if ($landing_page != "") { header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page"); } else { header("Location: http://".$_SERVER["HTTP_HOST"]."/"); } ?> Just a basic email test gives me this error: Warning: mail() [function.mail]: Failed to connect to mailserver at "relay-hosting.secureserver.net" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\hosting\7746358\html\testmail.php on line 7 Mail Sent. mailtest.php Code: [Select] <?php $to = "someone@domain.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "noreply@mygodaddydomain.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=332575.0 i dont understand what is wrong plz help me.
here is code
$name = "img/".rand(1,9999999).".png"; $myFile = $name; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = $html; fwrite($fh, $stringData); fclose($fh); $file=$name; $fst=file_get_contents($file); $im=imagecreatefromstring($fst); imagefilter($im, IMG_FILTER_GRAYSCALE); imagefilter($im, IMG_FILTER_NEGATE); //Convert to Grey Scale for($i=0;$i<123;$i++){ for($j=0;$j<50;$j++){ $px=imagecolorat($im,$i,$j); if($px<0x303030){ imagesetpixel($im,$i,$j,0); }else{ imagesetpixel($im,$i,$j,0xffffff); } } } $database = unserialize(@file_get_contents("db.txt")); if($database === false) $database = array(); // modify the database if needed if($_SERVER['REQUEST_METHOD'] == 'POST'){ if($_POST['submit'] == 'Add') $database[$_POST['ident']] = substr($_POST['letter'], 0, 1); if($_POST['submit'] == 'Del') unset($database[$_POST['ident']]); if($fh = @fopen('db111.txt', 'w+')){ fwrite($fh, serialize($database)); fclose($fh); } }else{ $newimage = true; } $width = 130; $height = 40; $captcha_gridstart =1; $captcha_gridspace =2; $letters = findletters($im, $width, $height, $captcha_gridstart, $captcha_gridspace); $count = count($letters); $cellw = ($count > 0) ? intval(100 / $count) : 0; //dispeckle the image and GET co-ordinates of the characters of captcha image and return them. function findletters($image, $width, $height, $gridstart, $gridspace){ $offsets = array(); $o = 0; $atstartx = true; for($x = 0; $x < $width; $x++){ $blankx = true; for($y = 0; $y < $height; $y++){ if(imagecolorat($image, $x, $y) == 0){ $blankx = false; break; } } if(!$blankx && $atstartx){ $offsets[$o]['startx'] = $x; $atstartx = !$atstartx; }else if($blankx && !$atstartx){ $offsets[$o]['endx'] = $x; $atstartx = !$atstartx; $o++; } } $count = $o; for($o = 0; $o < $count; $o++){ for($y = 0; $y < $height; $y++){ $blanky = true; for($x = $offsets[$o]['startx']; $x < $offsets[$o]['endx']; $x++){ if(imagecolorat($image, $x, $y) == 0){ $blanky = false; break; } } if(!$blanky){ $offsets[$o]['starty'] = $y; break; } } for($y = $height-1; $y > $offsets[$o]['starty']; $y--){ $blanky = true; for($x = $offsets[$o]['startx']; $x < $offsets[$o]['endx']; $x++){ if(imagecolorat($image, $x, $y) == 0){ $blanky = false; break; } } if(!$blanky){ $offsets[$o]['endy'] = $y; break; } } } for($o = 0; $o < $count; $o++){ $offsets[$o]['ident'] = ""; for($x = $offsets[$o]['startx'] + $gridstart; $x < $offsets[$o]['endx']; $x += $gridspace){ for($y = $offsets[$o]['starty'] + $gridstart; $y < $offsets[$o]['endy']; $y += $gridspace){ $offsets[$o]['ident'] .= ((imagecolorat($image, $x, $y) == 0) ? "0" : "1"); #echo $offsets[$o]['ident'].'<br>'; } } } return $offsets; } $a=""; foreach($letters as $letter){ $asciiletter = $database[$letter['ident']]; if(!empty($asciiletter)) { $a.=$asciiletter; } } I try changing POST to GET in the script and I just get a blank page. How do you use a URL like... http-//www.domain.com/whois.php?domains=http://www.URL.info|Page Title to run the script? <? set_time_limit(0); if($_POST) { $domains = explode("\n", $_POST[domains]); foreach($domains as $domain) { $domain = explode('|', $domain); $keyword = $domain[1]; $domain = str_replace(array('http://','/'),'',$domain[0]); echo $keyword . $domain; unset($urls); $domainshort = str_replace('www.','',$domain); $domainshortdash = str_replace('.','-',$domainshort); $urls[] = 'http://www.webtrafficagents.com/Whois/' . $domain; $urls[] = 'http://whois.domaintools.com/' . $domainshort; $ch = curl_init(); foreach($urls as $url) { curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, 'http://www.google.com/'); $AskApache_result = curl_exec ($ch); $regex = '/<title>(.+?)<\/title>/'; preg_match($regex,$AskApache_result,$output); echo $output[1] . '<br>'; flush(); ob_flush(); curl_setopt ($ch, CURLOPT_URL, 'http://pingomatic.com/ping/?title=' . urlencode($keyword) . '&blogurl=' . urlencode($url) . '&rssurl=http%3A%2F%2F&chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogrolling=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_bloglines=on&chk_postrank=on&chk_skygrid=on&chk_bitacoras=on&chk_collecta=on'); $AskApache_result = curl_exec ($ch); if(preg_match('/Pinging complete!/', $AskApache_result)) { echo $url . ' - Successful Backlink!<br>'; } else { echo $url . ' - <b>Backlink Failed!</b><br>'; } flush(); ob_flush(); } } } else { ?> <form method="post"> Links|Anchors :<br> <textarea name="domains" cols=50 rows=5></textarea><br> <br> <input type="submit"> </table> </form> <? } ?> I've sent test to server and verified that email working. New with PHP so assuming my code is wrong.
Attached Files
contact.html 22.48KB
0 downloads
contact_script.php 3.5KB
3 downloads Hi I've been using jQuery to validate my forms but one of my clients is starting to receive blank emails as some idiots are just turning off JS to bypass the validation. I have therefore found a PHP script to act as a back up which is working exactly as I want. The only problem is that it forces all fields to be completed and I like to add certain fields that don't necessarily need to be completed such as a Company field. So my question is how could I modify this script to allow the company field or any other that I decide to be left blank? The basic page can be viewed here http://www.qwerty-demos.co.uk/contact/ And this is the script Code: [Select] <?php $after = "../thanks.html"; $oops = "../oops.html"; if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") { exit("<p>You did not press the submit button; this page should not be accessed directly.</p>"); } else { $exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i"; $profanity = "/(beastial|bestial|blowjob|clit|cock|cum|cunilingus|cunillingus|cunnilingus|cunt|ejaculate|fag|felatio|fellatio|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|orgasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i"; $spamwords = "/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|backgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i"; $bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i"; if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) { exit("<p>Known spam bots are not allowed.</p>"); } foreach ($_POST as $key => $value) { $value = trim($value); if (empty($value)) { if ($key != "email") { exit("<p>Please go back and complete the required fields.</p>"); } } elseif (preg_match($exploits, $value)) { exit("<p>Exploits/malicious scripting attributes aren't allowed.</p>"); } elseif (preg_match($profanity, $value) || preg_match($spamwords, $value)) { exit("<p>Please keep things clean, no naughty words!</p>"); } $_POST[$key] = stripslashes(strip_tags($value)); } if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,6})$",strtolower($_POST['email']))) { exit("<p>How can we reply if you don't provide us with a valid email address?</p>"); } $recipient = "my email address"; $subject = "Web Site Enquiry"; $message .= "Name: {$_POST['name']} \n"; $message .= "Email: {$_POST['email']} \n"; $message .= "Tel: {$_POST['telNo']} \n"; $message .= "Company: {$_POST['company']} \n"; $message .= "Message: {$_POST['message']} \n"; $headers .= "From: {$_POST['email']}"; if (mail($recipient,$subject,$message,$headers)) { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$after\">"; } else { echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=$oops\">"; } } ?> I have a new website which is using a php form send script for email enquiries. The old website was using a php script which worked fine but the new site has a problem with the script.
The builder of the site (who is currently on holidays and uncontactable) provided the form send script which sends a email to me notifying that someone has used the site to send an email but the email doesn't contain any information. I just get an email saying that an enquiry has been submitted through the site. No name, email or message.
Also the script doesn't send the person after they hit submit to the thank you for contacting us page it just provides a plain text message on a blank page. I have a thank you page set up but not sure what code needs to be used to send it to that page.
I am sure something like this is here somewhere but whilst I have a reasonably good knowledge of html I don't understand php at all and was wondering if someone could please help.
The script for the form send I have been given is
hi, I'm a newb. barely getting my feet wet in php after years of wanting to. I wrote this script following a youtube tutorial and it all made sense as I coded it.... so as far as I'm familiar with the little bit of coding, my script should work. actually it works. I get an email but with no data??? I can't get the script to gather the info and send it along with the email. not sure why as all seems in place.any help here would be greatly appreciated. thank you. here is the script... <?php /*subject and email variables */ $emailSubject = 'edson vehicle order form'; $webMaster = 'order@edsonvehicleremarketing.com'; /*gathering data variables*/ $modelyear = $_POST['modelyear']; $vehiclemake = $_POST['vehiclemake']; $vehiclemodel = $_POST['vehiclemodel']; $colors = $_POST['colors']; $notcolors = $_POST['notcolors']; $options = $_POST['options']; $descriptions = $_POST['descriptions']; $tradeinyear = $_POST['tradeinyear']; $tradeinmake = $_POST['tradeinmake']; $tradeinmodel = $_POST['tradeinmodel']; $miles = $_POST['miles']; $tradeincolor = $_POST['tradeincolor']; $conditionofcar = $_POST['conditionofcar']; $damage = $_POST['damage']; $lienholder = $_POST['lienholder']; $name = $_POST['name']; $homephone = $_POST['homephone']; $workphone = $_POST['workphone']; $cellphone = $_POST['cellphone']; $besttimetoreach = $_POST['besttimetoreach']; $bestwaytocontact = $_POST['bestwaytocontact']; $paymenttype = $_POST['paymenttype']; $howdidyoulocateus = $_POST['howdidyoulocateus']; $pickuptime = $_POST['pickuptime']; $comments = $_POST['comments']; $body - <<<EOD <br><hr><br> Model year: $modelyear <br> Vehicle make: $vehiclemake <br> Vehicle model: $vehiclemodel <br> Vehicle colors: $colors <br> Colors not considered: $notcolors <br> Options desired: $options <br> Descriptions: $descriptions <br> Trade in year: $tradeinyear <br> Trade in make: $tradeinmake <br> Trade in model: $tradeinmodel <br> miles: $miles <br> Trade in color: $tradeincolor <br> Condition of car: $conditionofcar <br> Damage: $damage <br> Lienholder: $lienholder <br> Name: $name <br> Home phone: $homephone <br> Work phone: $workphone <br> Cell phone: $cellphone <br> Best time to reach: $besttimetoreach <br> Best way to contact: $bestwaytocontact <br> Payment type: $paymenttype <br> How did you locate us: $howdidyoulocateus <br> Pick up time: $pickuptime <br> Comments: $comments <br> EOD; $headers = "From $name\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headrers); /* results rendered as html */ $theResults = <<<EOD <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Edson Vehicle Remarketing</title> <style type="text/css"> body { background-color: #000; background-image: url(); background-repeat: repeat-x; margin-bottom: 0px; } .orderform { left: auto; right: auto; margin-top: 25px; } #htmlforphp { width: auto; height: 300px; text-align: center; padding-top: 250px; padding-right: 50px; font-size: 20px; } </style> <link href="css/layout.css" rel="stylesheet" type="text/css" /> <style type="text/css"> a:link { text-decoration: none; color: #000; } a:visited { text-decoration: none; color: #000; } a:hover { text-decoration: none; color: #333; } a:active { text-decoration: none; color: #666; } #wrapper #bodyArea .orderform { padding-left: 100px; padding-right: 100px; position: relative; color: #999; } </style> </head> <body> <div id="wrapper"> <div id="logo"><img src="images/banner.gif" width="800" height="110" alt="edson vehicle remarketing" /></div> <div id="navigation"><strong><a href="index.html">HOME</a> | <a href="inventory.html">INVENTORY</a> | <a href="financing.php">FINANCING</a> | <a href="orderform.html">ORDER FORM</a> | <a href="directions.html">DIRECTIONS</a> | <a href="contactus.html">CONTACT US</a></strong></div> <div id="bodyArea"> <div id="htmlforphp">Thank you for your interest.<br />Edson vehicle remarketinng will find you the best car possible!</div> </div> <div id="footer"><a href="index.html">home</a> | <a href="inventory.html">inventory</a> | <a href="financing.php">financing</a> | <a href="orderform.html">order form</a> | <a href="directions.html">directions</a> | <a href="contactus.html">contact us</a></div> </div> </body> </html> EOD; echo "$theResults"; ?> Code: [Select] <!-- The Input Form --> <form action="changemail_script.php" method="POST" > <input type="text" name="new_email" /> <input type="submit" name="submit_new_email" value="Submit" /> </form> When I have it as above, and I click submit, then the form loads the script itself and since the database connection variables are included into the header it will not work anymore. Any ideas why it does that? Should rather just include the script file and simply leave the action field empty, or do you have a better suggestion? Hi everyone, I have created a HTML form for collecting data on a web page, ie, name, email address, etc, which works fine. I have then asked for that data to be emailed to me using the POST action in conjunction with a PHP script called "carparkprocess2.php". At the moment, the form works OK on the web page, the confirmation message to say the data has been submitted successfully works OK, but the email that should display the information entered into the form doesn't work properly. It comes through and is formatted OK, but the form information is missing. I've been trying to resolve this issue for 2 days straight now and have tried loads of different things! Can anybody help? I need a quick answer on this one if possible Code: [Select] <?php error_reporting(E_ALL ^ E_NOTICE); // Prints all errors except Notices. /* Subject and Email Variables */ $emailSubject = 'Car Park Reservation Confirmation'; $webMaster = 'ben@maver.co.uk'; /* Gathering Data Variables */ if (!isset($_POST['name'])) { $_POST['name'] = "name"; } if (!isset($_POST['carregistration'])) { $_POST['carregistration'] = "carregistration"; } if (!isset($_POST['emailaddress'])) { $_POST['emailaddress'] = "emailaddress"; } if (!isset($_POST['numberinparty'])) { $_POST['numberinparty'] = "numberinparty"; } $body = <<<EOD <br><hr><br> Name: $name <br> Vehicle Registration: $carregistration <br> Email Address: $emailaddress <br> Number in Party: $numberinparty <br> EOD; $mailheaders .= "From: $emailaddress\r\n"; $headers .= "Content-type: text/html"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <title>Car Park Reservation Confirmation</title> <meta http-equiv='Content-Type' content='text/html'> <style type='text/css'> <!-- body { min-height: 100%; height: auto; background: #000000; color: #ffffff; font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; margin: 0; } --> </style> </head> <div> <div align='left'>Your car park reservation request has been successful</div> </div> </body> </html> EOD; echo "$theResults"; ?> Here is the HTML within the form: Code: [Select] <form method='post' action='carparkprocess2.php'> Hello Everybody! From all the PHP forums, this seems to be the best one, since I find the words 'freaks' and 'addicted' everywhere, so I give it a shot for the first time Yesterday I've been struggling with a piece of code all day, which got me really frustrated. I'm a bit of a noob yet, but usually Iget quite far with a bit of googling. Not this time... I have a code and I want to be able to sort and filter the code with a form (It's for a portfolio). I know it has a lot to do with XXXX, but I can't get it working. Do I have to use a double array instead? (tried that also, but then I have to find a way to get the paging back...) Can someone help me out a bit maybe? I would be very very graceful! Here is the code I'm using: The index.php Code: [Select] <?php $page_comments = 2; //number of comments per page /* DEZE HIERONDER KAN MISSCHIEN WEG?? */ $page = 0; $page = (int)$_GET['p']; ?> <!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> <title>Sort/filter form</title> <style type="text/css"> <!-- div.gbsign{color:#F00;} .gbname{font-weight:bold;color:#FC0;} .gbdate{margin-left:30px;color:#F0C;} p.gbmessage{margin-top:-12px;color:#FCC;} p.extra_p{margin-top:-12px;color:#0F0;} p.extra2_p{margin-top:-12px;color:#00F;} --> </style> </head> <body> <form method=get style="display: inline;" name=''> <select name=orderby onChange=""> <option value='relevance'>Relevance</option> <option value='year'>Year</option> <option value='title_asc'>Title (A - Z)</option> <option value='title_desc'>Title (Z - A)</option><BR /> </select> <input type="checkbox">Film</input> <input type="checkbox">TV</input> <input type="checkbox">Fiction</input> <input type="checkbox">Documentary / Reality</input> <input type="checkbox">Commercial</input> <input type="checkbox">In Opdracht</input> </form> <?php $gbfile = 'gbcontentfile.php'; $fh = @fopen($gbfile, "r"); $fcontent = @fread($fh, filesize($gbfile)); if($fcontent){ $cnt = substr_count($fcontent,'<?php /* '); $cnt = $cnt/2; $maxp = 0; if($cnt>$page_comments)$maxp = (int)($cnt/$page_comments); preg_match_all("/\<\?php .*? \?\>(.*?)\<\?php .*? \?\>/is", $fcontent, $entries); $ini = $page*$page_comments; $end = ($page+1)*$page_comments; $ovo = array('<1>','<2>','<3>','<4>','<5>','<6>','<7>'); $sovim = array( "<div class=\"gbsign\"> <p><span class=\"gbname\">", "</span> <span class=\"gbdate\">", "</span> </p> <p class=\"gbmessage\">", "</p> <p class=\"extra_p\">", "</p> <p class=\"extra2_p\">", "</p> <p class=\"extra2_p\">", "</p> <p class=\"extra2_p\">", " </p> </div> " ); for($j=$ini;$j<$end;$j++)echo str_replace($ovo,$sovim,$entries[1][$j]); if($maxp>-1){ echo '<p>'.strstr($fcontent,'<!--').' Pagina '; $gap = ""; for($j=0;$j<$maxp+1;$j++){ if($j==0||$j==$maxp||($j-$page)*($j-$page)<26){ echo $gap; $gap = ""; if($j!=$page)echo "- <a href=\"?p=".$j.$si."\">".($j+1)."</a> " ; /* HIER KOMT NORMAALGESPROKEN (VOOR HET VRAAGTEKEN) DE BESTANDSNAAM VAN DIT DOCUMENT (nu niet ivm index) */ else echo "- <b>".($j+1)."</b> " ; } else $gap = "<b>.....</b>"; } echo '</p>'; } } ?> </body> </html> This is the 'database' gbcontentfile.php with the info: Code: [Select] <?php /* ARTICLE START */ ?><1>TV<2>Fiction<3>ATitle1<4>1<5>Small Example text<6>THE text<7>extra option<?php /* ARTICLE END */ ?> <?php /* ARTICLE START */ ?><1>Film<2>Fiction<3>BTitle2<4>3<5>Small Example text<6>THE text<7>extra option<?php /* ARTICLE END */ ?> <?php /* ARTICLE START */ ?><1>TV<2>Reality<3>CTitle3<4>2<5>Small Example text<6>THE text<7>extra option<?php /* ARTICLE END */ ?> I hope that someone can help me out. I found this already, but I can not get the two combined: Code: [Select] <?PHP $data = array( array("firstname" => "Mary", "lastname" => "Johnson", "age" => 25), array("firstname" => "Amanda", "lastname" => "Miller", "age" => 18), array("firstname" => "James", "lastname" => "Brown", "age" => 31), array("firstname" => "Patricia", "lastname" => "Williams", "age" => 7), array("firstname" => "Michael", "lastname" => "Davis", "age" => 43), array("firstname" => "Sarah", "lastname" => "Miller", "age" => 24), array("firstname" => "Patrick", "lastname" => "Miller", "age" => 27) ); ?> <?PHP function orderBy($data, $field) { $code = "return strnatcmp(\$a['$field'], \$b['$field']);"; usort($data, create_function('$a,$b', $code)); return $data; } $data = orderBy($data, 'age'); ?> Thanks in advance!! Sander |