Jump to content

nick02895

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by nick02895

  1. Is this tabu? I've been searching for days on how to do this. I posted a questions regarding how to parse out the content-type and not having any luck with that. I'll still need to inject it in the outgoing message. Has anyone here done this? I suspect it may be used for fraudulent activities, but I really want my own custom list function. All the published ones just don't do exactly what I want. Basically have members subscribe to and from the list with a simple checkbox on my site, no email verification. Then I want to be able to send an email to the site and the email goes out to mysql mailing list. If you know of a decent tutorial of full example, please let me know. Thanks Nick Nick1@nickniquette.com
  2. That didn't work, any other suggestions?
  3. My goal here is to send an email to my php script (this is working) then store misc information (this works) then forward the message(this works with text formatted but not html). I found some different free parse programs, but can't quite figure out how to use them. I know I need to strip out the content type, but that isn't working rignt. Most of the problem I think is with parsing from the email then back to the outgoing email. here is the code I'm using. Any suggestions would be appreciated. #!/usr/bin/php -q <?php // Database connection mysql_connect('localhost', 'nick1', 'xxxx') or die('db error 1'); mysql_select_db('nick') or die('db error 2'); $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); $from = ""; $replyto = ""; $subject = ""; $headers = ""; $message = ""; $split = true; $lines = explode("\n", $email); for ($i=0; $i<count($lines); $i++) { if ($split) { // this is a header $headers .= $lines[$i]."\n"; // look out for special headers if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) { $subject = $matches[1]; } if (preg_match("/^From: (.*)/", $lines[$i], $matches)) { $from = $matches[1]; } if (preg_match("/^Reply-To: (.*)/", $lines[$i], $matches)) { $replyto = $matches[1]; } if (preg_match("Content-Type: (.*)/",$lines[$i],$matches)) { $contenttype = $matches[1]; } } else { $message .= $lines[$i]."\n"; } if (trim($lines[$i])=="") { $split = false; } } $time = time(); mysql_query("insert into emails (em_from, em_reply, em_subject, em_headers, em_body, em_time) values ('$from', '$replyto', '$subject', '$headers', '$message', '$time')"); $to= "nick@xxx.com"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .='from:' .$from . "\r\n"; $headers .= $contenttype; mail($to, $subject, $message, $headers); ?> PS, I've seen some things regarding sending html via ms word, I'm sending html messages via outlook. Not sure if this has any bearing on the code? Nick Nick1@NickNiquette.com
  4. I've been trying to re-write some code I found at http://bytes.com/forum/thread519.html that creates pdf pages that I can print labels with. Issue is it wasn't written for mysql and php (now that I've been into it for several hours). I think I'm quite close, could use some help here. 2 files labels.php and print.php error I'm getting is Cannot redeclare mysql_fetch_array() on line 29 Which is the end of function 1 ----------------------------------print.php----------- <?php require_once('labels.php'); require('pdf/fpdf.php'); $cnx=db_connect(); $SelectStmt="select * from user"; PrintAddressLabels($SelectStmt); ?> ------------------------------end print.php------ --------------------------------------------------------------labels.php------- <?php //------------------connect mysql database------------------- function db_connect() { $result = mysql_connect("localhost", "username", "password"); if (!$result) return false; if (!mysql_select_db("db")) return false; return $result; } //------------------------------------function 1-------------------- function mysql_fetch_array($res) { $row = array(); $result = array(); if ($result = mysql_fetch_row($res)) { $nf = mysql_num_fields($res)+1; for($count=1; $count < $nf; $count++) { $field_name = mysql_field_name($res, $count); $field_value = mysql_result($res, $count); $row[$field_name] = $field_value; } return $row; } } //----------------------------function 2--------------- function Avery5160($x, // X co-ord of label (0-2) $y, // Y co-ord of label (0-9) &$pdf, $Data) // String w/ line breaks to print { $LeftMargin = 4.2; $TopMargin = 12.7; $LabelWidth = 66.6; $LabelHeight = 25.45; // Create Co-Ords of Upper left of the Label $AbsX = $LeftMargin + (($LabelWidth + 4.22) * $x); $AbsY = $TopMargin + ($LabelHeight * $y); // Fudge the Start 3mm inside the label to avoid alignment errors $pdf->SetXY($AbsX+3,$AbsY+3); $pdf->MultiCell($LabelWidth-8,4.5,$Data); return; } //------------------------------------------function 3--------------- function PrintAddressLabels($SelectStmt) { global $cnx; // database conneciton $pdf=new FPDF(); $pdf->Open(); $pdf->AddPage(); $pdf->SetFont('Arial','B',10); $pdf->SetMargins(0,0); $pdf->SetAutoPageBreak(false); $cur = mysql_query($SelectStmt); if (!$cur) { echo "Database Error"; return; } $x = 0; $y = 0; while ($row = mysql_fetch_array($cur) ) { $LabelText = sprintf("%s\n%s\n%s, %s, %s", $row['firstname'], $row['lastname'], $row['address'],$row['city'],$row['zip']); Avery5160($x,$y,$pdf,$LabelText); $y++; // next row if ($y == 10 ) { // end of page wrap to next column $x++; $y = 0; if ($x == 3 ) { // end of page $x = 0; $y = 0; $pdf->AddPage(); } } } else { // Error quit printing break; } } $pdf->Output(); } ?> -----------------------------------------end labels.php-------------------- Any and all comments welcome. Nick
  5. What I understand there is the htaccess variables can be used in my php scripts. I've tried reversing that and setting the variables myself in the scripts. $_SERVER["PHP_AUTH_USER"] = "user"; $_SERVER["PHP_AUTH_PW"] = "pswd" ; $PHP_AUTH_USER = "user"; $PHP_AUTH_PW = "pswd" ; but I still get the popup box. Can I avoid that box and set the variables myself in my php scripts?
  6. I have a site that I use php and mysql to verify users. It's all working pretty good except the files are accessible via the internet just by knowing the file name. I was using htaccess and all the users had the same username and password, but now I want everyone to have their own. Question, how do I access the htaccess password directory with php. I suspect I need to use a session variable, but can't understand how that get's done. Nick nick1@nickniquette.com
×
×
  • 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.