Jump to content

cyber_alchemist

Members
  • Posts

    55
  • Joined

  • Last visited

cyber_alchemist's Achievements

Member

Member (2/5)

0

Reputation

  1. code after if condition is okay i guess. should check the code before. or send a simple mail without the query form with variables in code and check if mail() is working or not. $to="kiruthigabaskaran@gmail.com"; $subject="Feedback/Enquiry"; $mail="test@email.com"; $message="test message" ; $header="From:$mail"; $send=mail($to,$subject,$message,$header); if($send) { echo "alert('Your feedback or enquiry is sent successfully!');"; } else { echo "alert('Enter all the fields properly!');"; } most probably it may be server problem. :x
  2. okay i dont know where to put this topic, if it needs to be moved then please do so, I have been creating a mass mailer with this class, <?php class SimpleMail { private $toAddress; private $CCAddress; private $BCCAddress; private $fromAddress; private $subject; private $sendText; private $textBody; private $sendHTML; private $HTMLBody; public function __construct() { $this->toAddress = ''; $this->CCAddress = ''; $this->BCCAddress = ''; $this->fromAddress = ''; $this->subject = ''; $this->sendText = false; $this->textBody = ''; $this->sendHTML = true; $this->HTMLBody = ''; } public function setToAddress($value) { $this->toAddress = $value; } public function setCCAddress($value) { $this->CCAddress = $value; } public function setBCCAddress($value) { $this->BCCAddress = $value; } public function setFromAddress($value) { $this->fromAddress = $value; } public function setSubject($value) { $this->subject = $value; } public function setSendText($value) { $this->sendText = $value; } public function setTextBody($value) { $this->sendText = false; $this->textBody = $value; } public function setSendHTML($value) { $this->sendHTML = $value; } public function setHTMLBody($value) { $this->sendHTML = true; $this->HTMLBody = $value; } public function send($to = null, $subject = null, $message = null, $headers = null) { $success = false; if (!is_null($to) && !is_null($subject) && !is_null($message)) { $success = mail($to, $subject, $message, $headers); return $success; } else { $headers = array(); if (!empty($this->fromAddress)) { $headers[] = 'From: ' . $this->fromAddress; } if (!empty($this->CCAddress)) { $headers[] = 'CC: ' . $this->CCAddress; } if (!empty($this->BCCAddress)) { $headers[] = 'BCC: ' . $this->BCCAddress; } if ($this->sendText && !$this->sendHTML) { $message = $this->textBody; } elseif (!$this->sendText && $this->sendHTML) { $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Content-type: text/html; charset="iso-8859-1"'; $headers[] = 'Content-Transfer-Encoding: 7bit'; // $headers[] .= 'Content-Transfer-Encoding: quoted-printable'; $message = $this->HTMLBody; } elseif ($this->sendText && $this->sendHTML) { $boundary = '==MP_Bound_xyccr948x=='; $headers[] = 'MIME-Version: 1.0'; $headers[] = 'Content-type: multipart/alternative; boundary="' . $boundary . '"'; $message = 'This is a Multipart Message in MIME format.' . "\n"; $message .= '--' . $boundary . "\n"; $message .= 'Content-type: text/plain; charset="iso-8859-1"' . "\n"; $message .= 'Content-Transfer-Encoding: 7bit' . "\n\n"; // $message .= 'Content-Transfer-Encoding: quoted-printable' . "\n\n"; $message .= $this->textBody . "\n"; $message .= '--' . $boundary . "\n"; $message .= 'Content-type: text/html; charset="iso-8859-1"' . "\n"; $message .= 'Content-Transfer-Encoding: 7bit' . "\n\n"; $message .= $this->HTMLBody . "\n"; $message .= '--' . $boundary . '--'; } $success = mail($this->toAddress, $this->subject, $message, join("\r\n", $headers)); return $success; } } } ?> now the problem is when ever gmail recives the image code , <img src="http://yourdomain.com/image.jpg" > it escapes them like this : <img src=\"http://yourdomain.com/image.jpg\" > and the image is not read how could i resolve this ???
  3. looked into the .csv files with comma , commas are escaped by " such as ," any conditional statement will solve it with explode isnt it ??? anyways here is the short script with the help of the example of php.net: excelupload.php <?php if (isset($_POST['submit'])) { $excel_name = $_FILES['excel']['name']; echo $excel_name . "<br />"; $excel_tmp_name = $_FILES['excel'][ 'tmp_name']; echo $excel_tmp_name . "<br />"; $excel_file_size = $_FILES['excel']['size']; echo $excel_file_size . "<br />"; $excel_file_type = $_FILES['excel']['type']; echo $excel_file_type . "<br />"; $excel_date = @date('y-m-d'); echo 'Date of file upload' . $excel_date; $row = 1; echo '<table border="1" >'; if (($handle = fopen($excel_tmp_name, "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<tr> <td>$num</td><td>$row:</td>"; $row++; for ($c=0; $c < $num; $c++) { echo "<td>" . $data[$c] . "</td>\n"; } echo "</tr>"; } fclose($handle); } echo "</table>"; } ?> excel.html <html> <head><title>excel upload</title></head> <body> <form action="excelupload.php" method="post" enctype="multipart/form-data" > <input type="file" name="excel" id="excel" /> <input type="submit" name="submit" id="submit" value="submit" /> </form> </body> </html>
  4. have you tried opening your saved .csv files on excel ??? if it open correctly then , their is a way around it using .csv format. --edited-- thanks it helped better
  5. Coincidences , i have to do the same thing and was figuring out how ... csv file format is i guess like this ... Year,Make,Model,Length 1997,Ford,E350,2.34 2000,Mercury,Cougar,2.38 where every value is separated by a comma , so i guess on could use explode(); to takeout values from it http://php.net/manual/en/function.explode.php it would help if one could get a format of the file and a example data inserted into it
  6. yes i can but it didn't solved the problem ???? i mean both things mean the same ? whether i write 'UPDATE ml_subscriptions SET pending = 0 WHERE user_id = '. $user_id .' AND ml_id = '. $ml_list; or 'UPDATE ml_subscriptions SET pending = 0 WHERE user_id = '.$user_id.' AND ml_id = '.$ml_list. ''; but anyways i got why it wasn't working from the irc channel
  7. but , ; comes after '' isn't it ??? like $query = '<your query >'; it could be like : 'UPDATE ml_subscriptions SET pending = 0 WHERE user_id = '.$user_id.' AND ml_id = '.$ml_list. ''; isn't it ? phpcodechecker.com returns this error PHP Syntax Check: Parse error: syntax error, unexpected T_VARIABLE in your code on line 102 $result = mysql_query($query, $db); after i do what you asked..
  8. this is my code ... if (!empty($user_id) && !empty($ml_id)) { echo 'empty security pass ..' ; $query = 'UPDATE ml_subscriptions SET pending = 0 WHERE user_id = ' . $user_id . ' AND ml_id = ' . $ml_list; mysql_query($query, $db); $query = 'SELECT listname FROM ml_lists WHERE ml_id = ' . $ml_id; $result = mysql_query($query, $db); $row = mysql_fetch_assoc($result); $listname = $row['listname']; mysql_free_result($result); $query = 'SELECT first_name, email FROM ml_users WHERE user_id = ' . $user_id; $result = mysql_query($query, $db); $row = mysql_fetch_assoc($result); $first_name = $row['first_name']; $email = $row['email']; mysql_free_result($result); $message = 'Hello ' . $first_name . ',' . "\n"; $message .= 'Thank you for subscribing to the ' . $listname . ' mailing list. Welcome!' . "\n\n"; $message .= 'If you did not subscribe, please accept our ' . 'apologies. You can remove' . "\n"; $message .= 'this subscription immediately by visiting the ' . 'following URL:' . "\n"; $message .= 'http://www.massmailer.pixub.com.com/ml_remove.php?user_id=' . $user_id . '&ml_id=' . $ml_id; $mail = new SimpleMail(); $mail->setToAddress($email); $mail->setFromAddress('massmailer@pixub.com'); $mail->setSubject('Mailing list subscription confirmed'); $mail->setTextBody($message); $mail->send(); header('Location: ml_thanks.php?user_id=' . $user_id . '&ml_id=' . $ml_id . '&type=s'); } else { header('Location: ml_user.php'); } every this is working fine just that the query ... $query = 'UPDATE ml_subscriptions SET pending = 0 WHERE user_id = ' . $user_id . ' AND ml_id = ' . $ml_list; mysql_query($query, $db); doesn't seem to update my table , is my query is wrong ??? is my syntax is correct for the updating the table ??
  9. okay got few things , first to add mailing lists and second to delete mailing list... <?php require 'db.inc.php'; require 'class.SimpleMail.php'; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : ''; switch ($action) { case 'Add New Mailing List': $listname = isset($_POST['listname']) ? $_POST['listname'] : ''; if (!empty($listname)) { $query = 'INSERT INTO ml_lists (listname) VALUES ("' . mysql_real_escape_string($listname, $db) . '")'; } mysql_query($query,$db) or die(mysql_error($db)); break; case 'Delete Mailing List': $ml_id = isset($_POST['ml_id']) ? $_POST['ml_id'] : ''; if (ctype_digit($ml_id)) { $query = 'DELETE FROM ml_lists WHERE ml_id=' . $ml_id; mysql_query($query, $db) or die(mysql_error($db)); } break; } ?> however... i am still figuring out how to send mass mails to all the subscribers...
  10. nope , as the password is not given / or use of Facebook passwords is unethical in making any Facebook app or api connecting Facebook, i am not currently updated with the technical details but that is how it goes, once the cookies expires the user have to log in again, although , if they are already signed in , you could make them online in messenger etc.
  11. SELECT * FROM tourDB WHERE categories LIKE '$international_categories' DESC LIMIT $start, $limit if not how could i show it with a limit and where to start ???
  12. This was a third party script which i was going through , now, somehow this script seemed incomplete, i want to make sure what are missing and what do i have to do to make it working. this is the admin form to add the mailing list, although after going through the ml_admin_transact it just gives a blank page..?? Also I didn't find any switch related to the post made by the admin form. <?php require 'db.inc.php'; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); ?> <html> <head> <title>Mailing List Administration</title> <style type="text/css"> td { vertical-align: top; } </style> </head> <body> <h1>Mailing List Administration</h1> <form method="post" action="ml_admin_transact.php"> <p><label for="listname">Add Mailing List:</label><br /> <input type="text" id="listname" name="listname" maxlength="100" /> <input type="submit" name="action" value="Add New Mailing List" /> </p> <?php $query = 'SELECT ml_id, listname FROM ml_lists ORDER BY listname ASC'; $result = mysql_query($query, $db) or die(mysql_error($db)); if (mysql_num_rows($result) > 0) { echo '<p><label for="ml_id">Delete Mailing List:</label><br />'; echo '<select name="ml_id" id="ml_id">'; while ($row = mysql_fetch_array($result)) { echo '<option value="' . $row['ml_id'] . '">' . $row['listname'] . '</option>'; } echo '</select>'; echo '<input type="submit" name="action" value="Delete ' . 'Mailing List" />'; echo '</p>'; } mysql_free_result($result); ?> </form> <p><a href="ml_quick_msg.php">Send a quick message to users.</a></p> </body> </html> and ml_admin_transact.php :- <?php require 'db.inc.php'; require 'class.SimpleMail.php'; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : ''; switch ($action) { case 'Subscribe': $email = (isset($_POST['email'])) ? $_POST['email'] : ''; $query = 'SELECT user_id FROM ml_users WHERE email="' . mysql_real_escape_string($email, $db) . '"'; $result = mysql_query($query, $db) or die(mysql_error($db)); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); $user_id = $row['user_id']; } else { $first_name = (isset($_POST['first_name'])) ? $_POST['first_name'] : ''; $last_name = (isset($_POST['last_name'])) ? $_POST['last_name'] : ''; $query = 'INSERT INTO ml_users (first_name, last_name, email) VALUES ("' . mysql_real_escape_string($first_name, $db) . '", ' . '"' . mysql_real_escape_string($last_name, $db) . '", ' . '"' . mysql_real_escape_string($email, $db) . '")'; mysql_query($query, $db); $user_id = mysql_insert_id($db); } mysql_free_result($result); foreach ($_POST['ml_id'] as $ml_id) { if (ctype_digit($ml_id)) { $query = 'INSERT INTO ml_subscriptions (user_id, ml_id, pending) VALUES (' . $user_id . ', ' . $ml_id . ', TRUE)'; mysql_query($query, $db); $query = 'SELECT listname FROM ml_lists WHERE ml_id = ' . $ml_id; $result = mysql_query($query, $db); $row = mysql_fetch_assoc($result); $listname = $row['listname']; $message = 'Hello ' . $first_name . "\n" . $message .= 'Our records indicate that you have subscribed ' . 'to the ' . $listname . ' mailing list.' . "\n\n"; $message .= 'If you did not subscribe, please accept our ' . 'apologies. You will not be subscribed if you do ' . 'not visit the confirmation URL.' . "\n\n"; $message .= 'If you subscribed, please confirm this by ' . 'visiting the following URL: ' . 'http://www.example.com/ml_user_transact.php?user_id=' . $user_id . '&ml_id=' . $ml_id . '&action=confirm'; $mail = new SimpleMail(); $mail->setToAddress($email); $mail->setFromAddress('list@example.com'); $mail->setSubject('Mailing list confirmation'); $mail->setTextBody($message); $mail->send(); unset($mail); } } header('Location: ml_thanks.php?user_id=' . $user_id . '&ml_id=' . $ml_id . '&type=c'); break; case 'confirm': $user_id = (isset($_GET['user_id'])) ? $_GET['user_id'] : ''; $ml_id = (isset($_GET['ml_id'])) ? $_GET['ml_id'] : ''; if (!empty($user_id) && !empty($ml_id)) { $query = 'UPDATE ml_subscriptions SET pending = FALSE WHERE user_id = ' . $user_id . ' AND ml_id = ' . $ml_id; mysql_query($query, $db); $query = 'SELECT listname FROM ml_lists WHERE ml_id = ' . $ml_id; $result = mysql_query($query, $db); $row = mysql_fetch_assoc($result); $listname = $row['listname']; mysql_free_result($result); $query = 'SELECT first_name, email FROM ml_users WHERE user_id = ' . $user_id; $result = mysql_query($query, $db); $row = mysql_fetch_assoc($result); $first_name = $row['first_name']; $email = $row['email']; mysql_free_result($result); $message = 'Hello ' . $first_name . ',' . "\n"; $message .= 'Thank you for subscribing to the ' . $listname . ' mailing list. Welcome!' . "\n\n"; $message .= 'If you did not subscribe, please accept our ' . 'apologies. You can remove' . "\n"; $message .= 'this subscription immediately by visiting the ' . 'following URL:' . "\n"; $message .= 'http://www.example.com/ml_remove.php?user_id=' . $user_id . '&ml_id=' . $ml_id; $mail = new SimpleMail(); $mail->setToAddress($email); $mail->setFromAddress('list@example.com'); $mail->setSubject('Mailing list subscription confirmed'); $mail->setTextBody($message); $mail->send(); header('Location: ml_thanks.php?user_id=' . $user_id . '&ml_id=' . $ml_id); } else { header('Location: ml_user.php'); } break; case 'Remove': $email = (isset($_POST['email'])) ? $_POST['email'] : ''; if (!empty($email)) { $query = 'SELECT user_id FROM ml_users WHERE email="' . $email . '"'; $result = mysql_query($query, $db) or die(mysql_error($db)); if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); $user_id = $row['user_id']; header('Location: ml_remove.php?user_id=' . $user_id . '&ml_id=' . $ml_id); break; } header('Location: ml_user.php'); } break; } ?> if any more files are needed i will post it those as well.
  13. hmmm.... i guess i forgot, the page doesn't exist to see what i was talking about...
×
×
  • 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.