Jump to content

unknown1

Members
  • Posts

    128
  • Joined

  • Last visited

Everything posted by unknown1

  1. Now I have a new issue... After the 3rd message gets send the script stops and give me an 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() Any ideas? or is this a server issue that limits to amount of emails sent out... if so how to I set a limit so it only sends out so many messages at a time or within a certain time frame or something.
  2. Below is the current script and it is only sending the message to the last email in the database and skips the rest... <?php session_start(); //allow sessions include("config.php"); //get database information if(!$_POST[send]){ //if the form was not submitted echo "<form action='' method='post' > <table width='600' border='0' cellspacing='0' cellpadding='0' align='left'> <tr> <td height='35' colspan='2' align='left'><b>Send a email to all users</b></td> </tr> <tr> <td height='35' align='left'><b>Subject:</b></td> <td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td> </tr> <tr> <td width='85' height='150' align='left' valign='top'><b>Message:</b></td> <td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td> </tr> <tr> <td height='35'> </td> <td><input type='submit' name='send' id='send' value='Send' /></td> </tr> </table> </form>"; //return with the form }else{ //or if it was $supportEmail = 'support@mysite.com'; $title = strip_tags(htmlspecialchars($_POST[title])); $date = date("F j, Y, g:i a"); $values = array(); $message = stripslashes($_POST[msg]); //message $getusers = mysql_query("SELECT * FROM user"); $getemail = "SELECT email FROM user"; $result = mysql_query($getemail); $to=$row['email']; $link="<a href=\"http://mysite.com/contact.php\">Click here</a>"; if(empty($message)){ echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!"; }else{ while ($row = mysql_fetch_array($result)){ $email = $row['email']; //send email } $body = <<<EOD <br><hr><br> =============================== <br> <br> Subject: $title <br> Message: $message <br><br> This message has been sent by My Site. Do not reply to this email. $link to contact support. <br> =============================== <br><br> EOD; $headers = "From: $supportEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $send_contact = mail($email,$title,$body,$headers); // Check, if message sent to your email if($send_contact){ echo "<script language='javascript'> alert('Your site wide email has been sent.'); window.location.href = 'http://mysite.com/x9y6uw5e8_/admin_panel.php?page=mass_email'; </script>"; } } //end check for empty message } //end form check ?> it only sends to one email because you keep overwriting the $email variable. Did you read my post. you should either store each email in an array, and use a foreach to loop through each email, and email each person, or concatenate each email to one to string. while($row = mysql_fetch_array($query)){ $email = $row['email']; send = mail($email,$title,$body,$headers); } obviously you would have to define the headers and body and stuff before you send them email No I didn't see that... Thanks!!
  3. Even tried something like $values = array(); while ($row = mysql_fetch_array($result)){ $email = $row['email']; $values[] = "('{$email}')"; } But still message gets sent to the last email in the database ONLY and skips the rest.
  4. Below is the current script and it is only sending the message to the last email in the database and skips the rest... <?php session_start(); //allow sessions include("config.php"); //get database information if(!$_POST[send]){ //if the form was not submitted echo "<form action='' method='post' > <table width='600' border='0' cellspacing='0' cellpadding='0' align='left'> <tr> <td height='35' colspan='2' align='left'><b>Send a email to all users</b></td> </tr> <tr> <td height='35' align='left'><b>Subject:</b></td> <td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td> </tr> <tr> <td width='85' height='150' align='left' valign='top'><b>Message:</b></td> <td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td> </tr> <tr> <td height='35'> </td> <td><input type='submit' name='send' id='send' value='Send' /></td> </tr> </table> </form>"; //return with the form }else{ //or if it was $supportEmail = 'support@mysite.com'; $title = strip_tags(htmlspecialchars($_POST[title])); $date = date("F j, Y, g:i a"); $values = array(); $message = stripslashes($_POST[msg]); //message $getusers = mysql_query("SELECT * FROM user"); $getemail = "SELECT email FROM user"; $result = mysql_query($getemail); $to=$row['email']; $link="<a href=\"http://mysite.com/contact.php\">Click here</a>"; if(empty($message)){ echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!"; }else{ while ($row = mysql_fetch_array($result)){ $email = $row['email']; //send email } $body = <<<EOD <br><hr><br> =============================== <br> <br> Subject: $title <br> Message: $message <br><br> This message has been sent by My Site. Do not reply to this email. $link to contact support. <br> =============================== <br><br> EOD; $headers = "From: $supportEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $send_contact = mail($email,$title,$body,$headers); // Check, if message sent to your email if($send_contact){ echo "<script language='javascript'> alert('Your site wide email has been sent.'); window.location.href = 'http://mysite.com/x9y6uw5e8_/admin_panel.php?page=mass_email'; </script>"; } } //end check for empty message } //end form check ?>
  5. Because when I go off the 1st query and add the line $to=$row['email']; below the while loop I get the message like 12 time to the first email address only.
  6. Hello all, I'm trying to create a script to send mass emails to users in my mysql database. The issue I'm running into is it seems to either only send the email to the first email or last email ONLY and doesn't cycle through the email in the database like it should. Can someone please explain a better way to write this and maybe let me know how to go about cycling through the emails the right way... Thanks in advance. <?php session_start(); //allow sessions include("config.php"); //get database information if(!$_POST[send]){ //if the form was not submitted echo "<form action='' method='post' > <table width='600' border='0' cellspacing='0' cellpadding='0' align='left'> <tr> <td height='35' colspan='2' align='left'><b>Send a email to all users</b></td> </tr> <tr> <td height='35' align='left'><b>Subject:</b></td> <td width='515' align='left'><input type='text' name='title' id='title' size='30' /></td> </tr> <tr> <td width='85' height='150' align='left' valign='top'><b>Message:</b></td> <td align='left' valign='top'><textarea name='msg' id='msg' cols='65' rows='9'></textarea></td> </tr> <tr> <td height='35'> </td> <td><input type='submit' name='send' id='send' value='Send' /></td> </tr> </table> </form>"; //return with the form }else{ //or if it was $supportEmail = 'support@mysite.com'; $title = strip_tags(htmlspecialchars($_POST[title])); $date = date("F j, Y, g:i a"); $message = stripslashes($_POST[msg]); //message $getusers = mysql_query("SELECT * FROM user"); $getemail = mysql_query("SELECT email FROM user"); $row = mysql_fetch_array($getemail); $to=$row['email']; $link="<a href=\"http://mysite.com/contact.php\">Click here</a>"; if(empty($message)){ echo "<a href=\"history.go(-1)\">Go Back</a>You Can Not Send An Empty Message!"; }else{ while($r = mysql_fetch_array($getusers)){ $send_contact = mail($to,$title,$body,$headers); } $body = <<<EOD <br><hr><br> =============================== <br> <br> Subject: $title <br> Message: $message <br><br> This message has been sent by My SIte. Do not reply to this email. $link to contact support. <br> =============================== <br><br> EOD; $headers = "From: $supportEmail\r\n"; $headers .= "Content-type: text/html\r\n"; $send_contact = mail($to,$title,$body,$headers); // Check, if message sent to your email if($send_contact){ echo "<script language='javascript'> alert('Your site wide email has been sent.'); window.location.href = 'http://mysite.com/admin_panel.php?page=mass_email'; </script>"; } } } ?>
  7. I'm not 100% sure but I'm assuming that the loop while($r =mysql_fetch_array($getmembers)){ } is not enough to get the message to all users... I don't know 100% but I can't think of any other reason it wont work...
  8. Thanks for that it was an issue but the biggest problem now is the message does NOT get sent to users... no error at all. Is this the correct way to cycle through the users in the database... or should I be doing something totally different?
  9. Hello all, I'm trying to send mass private messages to users in my database but keep getting an error... and was hoping someone could help me out. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''john ','Support Staff ','October 20, 2009, 9:32 pm ','Test Message','Test mess' at line 1 Not sure if it's a problem cycling through all the users or what the issue is. $getmembers = mysql_query("SELECT * FROM user"); $num_rows= mysql_num_rows($getmembers); while($r =mysql_fetch_array($getmembers)){ $subject = $_POST['subject']; $message = $_POST['message']; $from="Support Staff"; $date = date("F j, Y, g:i a"); $to=$r['Fname']; $spm = mysql_query("INSERT INTO `private_msg` (`to`,`from`,`date`,`subject`,`content`) VALUES '$to ','$from ','$date ','$subject','$message')") or die(mysql_error()); } Thanks in advance!!
  10. Can you elaborate on that? I'm not 100% sure what your saying... so leave the action blank and in lieu add header redirect?
  11. Having an issue updating database before redirect to paypal. I'm not even 100% sure if what I'm doing is possible or if it's the correct way to go about it... I was hoping that someone who knows a little better could advise me on the best way to go about this. I have a form with one paypal buy now button, one subscription button and just a regular button. I'm trying to put conditions on the submission before the action is preformed. e.g. If users wants a featured listing they click the paypal buy now button and once clicked an update goes to the database before it's redirected to paypal. When I try this I just get redirected without update... no errors just seems like it's not reading the php before the redirect or something. Can anyone tell me how I would go about doing this? I looked into the IPN option but seems to be a lot of effort for just one buy now button and one subscription button. Thanks in advance!
  12. Uh you must not have a very broad amount of values in your testing range... Test url: http://www.testingphilsplace.com/test Output: www.esingilslace.comes Why? Because when you use an array in str_replace like that, it will replace every value... so every h, t, p, : and / in the entire string would be replaced with nothing. lol, just noticed that too...
  13. This seems to work fine... thanks guys. $remove = array("h","t","t","p",":","/","/"); $replace = array("","","","","","",""); $url= $rs_nw['Url']; $site_url=str_replace($remove, $replace, $url);
  14. I wanted to remove the http:// from URL's coming from my database. I was hoping someone can explain how I can do this... Below is my attempt at do it but I get an error: Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash. <a href="whoisView.php?domain=<?php $url="$rs_nw[url]"; $remove = "http\:\/\/"; $replace = ""; preg_replace($remove, $replace, $url); echo "url"; ?> Thanks in advance.
  15. $sql = "INSERT INTO table (id_ListType) VALUES ($listingtype)"; was the solution =) Thank you very much!!
  16. The echo value is one or two but still submits 0 to the database
  17. Those are the only ones with a name of listingtype in the script... <?php // this as your form <input name="listingtype" type="radio" value="1" /> text <input name="listingtype" type="radio" value="2" /> text // this is the value to insert into the database if(isset($_POST['listingtype'])) { $listingtype = $_POST['listingtype']; } else { // set a default value $listingtype = 1; // you could instead throw an error and make the user fill it in, // or whatever } $sql = "INSERT INTO table (id_ListType) VALUES ('$listingtype'); ?> If I use the above the value submitted to the database is 0 I tried $sql = "INSERT INTO table (id_ListType) VALUES ('{$listingtype}'); and still 0 Also tried $sql = "INSERT INTO table (id_ListType) VALUES ("$listingtype"); I get the error Column count doesn't match value count at row 1 once again. I have no other fields in the form with the name listingtype... just the two radio buttons.
  18. When I try it this way the value submitted is 0 and it should be either one or two. Really odd cause if anything you would expect 1 as the value submitted.
  19. Is the logic behind what I'm doing even correct?? Must be another way to do this? Seems simple, I have a column in the database named id_listType and this value should be either 1 or 2. so I set the radio buttons <p> <input name="listingtype" type="radio" value="1" /> text <input name="listingtype" type="radio" value="2" /> text </p> the I want to submit listingtype to the database as either 1 or 2
  20. At what point did I suggest it was a problem with anything todo with the database? This is the type of code that would normally cause that error message... "INSERT INTO table (id_ListType, another_field) VALUES ('$listing_type'); or "INSERT INTO table (id_ListType) VALUES ('$listing_type', '$another_field'); I assume the original error is because I have two fields with the same name and when it's submitted... it's trying to read both values. <p> <input name="listingtype" type="radio" value="1" />some text <input name="listingtype" type="radio" value="2" />More text </p> and the database only has one column for this value. That's why I tried something like <?php $listing_type = $_POST['listingtype']; $list_type['1']= false; $list_type['2']= false; $list_type[$_POST['listingtype']]= true; ?> I assume that $list_type[$_POST['listingtype']]= true; is not working for some reason cause now the value submitted is 0 and not 1 or 2 like it should be.
×
×
  • 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.