Jump to content

DasHaas

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

About DasHaas

  • Birthday 12/29/1978

Profile Information

  • Gender
    Male
  • Location
    Sunrise, FL

DasHaas's Achievements

Member

Member (2/5)

0

Reputation

  1. I cannot seem to send the from header to change the recipient. Im not sure if it has anything to do with the host settings but it just displays the domain name as the sender. Here are my current headers $to = "a@2.com"; $subject = 'ABD website contact message'; $body = "$new_msg"; //HTML mail headers $headers .= 'MIME-Version: 1.0'.$eol; $headers .= 'Content-type: text/html; charset=iso-8859-1' .$eol; //Other headers $headers .= 'From: John Doe <4@5.com>'.$eol; $headers .= "Reply-To:".$name."<".$email.">".$eol; $headers .= "CC: 2@3.com".$eol;
  2. Im fairly new to php but I am able to write scripts and I can decipher advanced php scripts. There is one area that is pretty vague to me, email headers. Can someone please help me understand what the non obvious headers do Reply-to, CC and BCC are pretty self explanatory but I have seen others that Im hoping could help a problem im having with php mail. My problem is that some hosts (bellsouth.net) immediatly reject my emails, they don't even go into the spam folder, just nothing. Im hoping some of the advanced headers can help me with this.
  3. those variables are set in the include file, sorry I forgot to note that
  4. Hello all, I have a mail script that I am currently using and for the most part it seems to work well. In a nutshell it grabs the email addys from a MYSQL table and emails all the recipients...so I thought. My two personal emails are in the table (gmail & bellsouth.net) I get the emails with my gmail account but nothing in my bellsouth.net account. I looked in the spam folder and nothing. I wonder how many people in my table are not getting my emails? Can anyone help shed some light on this as well as some pointers to optimize my script. here is my script, I omitted the connection for its not really necessary. <?php // includes include('includes/PXS_Conf.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server!'); // select database mysql_select_db($db) or die ('Unable to select database!'); $sql_state = mysql_query("SELECT state FROM PXS_Newsletter WHERE verified = 1 GROUP BY state") or die (mysql_error()); $sql_gender = mysql_query("SELECT gender FROM PXS_Newsletter WHERE verified = 1 GROUP BY gender") or die (mysql_error()); // form not yet submitted // display initial form if (!$_POST['submit']) { ?> <table cellpadding="5" cellspacing="5" class="table1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <tr> <td valign="top" class="text5">Subject</td> <td><input name="txtsubject" type="text" class="table2" id="txtsubject" size="50" maxlength="250"></td> </tr> <tr> <td valign="top" class="text5">Email Body</td> <td valign="top" class="text5"><textarea name="txtbody" cols="47" rows="10" class="table2" id="txtbody"></textarea></td> </tr> <tr> <td colspan="2" valign="top" class="text5"><input name="submit" type="submit" id="submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </form> </table> <?php } else { // set up error list array $errorList = array(); $msgsubject = $_POST['txtsubject']; $msgbody = $_POST['txtbody']; $state = trim($_POST['ssl_state']); $gender = trim($_POST['ssl_gender']); // validate text input fields if (trim($_POST['txtsubject']) == '') {$errorList[] = 'Invalid entry: Message Subject';} if (trim($_POST['txtbody']) == '') {$errorList[] = "Invalid entry: Message Body";} // check for errors // if none found... if (sizeof($errorList) == 0) { // generate and execute query $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE verified = 1") or die (mysql_error()); while($row = mysql_fetch_row($query)){ $email = $row[0]; // send email $headers = "Reply-To:".$fromname."<".$fromaddress.">".$eol; mail($email, $msgsubject, $msgbody, $headers);} // print result echo '<center><span class="text6">Message sent!</span></center>'; // close database connection mysql_close($connection); } else { // errors found // print as list echo 'The following errors were encountered:'; echo '<br>'; echo '<ul>'; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo '</ul>'; } } ?>
  5. Im able to populate the list menu with the unique values, its sending the emails to the selected groups that im having a problem with.
  6. I have a form that emails all the subscribers in my MYSQL database. I would like to be able to filter the people I contact i.e. all males in FL, etc. That part I have down but when I start looking at all the possible combinations I get a little lost. Here is my code as you can see my sql statement is looking for a values in the where clauses, what should the value be if I select the all states or all genders options, or a combination of both (all females in CO)? Im thinking that I have to write a sql query for every possible combination but there has to be an easier way especially if I add more filters like city, country, etc. <?php // includes include('includes/PXS_Conf.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server.'); // select database mysql_select_db($db) or die ('Unable to select database.'); $sql_state = mysql_query("SELECT state FROM PXS_Newsletter WHERE verified = 1 GROUP BY state") or die (mysql_error()); $sql_gender = mysql_query("SELECT gender FROM PXS_Newsletter WHERE verified = 1 GROUP BY gender") or die (mysql_error()); // form not yet submitted // display initial form if (!$_POST['submit']) { ?> <table cellpadding="5" cellspacing="5" class="table1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <tr> <td valign="top" class="text5">State</td> <td> <?php echo "<select name='ssl_state'>"; echo "<option value='0' selected>Please select a state</option>"; echo "<option value='1'>Select all states</option>"; if(mysql_num_rows($sql_state)) { while($row = mysql_fetch_assoc($sql_state)) { echo "<option value = '$row[state]'>$row[state]</option>"; } } else { echo "<option>No states present</option>"; } ?> </td> </tr> <tr> <td valign="top" class="text5">Gender</td> <td> <?php echo "<select name='ssl_gender'>"; echo "<option value='0' selected>Please select a gender</option>"; echo "<option value='1'>Select all genders</option>"; if(mysql_num_rows($sql_gender)) { while($row = mysql_fetch_assoc($sql_gender)) { echo "<option value = '$row[gender]'>$row[gender]</option>"; } } else { echo "<option>No genders present</option>"; } ?> </td> <tr> <tr> <td valign="top" class="text5">Subject</td> <td><input name="txtsubject" type="text" class="table2" id="txtsubject" size="50" maxlength="250"></td> </tr> <tr> <td valign="top" class="text5">Email Body</td> <td valign="top" class="text5"><textarea name="txtbody" cols="47" rows="10" class="table2" id="txtbody"></textarea></td> </tr> <tr> <td colspan="2" valign="top" class="text5"><input name="submit" type="submit" id="submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td> </tr> </form> </table> <?php } else { // set up error list array $errorList = array(); $msgsubject = $_POST['txtsubject']; $msgbody = $_POST['txtbody']; $state = trim($_POST['ssl_state']); $gender = trim($_POST['ssl_gender']); // validate text input fields if (trim($_POST['txtsubject']) == '') {$errorList[] = 'Invalid entry: Message Subject';} if (trim($_POST['txtbody']) == '') {$errorList[] = "Invalid entry: Message Body";} if ($_POST['ssl_state'] == '0') {$errorList[] = "Please select a state";} if ($_POST['ssl_gender'] == '0') {$errorList[] = "Please select a gender";} // check for errors // if none found... if (sizeof($errorList) == 0) { // generate and execute query $query = mysql_query("SELECT email FROM PXS_Newsletter WHERE state = $state AND gender = $gender AND verified = 1") or die (mysql_error()); while($row = mysql_fetch_row($query)){ $email = $row[0]; // send email $headers = "Reply-To:".$fromname."<".$fromaddress.">".$eol; mail($email, $msgsubject, $msgbody, $headers);} // print result echo '<center><span class="text6">Message sent!</span></center>'; Thanks in advance, any help would be greatly appreciated
  7. thanks a million for all your help, your a life saver!!
  8. thanks, that worked. Why would I need to do that on this server, but other servers can process everything in one page?
  9. here is what i get when i submit the form that edits the record in the table.
  10. sorry the error is "Server cannot be found" I have used this script with other hosts and it has worked like a champ. the only difference with this host is that i had to use localhost instead of mysql.server.com
  11. thanks, im stumped. i gave the login full rights to the table but i can only delete and view data not add or edit. any suggestions?
  12. is this the best/only way to connect to a mysql db? $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server!');
  13. i use the same id/pw that gets me into phpMyAdmin in my script. the following script populates the text fields with the table data but when i make a change and submit the for after a second or so I get the "page cannot be found" error. <html> <head> <link href="css/StyleSheet1.css" rel="stylesheet" type="text/css"> <body> <!-- standard page header begins --> <table width="100%" class="table1"> <tr> <td><div align="center" class="text2">EDIT NEWS ARTICLE</div></td> </tr> </table> <br> <!-- standard page header ends --> <?php // includes include('includes/PXS_Conf.php'); include('includes/PXS_Functions.php'); // form not yet submitted // display initial form with values pre-filled if (!$_POST['submit']) { // check for record ID if ((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing record ID!'); } // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to MySql server!'); // select database mysql_select_db($db) or die ('Unable to select database!'); // generate and execute query $id = $_GET['id']; $query = "SELECT Title, Content FROM PXS_News WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // if a result is returned if (mysql_num_rows($result) > 0) { // turn it into an object $row = mysql_fetch_object($result); // print form with values pre-filled ?> <table cellpadding="5" cellspacing="5" class="table1"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="hidden" name="id" value="<?php echo $id; ?>"> <tr> <td valign="top"><b class="text5">Title</b></td> <td> <input name="Title" type="text" class="table2" id="Title" value="<?php echo $row->Title; ?>" size="50" maxlength="250"> </td> </tr> <tr> <td valign="top"><b class="text5">Content</b></td> <td> <textarea name="Content" cols="47" rows="10" class="table2" id="Content"><?php echo $row->Content; ?></textarea> </td> </tr> <tr> <td colspan=2> <input type="Submit" name="submit" value="Update"> </td> </tr> </form> </table> <?php } // no result returned // print graceful error message else { echo 'That news article could not be located in the database'; } } // form submitted // start processing it else { // set up error list array $errorList = array(); $title = ucfirst($_POST['Title']); $content = ucfirst($_POST['Content']); $id = $_POST['id']; // check for record ID if ((!isset($_POST['id']) || trim($_POST['id']) == '')) { die ('Missing record ID!'); } // validate text input fields if (trim($_POST['Title']) == '') { $errorList[] = 'Please enter an article title'; } if (trim($_POST['Content']) == '') { $errorList[] = "Please enter article content"; } // check for errors // if none found... if (sizeof($errorList) == 0) { // generate and execute query $query = "UPDATE PXS_News SET Title = '$title', Content = '$Content' WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // close database connection mysql_close($connection); // print result echo '<center><a href=PXS_ListNews.php>Update successful click here to go back to the article list</a></center>'; } else { // errors occurred // print as list echo 'The following errors were encountered:'; echo '<br>'; echo '<ul>'; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo '</ul>'; } } ?> <!-- standard page footer begins --> <br> <table width="100%" class="table1"> <tr> <td><div align="center" class="text1"><font size="2">Copyright © 2006 All Rights Reserved </font></div></td> </tr> </table> <!-- standard page footer ends --> </body> </html>
  14. Im working on a database hosted by ipowerweb and I am having problems interacting with the database. I can view the data in the tables, delete the data, but I cant edit the data or add new data from my php form. I have used this script on other servers and it has worked like a champ. I called the host's tech support line and after 20 minutes of waiting they are saying its my script that has the problem. Im not an expert php programmer but this script works fine on my site that is hosted by another company. I gave the login im using full access to the database, but I still cant edit or add data to the table. Any suggestions?? :'(
×
×
  • 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.