
Hooch
Members-
Posts
11 -
Joined
-
Last visited
Never
Everything posted by Hooch
-
I have implemented the download script. I changed $message .= '<a href="http://www.mysite.org/files/emails/'.$file_name.'">'.$file_name.'</a>'; to $message .= '<a href="http://www.mysite.org/files/emails/file.php?file='.$file_name.'">Download</a>'; Then I needed to create a file called file.php in the folder where the file is. Here is file.php <?php // force to download a file // ex, ( [url=http://localhost/php/download.php?file=C:/Apache]http://localhost/php/download.php?file=C:/Apache[/url] Group/Apache2/hongkong.php ) // hope this can save your time :-) $file = $_GET['file']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header( "Content-Disposition: attachment; filename=".basename($file)); header( "Content-Description: File Transfer"); //Inform the browser of what's coming -- allowing it properly report download progress and estimated completion time header('Accept-Ranges: bytes'); header('Content-Length: ' . filesize($file)); @readfile($file); ?> Thank you thorpe
-
Great post thank you!! Going to be a challenge to add this the the email script.
-
Is it possible to have a link in an email (being sent from a webpage on my site) with the option to download (and not to view)? I have the email working great, but when you click the link it pops up a new browser and shows the file. I would like to have the link ask if you want to download instead. FYI here is my code //send the email //Set up info $_SESSION['filetoupload'] = $_POST['filetoupload']; $_SESSION['all_emails'] = $_POST['all_emails']; $file_name = $_SESSION['file_name']; $to = "[email protected]"; $subject = stripslashes($_POST['txtSubject']); $message = stripslashes($_POST['txtMessage']); $message .= "<br />"; if($_SESSION['filetoupload'] == 1) { $message .= "<br />"; $message .= "To view file please click the link below."; $message .= "<br /><br />"; $message .= '<a href="http://www.mysite.org/files/emails/'.$file_name.'">'.$file_name.'</a>'; $message .= "<br /><br />"; } $message .= "--------------------"; $message .= "<br /> mysite.org <br />"; $headers = "From: mysite.org\r\n"; $headers .= "Return-Path: <".$to.">\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Bcc:".$_SESSION['all_emails']."\r\n"; $headers .= "Content-Type: text/HTML; charset=ISO-8859-1\r\n"; if(mail($to, $subject, nl2br($message), $headers)) { echo '<b>Mail Sent</b>'; } else { echo '<b>Mail not sent</b>'; }
-
Hello all, I have googled this to death and all the answers still do not send to Bcc. Here's my code <?php if(!$_POST['submit']) { ?> <form method="post" action="send_email.php" id="mailit" name="mailit"> <b>Subject:</b><br /> <input name="txtSubject" type="text" class="txtbox" title="" size="70" maxlength="70"/> <br /> <b>Message:</b><br /> <textarea name="txtMessage" cols="50" rows="10" wrap="VIRTUAL" class="txtbox" /></textarea> <br /> <input name="Reset" type="reset" value="Clear"/> <input name="submit" type="submit" value="Send"/> </form> <?php } else { //Set up info $to = "[email protected]"; $subject = stripslashes($_POST['txtSubject']); $message = stripslashes($_POST['txtMessage']); $headers = "From:Me<[email protected]>\r\n"; $headers .= "Reply-To:Do not reply\r\n"; $headers .= "cc: \r\n"; $headers .= "Bcc:[email protected];\r\n" . "X-Mailer: PHP 4.x"; if ( mail($to,$subject,$message,$headers) ) { echo "The email has been sent!"; } else { echo "The email has failed!"; } } This code will print the error "The email has failed!", but the email does get sent to the 1st recipient. The Bcc: is causing the error to show, even though the email gets through. The Bcc: person does not get the email. Thanks for your time
-
Ah.... Thank you. Worked like a charm!!
-
Here's what I use. http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm Very customizable
-
Hello all. I have a page that you "checkbox" emails then click submit. The next page is to type a message and send it on it's merry way. This page receives all those emails with the following code while (list ($key,$val) = @each ($id)) { echo "$val;"; } Can I get these emails (could be as many as 80) into a variable. Basically I need $send_to to equal those emails from the above code. (The code above will print out the emails perfectly) Thank you for any help.
-
Thanks fenway. I'm going to put them in thier own cell of the table then. This should fix it. Now I know why they were offset like that. Later...Hooch
-
As far as I can tell the form is closed. But I'm sure I"m not following you. For the generated do you mean view source? If so... [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>TIA</title> <link rel="stylesheet" type="text/css" href="includes/tia.css" /> </head> <body> <table width="700" height="91" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#00FF00"> <tr> <td height="81" colspan="3" background="images/header-700-81.jpg"> </td> </tr> <tr valign="bottom"> <td width="416" height="10" bgcolor="#CCCCCC"> <div align="left"> <form action="login.php" method="post">name: <input type="text" name="username" size="8"> password: <input type="password" name="password" size="8"> <input type="image" class="submit" name="submit"></form><a href="signup.html">Register</a> </div> </td> <td width="151" height="19"> </td> <td width="133" height="19"> </td> </tr> </table><table width="700" border="2" align="center" cellpadding="0" cellspacing="0" bordercolor="#BE8647"> <tr> <td width="161"> </td> <td width="296"> </td> <td width="233"> </td> </tr> <tr> <td>Test left </td> <td>Test middle </td> <td>Test right </td> </tr> </table> </body> </html> [/code]
-
Hi fenway. Thank you for your reply. I am no coder..I was trying to mesh two tutorials. But I did get things to work. Here's the code. [code]<table width="700" height="91" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#00FF00"> <tr> <td height="81" colspan="3" background="images/header-700-81.jpg"> </td> </tr> <tr valign="bottom"> <td width="416" height="10" bgcolor="#CCCCCC"> <div align="left"> <?php $msgbox = ""; if (!$_COOKIE['id']){ echo "<form action=\"login.php\" method=\"post\">name: <input type=\"text\" name=\"username\" size=\"8\"> password: <input type=\"password\" name=\"password\" size=\"8\"> <input type=\"image\" SRC=\"images/submit.jpg\" class=\"submit\" name=\"submit\"></form>"; echo "<a href=\"signup.html\">Register</a>"; } else { $msgbox .= "Welcome - "; // Connect to the database $server = "localhost"; $dbuser = "user"; $dbpass = "pass"; $dbname = "db"; mysql_connect($server,$dbuser,$dbpass) or die ("connection error"); // make connection mysql_select_db($dbname); // select database // Get users information $result = mysql_query("SELECT * FROM users WHERE id='".mysql_escape_string($_COOKIE['id'])."'"); $r=mysql_fetch_assoc($result); $msgbox .= $r["username"]; } echo $msgbox; ?> </div> </td> <td width="151" height="19"> </td> <td width="133" height="19"> </td> </tr> </table>[/code] Everything seems to be working except the login and register. It's all in the same table row. I made the box large enough for all to fit on one line, but the register link is below the login fields when I upload it to the web. Any ideas??
-
Hello all. I am wanting to have my header say welcome "username hare" when someone is on my site. I have followed a tut on making a database with log in and out functions. Both work too. Thing is, I can't get the username to show up. Could someone be kind enough to have a look? Here is the line I would like the name entered. echo "$username"; [code] <table width="700" height="100" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#00FF00"> <tr> <td height="81" colspan="4" background="images/header-700-81.jpg"> </td> </tr> <tr> <td width="148" height="19"> <div align="right"> <?php if (!$_COOKIE['id']){ echo "<a href=\"signup.html\">Register</a>"; echo " "; echo "<a href=\"login.html\">Log In</a>"; die(""); } echo "Welcome - "; ?> </div></td> <td width="126" height="19"> <?php // Connect to the database $server = "localhost"; $dbuser = "username"; $dbpass = "password"; $dbname = "db_name"; mysql_connect($server,$dbuser,$dbpass) or die ("connection error"); // make connection mysql_select_db($dbname); // select database // Get users information $result = mysql_query("SELECT * FROM `users` WHERE `id` = '".mysql_escape_string($u)."' "); while($r=mysql_fetch_array($result)) { $username=$r["username"]; echo " "; echo "$username"; } ?> </td> <td width="212" height="19"> </td> <td width="214"> </td> </tr> </table> [/code] Thank you for your time.