PHP - Seemingly Unconnected File Causing Header Mash Up
Good morning folks, I'm having an obscure issue with previously sent headers. I have an add_category.php for the admin backend of an app I'm working on. It was working fine until I added a Post.php class, but the Post.php class doesn't even interact with add_categories.php outside the initialization file. When I use this file to add a category I get the normal Quote
Warning: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/qcic/assets/class/Post.php:94) in /opt/lampp/htdocs/qcic/admin/category.php on line 6
Like I said, this was working fine until I added the Post.php class. But the only time that they even come close to interacting is in the initializations.php which I put at the top of each of the pages and looks like this -> <?php require("../load.php"); require("../assets/class/User.php"); require("../assets/class/Category.php"); require("../assets/class/Post.php"); $user = $user_obj->getUsername(); $role = $user_obj->getRole(); $cat_obj = new Category($conn, $user); $post_obj = new Post($conn, $user); The relevant code for the add_category.php is -> <?php require("assets/initializations.php"); if(isset($_POST['add_cat'])) { $cat_obj->addCategory($_POST['cat_title']); header("Location: category.php?message=category-added"); exit; } ?> After some research I've altered this a bit to this -> <?php require("assets/initializations.php"); if(isset($_POST['add_cat'])) { $cat_obj->addCategory($_POST['cat_title']); if(!headers_sent()) { header("Location: category.php?message=category-added"); exit; } else { var_dump(headers_list()); } } ?> Which returns this -> Quotearray(5) { [0]=> string(23) "X-Powered-By: PHP/8.0.3" [1]=> string(38) "Expires: Thu, 19 Nov 1981 08:52:00 GMT" [2]=> string(50) "Cache-Control: no-store, no-cache, must-revalidate" [3]=> string(16) "Pragma: no-cache" [4]=> string(38) "Content-type: text/html; charset=UTF-8" } I have no idea where those are coming from or why they're coming at all and that date is a long time ago. Some of it looks familiar, some I've never seen before. I haven't come across a remedy that works yet though. Any suggestions?
EDIT: typo Edited Monday at 03:52 PM by TechnoDiverSimilar TutorialsI have several pages on my site using the exact same code at the very top, which works fine except for one page: <?php include_once("../members/dbinfo.php"); The top of dbinfo looks like this: <?php session_start(); And then the connection strings for the database However it is giving me this error on this one page: Quote Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\WebSites\premierathome_com\products\FrenchTalkingDictionary.php:1) in C:\Inetpub\WebSites\premierathome_com\members\dbinfo.php on line 1 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\WebSites\premierathome_com\products\FrenchTalkingDictionary.php:1) in C:\Inetpub\WebSites\premierathome_com\members\dbinfo.php on line 1 Now the session does actually start and doesn't prevent anything from working, I just get those messages. I'm at a loss as to why a different page with the exact same code, save for searching the database for a different product version would have this problem. I have had this code in place as well which works fine on other pages but doesn't help my problem at all: if(!isset($_SESSION['OK'])){ session_start(); } OK being a variable I set up during log in. I'm at a loss, is anyone able to help me out with this? Hello all
Was hoping someone could help. I have a .htaccess file that contains the following:
RewriteEngine On RewriteRule ^sites/([a-z0-9]+)/?$ sites.php?letter=$1 [NC,L,QSA] RewriteRule ^network-devices/([a-z0-9]+)/?$ network-devices.php?letter=$1 [NC,L,QSA] RewriteRule ^site/([0-9]+)/?$ site.php?site_id=$1 [NC,L] RewriteRule ^network-device/([0-9]+)/?$ network-device.php?device_id=$1 [NC,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php?%{QUERY_STRING} Hello, I have come to a dead end. What I'm trying to do is simple: have a dynamic title for my php page (something that would be executed by, for example, Code: [Select] <title><?php echo $title; ?></title>). I'm not an experienced coder. I've tried about 15 different variations to try to achieve the result I want, and none of them have worked. I'm using a dynamic web template (DWT), which has editable regions for the Code: [Select] <title> section and for the main body of the webpage. I'm also using a Smarty template, called display_post.tpl, which, along the php file that is attached to the DWT, called display_post.php, are provided below as originally written: Smarty template: Code: [Select] <table cellpadding="8"> <tr> <td valign="top"> {section name=mysec loop=$posts} <h2>{$posts[mysec].title}</h2><br> {$posts[mysec].body|nl2br} <br> {/section} </td> </tr> </table> display_post.php: Code: [Select] <?php require_once('db_login.php'); require_once('config.php'); $conn = mysqli_connect($db_host, $db_username, $db_password, $db_database) or die ('Error connecting to MySQL'); $post_id = $_GET['post_id']; $query = "SELECT * FROM posts WHERE post_id=$post_id"; $result = mysqli_query($conn, $query); while($row = $result->fetch_array()){ $test[] = $row; } $smarty->assign('posts', $test); $smarty->display('display_post.tpl'); mysqli_close($conn); ?> Everything works as is. Part of the problem is that I don't know whether to do this through the DWT/php file or through Smarty. I've tried variations on both approaches, which I can provide for food-for-thought if need be. For now, I would love to read any possible solutions that you can come up with. Thanks bunches! Maat Hello everyone! I'm somewhat of a newb in this so anyways I have this script and I try to force a browser to download a file when someone hits a download button. here is what I'm trying: header('Content-Type: application-download'); header('Content-Disposition: attachment; filename=' .basename($dl_id)); readfile($dl_id); It seems to work in Chrome, Firefox, but it doesn't work in IE Any suggestions? I have a problem, when my script is executed it doesn't grab the file but returns all the source code on the page in a text document The text file hasn't been over written. Code: [Select] <!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=windows-1252" /> <title>Ajicles File Hosting - Downloading:040810051842songs.txt</title> <link rel="stylesheet" type="text/css" href="style.css" /> <!--[if IE 6]> <link rel="stylesheet" type="text/css" href="iecss.css" /> <![endif]--> </head> <body> <div id="main_container"> <div id="header"> <div id="logo"><a href="index.html"><img src="images/logo.png" alt="" title="" border="0" width="251" height="82"/></a></div> <div id="menu_tab"> <ul class="menu"> <li><a href="index.php" class="nav"> Home </a></li> <li><a href="upload.php" class="nav"> Upload</a></li> <li><a href="login.php" class="nav"> Login</a></li> <li><a href="register.php" class="nav"> Register</a></li> <li><a href="contact.php" class="nav"> Contact </a></li> <li><a href="logout.php" class="nav"> Logout </a></li> </ul> </div> </div> <div id="main_content"> <div id="downloading"> </div> </div> <div class="clear"></div> </div> <!-- main_content--> <div id="footer"> <img src="images/footer_logo.gif" alt="" title="" width="33" height="45" class="left" /> <div class="left_footer"> Ajicles Hosting 2010. All Rights Reserved </div> </div> </div> </body> </html> The root directory:
header.php
stylesheet.css
In the following example I am trying to include the header.php file in a sub folder.
When I include the header.php like in the following example then the stylesheet.css file will not work anymo
<?php include("../header.php"); ?>The stylesheet.css file is included in the head tags of the header.php file. Is the above example the right way to do it? If yes, how can I do it so the stylesheet.css file will work too. I want to call a different header file for firefox. Is this possible? I don't need to adjust anything in the css file. How can I do this? Hello one and all, Just a quick request here, I've written a script that sends an email with an attached file by the user. (docx, txt, pdf, doc, rtf) are the formats I have accepted. At the moment I'm sending them with the following... Code: [Select] $fileatt_type = "application/pdf"; // File Type It works fine with all formats in older email clients, i.e, like yahoo before they updated the layout, but in the newer versions it's specific and if I try to send it this way it is always delivered as a .PDF and doesn't open if it is any of the other formats. It may sound silly but I've searched a fair bit for the other extensions or formats to include instead of the above code (maybe something like application/doc or something) but there doesn't seem to be a list. Can anyone point me in the right direction? Much obliged, PHP the learned. Hey, I'm trying to open a .php file and read a comment block that is in the beginning of the file. I'm having some trouble in that nothing is being echoed out. Here is the reading file: <?php $fb = fopen("tepl.php", "r"); $data = fread($fb, 8192); fclose($fb); var_dump($data); ?> here is the file (tepl.php) being read: <?php /* Name: Test Plugin 1 URI: http://www.theorangeday.com/plugintest/ Description: This is just a test plugin because I need to test how this thing is going to work overall. Author: Thomas Francis Author URI: http://www.theorangeday.com/ Version: 0.1 */ function test_plugin(){ echo "we loaded the test plug"; } ?> the var_dump returns Code: [Select] string(321) " " What's wrong here? Hello everyone, I'm just starting out with PHP as I need to create an online bookstore for a school project. I'm working by a magazine which should teach you exactly how to do this using PHP, but I've had a bunch of problems with the code they use and I don't really know what's going on. Anyway, this looks really simple and basically what it does is allows you to post a comment on a book, then returns you to the book's page. Problem is, I'm getting the Header may not contain more than a single header, new line detected. error and I can't figure out why. I've tried researching into the matter but all the cases I found had to do with returning to an url, which is not my case. Anyway, here's the snippet of code: The form: Code: [Select] <div style="width:400px; border:1px solid #ffffff; background-color:#F9F1E7; padding:5px"> <b>Adauga opinia ta:</b> <hr size="1"> <form action="adauga_comentariu.php" method="POST"> Nume: <input type="text" name="nume_utilizator"><br><br> Email: <input type="text" name="adresa_email"><br><br> Comentariu: <br> <textarea name="comentariu" cols="45"></textarea><br><br> <input type="hidden" name="id_carte" value="<?=id_carte?>"> <center><input type="submit" value="Adauga"</center> </form> </div> The script adaugare_comentariu.php: Code: [Select] <?php ob_start(); include("conectare.php"); $numeFaraTags=strip_tags($_POST['nume_utilizator']); $emailFaraTags=strip_tags($_POST['adresa_email']); $comentariuFaraTags=strip_tags($_POST['comentariu']); $sql="insert into comentarii (id_carte, nume_utilizator, adresa_email, comentariu) values(".$_POST['id_carte'].", '".$numeFaraTags."','".$emailFaraTags."','".$comentariuFaraTags."')"; mysql_query($sql); $inapoi="carte.php?id_carte=".$_POST['id_carte']; header("location:urldecode($inapoi)"); ob_end_flush(); ?> conectare.php connects to the mysql database. $inapoi is the variable which returns the user to carte.php (the book he posted a comment on), where id_carte is the book's unique id. I'm getting Header may not contain more than a single header, new line detected on line ten, which is the header line. Can anyone help me? I've been stumped on this for a few days now and I've just let it pass and started working on other bits, but it's bugging me too much and I'd like to fix it. This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=350027.0 I am having problems understanding how to sanitize my form data so it is safe to INSERT. If I use this code... Quote $trimmed = array_map('trim', $_POST); $body = mysqli_real_escape_string($dbc, $trimmed['body']); And I enter into my form... Quote O'Reilly's book Then I see this in phpMyAdmin... Quote O\'Reilly\'s book --------- If I use this code... Quote $trimmed = array_map('trim', $_POST); $body = $trimmed['body']; And I enter into my form... Quote O'Reilly's book Then I see this in phpMyAdmin... Quote O'Reilly's book Why the strange behavior?? Debbie Hi There, I have an application that uses a Flash front end. The user fills out a card. The variables of that card are stored in an SQL Database and the recipient gets an email with a unique url to retrieve the card. The problem I am faced with ... is that if the user hits their ENTER key while typing their message to create line breaks.. the line breaks are causing the SWFOBJECT Flash Embed to break. The SWFOBJECT embed code looks like this Quote var flashvars = { yname: "<?php print "$yname";?>", yemail: "<?php print "$yemail";?>", fname: "<?php print "$fname";?>", femail: "<?php print "$femail";?>", greeting: "<?php print "$greeting";?>", message: "<?php print "$message";?>", fullname:"<?php print "$fullname";?>" }; The results look like this when data has been filled out Quote <script type="text/javascript"> var params = { quality: "high", //scale: "ExactFit", wmode: "transparent", menu: "false", allowfullscreen: "true", allowscriptaccess: "always", bgcolor: "#014872" }; var flashvars = { yname: "Jonathon", yemail: "name@email.com", fname: "TEST", femail: "jname@email.com", greeting: "TESTING", message: "Test Test Test", fullname:"" }; You can see the line breaks whe Test Test Test Was typed. Any ideas how to fix this ? The code below is working in relation to what I expect it to do however it is allow causing this error on top of the form everytime... Notice: Undefined index: submit in C:\wamp\www\protek\register.php on line 130 Notice: Undefined index: fullname in C:\wamp\www\protek\register.php on line 133 Notice: Undefined index: email in C:\wamp\www\protek\register.php on line 134 Notice: Undefined index: username in C:\wamp\www\protek\register.php on line 135 Notice: Undefined index: password in C:\wamp\www\protek\register.php on line 137 Notice: Undefined index: password2 in C:\wamp\www\protek\register.php on line 138 The full code being used is > <?php //check for submit $submit =$_POST['submit']; //gather POST variable $fullname =strip_tags($_POST['fullname']); $email =strip_tags($_POST['email']); $username =strip_tags($_POST['username']); $password =strip_tags($_POST['password']); $password2 =strip_tags($_POST['password2']); if ($submit) { //check that fields were filled in if ($fullname&&$email&&$username&&$password&&$password2) { //now we can encrypt our password to md5 $password = md5($password); $password2 = md5($password2); //were done seeting md5 //check to see if our two password fields match if ($password==$password2) { //check to see if the password is greateer than 25 but less than 6 if (strlen($password)>25||strlen($password)<6) { //if it is then echo "<font color='red'>Your password must be between 6-25 characters</font>"; } //otherwise register the user else { echo "Success"; } } //otherwise if passwords don't match else echo "<font color='red'>The passwords you entered do not match</font>"; //end of checking password } else echo "<font color='red'>Please enter all fields!</font>"; } //end check for submit ?> So I have an webapp which has a built in proxy checker. However because I didn't write the code I am kind of confused on whats going on. I have a small amount of knowledge on php been looking all over the net to find a solution. So this file called (proxy_check.php) keeps causing my index.php to show the 404 designed page. The file is required in the index.php file. I believe its something to do with the $reponse variable. Please help <?php # Visitor proxy check snippet $v_ip = $_SERVER['REMOTE_ADDR']; $arContext['http']['timeout'] = 10; $context = stream_context_create($arContext); $response = file_get_contents('http://www.shroomery.org/ythan/proxycheck.php?ip='.$v_ip, 0, $context); if ('Y' === $response) { echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'> <head> <title> The page you were looking for doesn't exist (THIS BUG)</title> <style type='text/css'> body { background-color: #efefef; color: #333; font-family: Georgia,Palatino,'Book Antiqua',serif;padding:0;margin:0;text-align:center; } p {font-style:italic;} div.dialog { width: 490px; margin: 4em auto 0 auto; } img { border:none; } </style> </head> <body> <div class='dialog'> <a><img src='assets/img/404.png'></a> <p>It looks like that page you were looking has been mislaid, sorry.</p> </div> </body> </html>"; die(); }
I have an FLV player and I am using a php file to read an FLV that is above webroot. It reads the FLV just fine, however, during its cache process or while it is still downloading, if I click on the home button (home button of the current site), the server does not respond until the FLV has been fully cached. Now this is only occuring in firefox, chrome and IE. In safari it works fine. Who know, maybe it is a header issue. Here is my script that I pass to my FLV player <?php include("connect.php"); if ($_SESSION['loggedIn'] == true) { $id = $_GET['id']; $query = mysql_query("SELECT video FROM reviews WHERE id = '$id'"); $row = mysql_fetch_array($query); $filename = "../../../armsmedia/videos/".$row['video']; header( 'Content-Description: File Transfer' ); header( 'Content-Type: application/octet-stream' ); header( 'Content-Disposition: attachment; filename='.basename( $filename ) ); header( 'Content-Transfer-Encoding: binary' ); header( 'Expires: 0' ); header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header( 'Pragma: public' ); header( 'Content-Length: ' . filesize( $filename ) ); ob_clean(); flush(); readfile( $filename ); exit; } ?> Hi, i'm new here and have a straightforward question. On a server I use I have this script and we use it to force the download of mp3 files on a single click of a link. (Avoid opening in an internet audio buffering plug in or application) Code: [Select] <?php $filename = $_GET['file']; // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); // addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename,"."),1)); if( $filename == "" ) { echo "<html><title>Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>"; exit; } elseif ( ! file_exists( $filename ) ) { echo "<html><title>Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>"; exit; }; switch( $file_extension ) { case "pdf": $ctype="application/pdf"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "mp3": $ctype="audio/mpeg3"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); ?> I recently got an email from my service provider quoting the following Quote Hello, I apologize, but I was forced to suspend the script /home/mezerik/********/forcedownload.php as it was causing a high load on the server, and due to it affecting all of the other accounts on the system, I forced to take immediate action for the health of the server. Unfortunately I do not have any specific recommendations for this script, however, in general, adding some sort of caching mechanism, where the script does not need to generate a new page with every request, helps to lower the over load that a script will cause. Likely the original author or support group of the software that you are using will be able to help you to understand how to add something of this nature. If you reply back to this with your IP address (http://www.******.com/ip.shtml) we will be more than happy to go ahead enable HTTP access for you, so that you can safely work on the script without it causing further issues. Please let us know how you would like to proceed. I am not sure what is wrong with the script and if it is insecure to the server and should be edited or removed. i want to change this code : $result = mysql_query("select count(*) from 3gp where category='Bollywood'"); with this $result = mysql_query("select count(*) from 3gp where category='$category'"); but i am getting error message "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/funxy/public_html/salmobile.info/3gp-videos.php on line 151". I am calling the page using http://abc.com/3gp-videos.php?category=Bollywood Please help. Code: [Select] <?php $db="funxy_db"; $conn = mysql_connect("localhost","funxy_saba","myasco001"); @mysql_select_db($db) or die( "Unable to select database, Please contact your administrator"); class Pager { function getPagerData($numHits, $limit, $page) { $numHits = (int) $numHits; $limit = max((int) $limit, 1); $page = (int) $page; $numPages = ceil($numHits / $limit); $page = max($page, 1); $page = min($page, $numPages); $offset = ($page - 1) * $limit; $ret = new stdClass; $ret->offset = $offset; $ret->limit = $limit; $ret->numPages = $numPages; $ret->page = $page; return $ret; } } // get the pager input values $page = $_GET['page']; $limit = 3; $result = mysql_query("select count(*) from 3gp where category='Bollywood'"); $total = mysql_result($result, 0, 0); // work out the pager values $pager = Pager::getPagerData($total, $limit, $page); $offset = $pager->offset; $limit = $pager->limit; $page = $pager->page; // use pager values to fetch data $query = "select * from 3gp where category='Bollywood' order by id DESC limit $offset, $limit"; $result = mysql_query($query); // use $result here to output page content //my addition //grab all the content //Custom Table Stsrt// $cols = 4; //number of coloms $i =1; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\" id=\"table1\" bordercolor=\"#FFFFFF\" bgcolor=\"#FFFFFF\">" ."<tr>"; while($r=mysql_fetch_array($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $id=$r["id"]; $name=$r["name"]; $views=$r["views"]; $url=$r["url"]; $image=$r["image"]; $category=$r["category"]; //display the row $mybox = " <br> <a href='http://salmobile.info/3gp-videos-download.php?id=$id' class=\"classd\"><b><u> $name</u></b></a> <BR> <span class=\"text\"><img src=\"$image\" width=\"60\" height=\"60\"></span> <BR> <span class=\"text2\">Download This 3GP Video</span> <br>"; if (is_int($i / $cols)){ echo "<td width='336' align='center' style=\"border-style: dotted; border-width: 0\">$mybox</td></tr><tr>"; }else{ echo "<td width='336' align='center' style=\"border-style: dotted; border-width: 0\">$mybox</td>"; } if ( $i / $cols == 3) echo "<td colspan='3' align=\"center\"> </td></tr><tr>"; if ( $i / $cols == 8) echo "<td colspan='3' align=\"left\"> </td></tr><tr>"; $i++; //end if }//end while echo "</tr></table>"; //Custom Table End// //ends my addition // output paging system (could also do it before we output the page content) if ($page == 1) // this is the first page - there is no previous page echo "<font color=\"#FFB300\">Previous</font>"; else // not the first page, link to the previous page echo "<a href=\"http://salmobile.info/index-" . ($page - 1) . ".html\" id=\"navigationURL\"><font color=\"#FFB300\">Previous</font></a>"; for ($i = 1; $i <= $pager->numPages; $i++) { echo " <font color=\"#FFFFFF\">|</font> "; if ($i == $pager->page) echo "<font color=\"#FFB300\"> $i</font>"; else echo "<a href=\"http://salmobile.info/index-$i.html\" id=\"navigationURL\"> <font color=\"#FFB300\">$i</font></a>"; } if ($page == $pager->numPages) // this is the last page - there is no next page echo "Next"; else // not the last page, link to the next page echo " <a href=\"http://salmobile.info/index-" . ($page + 1) . ".html\" id=\"navigationURL\"><font color=\"#FFB300\">Next</font></a>"; ?> I found a script online that I am trying to get working. It was giving a 500 error from the get go and I've pinpointed it to the $data = fread() line. Does anyone know why? <?php $file = "../../media/v_360.m4v"; $filesize = filesize($file); $offset = 0; $length = $filesize; if (isset($_SERVER['HTTP_RANGE'])) { // if the HTTP_RANGE header is set we're dealing with partial content $partialContent = true; // find the requested range // this might be too simplistic, apparently the client can request // multiple ranges, which can become pretty complex, so ignore it for now preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches); $offset = intval($matches[1]); $length = intval($matches[2]) - $offset; } else { $partialContent = false; } $file = fopen($file, 'r'); // seek to the requested offset, this is 0 if it's not a partial content request fseek($file, $offset); $data = fread($file, $length); /* fclose($file); if ($partialContent) { // output the right headers for partial content header('HTTP/1.1 206 Partial Content'); header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize); } // output the regular HTTP headers header('Content-Type: ' . $ctype); header('Content-Length: ' . $filesize); header('Content-Disposition: attachment; filename="' . $fileName . '"'); header('Accept-Ranges: bytes'); // don't forget to send the data too print($data); */ ?> Its trying to read a 60mb file. Do you think it is timing out and that is causing the error? Ok, i am adding a few things onto a "php email form" script, everything works as it should apart from this. The php email form, catches the submitted data and emails it accordingly, then after that, i use some of the data and show it, one form value i would like to show is from a radio button. Theres two radio buttons in one group. The radio buttons group name is "postage", value1 = "first" value2 = "second". $post1 is one cost, and $post2 is another cost, both get submitted an received fine. And as it stands when i submit the form without the line below, and tell it to echo "postage", it works fine. IF though i add this line after: if ($postage = "first") {$post_cost = $post1;} elseif ($postage = "second") {$post_cost = $post2;} If simply just comes threw as "first" everytime regardless, Why?? Heres the code for this section: //Collect postage details if(isset($_REQUEST['postage'])){$postage = stripslashes($_REQUEST['postage']);} if(isset($_REQUEST['post1']) && !empty($_REQUEST['post1'])){$post1 = stripslashes($_REQUEST['post1']);} if(isset($_REQUEST['post2']) && !empty($_REQUEST['post2'])){$post2 = stripslashes($_REQUEST['post2']);} if(isset($_REQUEST['Total:']) && !empty($_REQUEST['Total:'])){$total = stripslashes($_REQUEST['Total:']);} //Get disired postage type $post_cost = 0; if ($postage = "first") {$post_cost = $post1;} elseif ($postage = "second") {$post_cost = $post2;} //Work out total to pay $totaltopay = $total+$post_cost; ?> Thanks Andy |