Jump to content

madhead29

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by madhead29

  1. Hi everyone i was wondering if someone could please help me. I have a newsletter system that i use but at the moment its just text to send messages. What i want to do is enter a message into the message box and then it get sent to the user but alow have a design when the user views the email. But what i dont want is the box to be filled with html i want the box to just contain the text. I have tried sending a test newsletter using some html tags like ie <b>This is bold</b> but it actually shows the tags and doesnt put it in bold i wonder if this could be a problem even though i dont want any html in the text box i want the html in a separate area. Any help is greatly appreciated. Thanks. Below is php code. quickmessage.php is the part where the box is and class.SimpleMail.php is the backend part of quickmessage.php quickmessage.php code: <?php require('config.php'); ?> <html> <head> <title>Quick Message</title> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <form method="post" action="admin_transact.php"> <p align="center">Enter the message below to send to the Newsletter user.</p> <p align="center">Choose Mailing List:<br /> <select name="ml_id"> <option value="all">All</option> <?php $conn = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS) or die('Could not connect to MySQL database. ' . mysql_error()); mysql_select_db(SQL_DB, $conn); $sql = "SELECT * FROM ml_lists ORDER BY listname"; $result = mysql_query($sql) or die('Invalid query: ' . mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <option value=\"" . $row['ml_id'] . "\">" . $row['listname'] . "</option>\n"; } ?> </select> </p> <p align="center">Compose Message:</p> <p align="center"> Subject:<br /> <input type="text" name="subject" /> </p> <p align="center"> Message:<br /> <textarea name="msg" rows="10" cols="60"></textarea> </p> <p align="center"> <input type="submit" name="action" value="Send Message" /> </p> </form> <p align="center"> <a href="admin.php">Back to mailing list administration</a></p> </body> </html> class.SimpleMail.php code: <?php class SimpleMail { public $to = NULL; public $cc = NULL; public $bcc = NULL; public $from = NULL; public $subject = ''; public $body = ''; public $htmlbody = ''; public $send_text = TRUE; public $send_html = FALSE; private $message = ''; private $headers = ''; public function send($to = NULL, $subject = NULL, $message = NULL, $headers = NULL) { if (func_num_args() >= 3) { $this->to = $to; $this->subject = $subject; $this->message = $message; if ($headers) { $this->headers = $headers; } } else { if ($this->from) { $this->headers .= "From: " . $this->from . "\r\n"; } if ($this->cc) { $this->headers .= "Cc: " . $this->cc . "\r\n"; } if ($this->bcc) { $this->headers .= "Bcc: " . $this->bcc . "\r\n"; } if ($this->send_text and !$this->send_html) { $this->message = $this->body; } elseif ($this->send_html and !$this->send_text) { $this->message = $this->htmlbody; $this->headers .= "MIME-Version: 1.0\r\n"; $this->headers .= "Content-type: text/html; " . "charset=iso-8859-1\r\n"; } else { $_boundary = "==MP_Bound_xyccr948x=="; $this->headers = "MIME-Version: 1.0\r\n"; $this->headers .= "Content-type: multipart/alternative; " . "boundary=\"$_boundary\"\r\n"; $this->message = "This is a Multipart Message in " . "MIME format\n"; $this->message .= "--$_boundary\n"; $this->message .= "Content-Type: text/plain; " . "charset=\"iso-8859-1\"\n"; $this->message .= "Content-Transfer-Encoding: 7bit\n\n"; $this->message .= $this->body . "\n"; $this->message .= "--$_boundary\n"; $this->message .= "Content-type: text/html; " . "charset=\"iso-8859-1\"\n"; $this->message .= "Content-Transfer-Encoding: 7bit\n\n"; $this->message .= $this->htmlbody . "\n"; $this->message .= "--$_boundary--"; } } if (!mail($this->to,$this->subject,$this->message,$this->headers)) { throw new Exception('Sending mail failed.'); return FALSE; } else { return TRUE; } } } ?>
  2. Hi, Thanks for the code i will take a look at it.
  3. Hi, People. I am currently using a script that counts the clicks from outside users. For example a user clicks a link (lets say click.php?=1) which loads checks there ip address (which ip addresses in the database) if its not in the database add there ip address to the database and add a +1 to the link count for that link. But say you have a different link say click.php?id=2 but this one goes to a totally different website if the same user clicks that link the script checks if the ip is in the database but because the user clicked it before using click.php?=1 it doesnt add a +1 for click.php?=2 i was wondering how i can make it so if someone clicks click.php?id=1 it will add a +1 for that link and also if they click.php?id=2 i will add a +1 for that link aswell but only if they not clicked each link before. Can some please help me with this? The current code i am using is below: <?php $host = 'l'; $user = ''; $pass = '; $db = ''; mysql_connect($host,$user,$pass) or die (mysql_error()); // try to connect to database mysql_select_db($db); // try to select the database with the link details $id = stripslashes($_GET['id']); if(!$id) exit; // if the link was not specified, stop runing $id = stripslashes($id); // for security reasons $linkquery = mysql_query("SELECT * FROM links WHERE id=$id LIMIT 1;"); // look for the specified link $link = mysql_fetch_array($linkquery); if(!$link) die("The specified ID does not exists!"); // if the ID exists in the database, start the count process $day = date("d"); $month = date("m"); $year = date("y"); $date = "$day/$month/$year"; $ip = $_SERVER["REMOTE_ADDR"]; $query = mysql_query("SELECT * FROM links_info WHERE ip='$ip';"); $lookvisitorsip = mysql_fetch_array($query); if(!$lookvisitorsip) // if the visitor's ip isn't already in the database add one more click mysql_query("UPDATE links SET clicks=(clicks+1) WHERE id=$id;"); // add 1 click to the specified id // if you just want to count clicks, without get members info delete this next line mysql_query("INSERT INTO links_info (id,ip,date) VALUES ($id,'$ip','$date');") or die(mysql_error()); // save the area which your visitor went, their IP and the date when they visit it header("Location: $link[ref]"); // redirect to the page// //echo "Link:".$link[ref]; ?> Also can some please let me know if this code is secure? Thanks
  4. Hi all, what i am trying to do is like this website: chippeduk.com in the search area (bottom right), where the user selects a make (all fields grab from the database), then selects a model, then they select the fine tune, then they click search this will bring up the information about the car they have picked. How would i do this, would i use multiple tables and then link them together via an id? i am new to PHP/MySQL but very willing to learn. Thanks in advance. I have looked around many forums inc the devshed forums but i can't seem to find that i am looking for. How would i setup the database structure for this type of system? using two tables? how would i link them to each other. I am willing to pay someone to help me with this as i need it done ASAP PM me for more info. Regards, CM.
  5. Hi, thanks. What would be the best thing to type to find what i am looking for? Regards, Carl.
  6. Hi all, what i am trying to do is like this website http://www.chippeduk.com/ in the search area (bottom right), where the user selects a make (all fields grab from the database), then selects a model, then they select the fine tune, then they click search this will bring up the information about the car they have chosen. How would i do this, would i use multiple tables and then link them together via an id? i am new to PHP/MySQL but very willing to learn. Thanks in advance. Regards, Carl.
  7. Hi, thanks for your help i will have a look at the file that you sent. The most important part of the system will be the fact that i can type into the text box and then it will get added into the email. I will look around the website for information on this. Thanks again. Regards, Carl.
  8. Hi, i have a mailinglist/newsletter and what i want it do is when i type a message into the message box in 'quickmsg.php' it will also send a html file which will be the template for the newsletter, this will only change when the .html or .extention is edited. the template will have a box on it and when the text is typed into the message box on 'quickmsg.php' it will auto appear on the template file and get sent to the users email address. Is there a way to do this? Also i dont want it sending as attachments i want it to look like a website when they open there email. You can download the php files that i am talking about at: http://firecare999.com/mailing-list.zip The newsletter template hasn't been made yet but i hope you understand what i mean. Thanks in advance. Carl.
×
×
  • 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.