Jump to content

tinwakr

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tinwakr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Everyone, I have been approached by my local union office to write a web based union membership application, it is an app that will keep records of membership dues, member information, benefit payments, etc., etc., can someone recommend a good book to purchase that teaches the dos and don'ts/ins and outs of creating large scale PHP/MySQL web applications? Thanks in advance for all replies. Chuck
  2. Hi PFMaBiSmAd, Did that, still didn't work. Thanks, Chuck
  3. Hi Everyone, I am trying to send email with the mail() function as per instructions at: http://php.net/manual/en/function.mail.php without success. The mail sends but when it arrives it doesn't render properly, I see all of the html tags with the data that's sent. My code is below: <?php function processFormData($array, $form) { $errors = NULL; $message = NULL; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = "From: <chuck@deneb-consulting.com>" . "\r\n"; $headers .="Cc: <tinwakr@bell.net>" . "\r\n"; $headers .= "Reply-to: <chuck@deneb-consulting.com>" . "\r\n"; $headers .= "X-Mailer: PHP/" .phpversion() . "\r\n"; foreach($array as $key => $value) { //if any of the form values are empty catch them and add to error array if(empty($value) && $key != 'submit') { //build error list $errors .= '"' . str_replace('_', ' ', $key) . '" is a required field!<br />'; } else if(!empty($value) && $key != 'submit') { //capture values and insert them into a session variable $_SESSION[$key] = $value; } } if(empty($errors)) { $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\r\n"; $message .= '<html><head><title>' . $form .'</title></head>' . "\r\n" . '<body><table border="1">' . "\r\n"; foreach($array as $key => $value) { //regular expression check for phone number if(str_replace('_', ' ', $key) == 'Phone Number' && !preg_match("/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i", $value)) { return 'Please enter a valid phone number!'; } //regular expression check for email if(str_replace('_', ' ', $key) == 'Email Address' && !preg_match("/^[A-Z0-9._%-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i", $value)) { return 'Please enter a valid email address!'; } if($key != 'submit') { $message .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>' . "\r\n"; } } $message .= '</table></body></html>' . "\r\n"; mail("chuck@deneb-consulting.com", $form, str_replace("_", " ", $message), $headers); return 'Thank you, someone will contact you shortly.'; } else { return $errors; } } ?> Thanks in advance for all replies, Chuck
  4. Hi Everyone, I found out it seems Godaddy is trying to force their customers to use their web form mailer scripts which collect messages and sends them out in timed intervals. I called them and they wouldn't help me with the mail function and all they said was they don't support 3rd party scripting and to use their scripts..............OR.......... PURCHASE DEDICATED HOSTING at an additional cost of $30.00/mth!!!! I reconfigured my form/function to use my GoDaddy email address with my contact form using the mail() function and it now works, strange? NOT! I did some research into this and it seems that GoDaddy is preventing their users from using the mail function, unless it goes to a GoDaddy email address. There are quite a few GoDaddy customers with this issue, worked for a bit then stopped working with similar calls to technical support with similar responses. I was told by the tech support guy that they do support PEAR Mail, I guess I will have to figure that one out but for the time being sending the form data to my GoDaddy email account then retrieving it from within Outlook will do for now or as long as GoDaddy allows it! Thanks to all for replies, Chuck
  5. Thanks for the reply. I put at the top of the webpage in question the following: <?php mail('myemail@address.com', 'email subject', 'email message'); ?> When the page loads it should send the email, it doesn't. any other suggestions? Thanks, Chuck
  6. Hi Everyone, Please have a look at the code below the first set is from my contact form and the second is the function, it is a function that is passed a form variable in the form of an array and is also passed a form title variable. Everything worked fine this morning but when I checked the functionality of it a few hours ago the mail function wasn't sending, although the logic was working. I checked my spam filter and the emails weren't held up there. require('../php_classes/TrueViewI.php'); include('../php_functions/functions.php'); if(isset($_POST['submit'])) { $error_message = processFormData($_POST, 'Home Inspections'); if($error_message == 'Thank you, someone will contact you shortly.') { session_unset(); } } //future $keywords = ''; //future $meta_tags = ''; //future $left_column = ''; $middle_column = '<img class="page_heading" src="../images/contactus.png" alt="True View Service Home Inspections Contact Us" /> <form method="post" action=""> <fieldset id="contactform"> <!-- <legend>Home Inspections Contact Form</legend> --> <h4>Home Inspections Contact Form</h4> <span class="errors">'.(!empty($error_message) ? $error_message : '').'</span> <div class="row_div"> <div class="label_div"> <label>First Name:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="First Name" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['First_Name']) ? $_SESSION['First_Name'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Last Name:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Last Name" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Last_Name']) ? $_SESSION['Last_Name'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Phone Number:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Phone Number" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Phone_Number']) ? $_SESSION['Phone_Number'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Email Address:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Email Address" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Email_Address']) ? $_SESSION['Email_Address'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Renovation Address:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Renovation Address" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Renovation_Address']) ? $_SESSION['Renovation_Address'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Age of Home:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Age Of Home" class="input"> <option value="">--Choose One--</option> <option value="0-10"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '0-10')) ? ' selected="selected" ' : ''). '>0 to 10 years old</option> <option value="11-20"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '11-20')) ? ' selected="selected" ' : ''). '>11 to 20 years old</option> <option value="21-30"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '21-30')) ? ' selected="selected" ' : ''). '>21 to 30 years old</option> <option value="31-40"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '31-40')) ? ' selected="selected" ' : ''). '>31 to 40 years old</option> <option value="41-50"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '41-50')) ? ' selected="selected" ' : ''). '>41 to 50 years old</option> <option value="50+"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '50+')) ? ' selected="selected" ' : ''). '>More than 50 years old</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Square Footage of Home:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Square Footage Of Home" class="input"> <option value="">--Choose One--</option> <option value="1000-1500"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '1000-1500')) ? ' selected="selected" ' : ''). '>1000 to 1500 square feet</option> <option value="1501-2000"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '1501-2000')) ? ' selected="selected" ' : ''). '>1501 to 2000 square feet</option> <option value="2001-2500"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '2001-2500')) ? ' selected="selected" ' : ''). '>2001 to 2500 square feet</option> <option value="2501-3000"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '2501-3000')) ? ' selected="selected" ' : ''). '>2501 to 3000 square feet</option> <option value="3000+"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '3000+')) ? ' selected="selected" ' : ''). '>More than 3000 square feet</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Are you buying or selling?:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Buying Or Selling" class="input"> <option value="">--Choose One--</option> <option value="Buying"'.((!empty($_SESSION['Buying_Or_Selling']) && ($_SESSION['Buying_Or_Selling'] == 'Buying')) ? ' selected="selected" ' : '').'>Buying</option> <option value="Selling"'.((!empty($_SESSION['Buying_Or_Selling']) && ($_SESSION['Buying_Or_Selling'] == 'Selling')) ? ' selected="selected" ' : '').'>Selling</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Preferred Date and Time for Inspection:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Preferred Date and Time for Inspection" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Preferred_Date_and_Time_for_Inspection']) ? $_SESSION['Preferred_Date_and_Time_for_Inspection'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Comments or Questions:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <textarea name="Comments or Questions" type="text" rows="10">'. (!empty($_SESSION['Comments_or_Questions']) ? $_SESSION['Comments_or_Questions'] : '').'</textarea> </div> </div> <div class="row_div"> <input id="button" name="submit" type="submit" value="Send Message" /> </div> </fieldset> </form>'; $contact = new TrueViewI('True View Services Inspections - Contact Us', '../css/styles.css', NULL, NULL, 7, 1, 1); $contact->setContent('middle_col_content', $middle_column); $contact->display_page(); function processFormData($array, $form) { $errors = NULL; $message = NULL; foreach($array as $key => $value) { //if any of the form values are empty catch them and add to error array if(empty($value) && $key != 'submit') { //build error list $errors .= '"' . str_replace('_', ' ', $key) . '" is a required field!<br />'; } else if(!empty($value) && $key != 'submit') { //capture values and insert them into a session variable $_SESSION[$key] = $value; } } if(empty($errors)) { mail('tinwakr@bell.net', $form, str_replace('_', ' ', $message)); return 'Thank you, someone will contact you shortly.'; } else { return $errors; } }
  7. Much cleaner scootstah but I had to try and do it myself in a way that I understand, if I just use someone's code and I don't understand it I will never learn. Thanks buddy for all your help I really appreciate it. Chuck
  8. Thanks to everyone who replied, I got it working like this: $middle_column = '<form method="post" action=""> <fieldset id="contactform"> <legend>Renovations & Consultations</legend><span id=errors>'. $error_message .'</span><div class="row_div"> <div class="label_div"> <label>First Name:</label> </div> <div class="input_div">'; if(!empty($_SESSION['First_Name'])) { $middle_column .= '<input name="First Name" type="text" maxlength="50" size="50" value="'.$_SESSION['First_Name'].'" />'; } else { $middle_column .= '<input name="First Name" type="text" maxlength="50" size="50" />'; } $middle_column .= '</div> </div> </fieldset> </form>'; I had to do it this way and not use an echo statement because I was passing this string variable to the object(class) so I had to concatenate it to the variable. Thanks again everyone! Chuck
  9. Hi Everyone, I have built a website utilizing a PHP abstract Webpage class to create the pages. When creating another class that inherits from Webpage class I rewrite abstract functions, etc. where needed. When instantiating an object of the extended classes I pass the constructor the $page_title, $css_file, $meta_data, $keywords, etc., etc.. I am able to pass html markup in a string variable to a class level "Setter" function to populate a "main area" of the website and all works perfectly. However, I have a contact form which I send the "Submit Message" button click to a PHP function that takes care of making sure the form fields are not empty, then sends email and returns a success message back to the calling page, if they are empty, the function returns what fields are empty(required). If the page includes empty and populated fields I want to put the populated fields into session variables so that I may populate the fields when the user is taken back to the page and display to the user the required fields that were empty(this functionality is already within the function). This brings me to my question(see code below for reference): Seeing that I am populating a variable with a string it seems I cannot use an if statement, echo or the like, my IDE gives me errors. How may I insert an if statement where needed to populate the empty form fields? include('../php_functions/functions.php');//for the chechData() function $error_message = NULL; if(isset($_POST['submit'])) { $error_message = checkData($_POST, 'Renovation & Consulting'); } $main_content = '<form method="post" action=""> <fieldset id="contactform"> <legend>Renovations & Consultations</legend>'. [color=red]//placing a variable here works fine![/color] $error_message .'<div class="row_div"> <div class="label_div"> <label>First Name:</label> </div> <div class="input_div"> <input name="First Name" type="text" maxlength="50" size="50" value="'.[color=red]if(session variable not empty) echo it here;.'"[/color] /> </div> </div> <div class="row_div"> <input name="submit" type="submit" value="Send Message" /> </div> </fieldset> </form>'; Thanks for any and all responses. Chuck
  10. So, I can still use it as if it weren't encrypted: <?php require("name of encrypted file here"); class NewPage extends Class { //write code here } $newPage->displayPg(); ?> Without needing to install any modules or any other software on the server? Thanks, Chuck
  11. In doing research into ioncube I couldn't find anything that told me how to use the file after encryption. Are you presently using something like this ManiacDan? Thanks, Chuck
  12. Thanks for the fast reply ManiacDan. I am creating an WebPage class that I am going to use to design websites, I will have to include this file when I give the completed site to customers and I do not want them to be able to modify the PHP code in the original class file. If they wanted to they could create additional pages. Chuck
  13. Hi Everyone, Is there any way to "hide" or encrypt PHP code and allow usage after doing so as if it were the actual php file? What I would like to do is be able to access a PHP class file like an ASP.Net dll file. I have been reading some documentation on various PHP obfuscating/encryption techniques and it seems pretty complicated, and some need to install modules on the server in which most hosting companies won't. Is there an easier way to do something like this, if there is a way at all? Thanks in advance for any and all information. Chuck
  14. Thanks scootstah you've been a great help. I see you are a regular contributor here, keep up the good work!!! Chuck
×
×
  • 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.