PHP - Headers Sporadically Being Outputted As Text In Php Driven Css Document.
Similar TutorialsIm inserting HTML into a database, and then outputting it on a PHP page. Its an iframe code, so when I output it, it shows the iframe. I need it to just display the HTML code. How can I do this? I thought it would be something simple but I can find anyway to do it. Help very appreciated!! Thanks I basically have a PHP Search Form, and when a user fills in a form it outputs the results. Each result displays a image of a property, how could i make them images have their own unique link which will take them directly to the page of the property being shown? Im using PHP and mySQL tables Any help is appreciated, Thank You. Heres the PHP that outputs the results: Code: [Select] <?php require_once 'mstr_ref.php'; function san($input){ if(get_magic_quotes_gpc()){ $input=stripcslashes($input); } $output = mysql_real_escape_string($input); return $output; } if(isset($_POST['submit'])){ $pVars = array('area'=>$_POST['areas'], 'propType'=>$_POST['prop_type'], 'saleType'=>$_POST['ptype'], 'minB'=>$_POST['min_bedrooms'], 'maxB'=>$_POST['max_bedrooms'], 'minP'=>$_POST['min_price'], 'maxP'=>$_POST['max_price']); foreach ($pVars as $k=>$v){ $v = san($v); } $sql = new makeQuery(); $sql->manAdd('location_id', $pVars['area']); if($pVars['propType'] != 'Any'){ $sql->manAdd('catagory_id', $pVars['propType']); } if ($pVars['maxB'] > 0){ $sql->manAdd('bedrooms', $pVars['maxB'], '<='); } if($pVars['minB'] > 0){ $sql->manAdd('bedrooms',$pVars['minB'],'>='); } if($pVars['saleType'] != 'Any'){ if($pVars['saleType'] == "forsale"){ $sql->manAdd('market_type', 'sale'); if($pVars['minP'] != 0){ $pVars['minP'] = $pVars['minP'] * 1000; } if($pVars['maxP'] != 0){ $pVars['maxP'] = $pVars['maxP'] * 1000; } } if($pVars['saleType'] == 'forrent'){ $sql->manAdd('market_type', 'rent'); } } $qry = $sql->sqlStart.$sql->stmt.'Group By property.id'; $results = mysql_query($qry) or die (mysql_error()."<br />|-|-|-|-|-|-|-|-|-|-|-|-<br />$qry"); if(mysql_num_rows($results) < 1){ die ("Sorry, No Results Match Your Search."); } while($row = mysql_fetch_assoc($results)){ echo '<div class="container" style="float:left;">'; echo '<div class="imageholder" style="float:left;">'; echo "<img class='image1' src='{$row['image_path']}' alt='{$row['summary']}'> <br />"; echo '</div>'; echo '<div class="textholder" style="font-family:helvetica; font-size:14px; float:left; padding-top:10px;">'; echo "{$row['summary']}"; echo "<span style=\"color:#63be21;\"><br><br><b>{$row['bedrooms']} bedroom(s) {$row['bathrooms']} bathroom(s) {$row['receptions']} reception room(s)</b></span>"; if($row['parking'] != null){ echo "<span style=\"color:#63be21;\"><b> {$row['parking']} parking space(s)</b></span>"; } echo '</div>'; echo '<div style="clear:both"></div>'; } } else{ echo "There was a problem, please click<a href='index.php'> Here </a>to return to the main page and try again"; } ?> Hi, When the user creates a contact, then edits the contact that final edited information is shown in a file called "my data.txt". After this, when I select my php file "save_contact_details.php" the details stored in the text file "my data.txt" are not retrieved. How can I retrieve them? At the moment the issue I'm having is that I see no data when I click on "save_contact_details.php" after I filled in all the contact persons information. Feel free to watch this video I recorded to help you understand what I am talking about. https://streamable.com/rbw6p save_contact_details.php code <html> <body> <?php $myFile=fopen("mydata.txt","r") or exit("Can’t open file!"); // Write each line of text into the text file file fwrite($myFile, $_POST["lastname"]."\r\n"); fwrite($myFile, $_POST["firstname"]."\r\n"); fwrite($myFile, $_POST["address01"]."\r\n"); fwrite($myFile, $_POST["address02"]."\r\n"); fwrite($myFile, $_POST["town"]."\r\n"); fwrite($myFile, $_POST["postcode"]."\r\n"); fwrite($myFile, $_POST["telephone"]."\r\n"); fwrite($myFile, $_POST["email"]."\r\n"); fclose($myFile); ?> <h1>My Contact Details</h1> <p>The contact details that you have submitted are shown below:</p> <table> <tr> <td align="right">Last name: </td> <td><?php echo $_POST["lastname"]; ?></td> </tr> <tr> <td align="right">First name: </td> <td><?php echo $_POST["firstname"]; ?></td> </tr> <tr> <td align="right">Address 01: </td> <td><?php echo $_POST["address01"]; ?></td> </tr> <tr> <td align="right">Address 02: </td> <td><?php echo $_POST["address02"]; ?></td> </tr> <tr> <td align="right">Town / city: </td> <td><?php echo $_POST["town"]; ?></td> </tr> <tr> <td align="right">Post code: </td> <td><?php echo $_POST["postcode"]; ?></td> </tr> <tr> <td align="right">Telephone: </td> <td><?php echo $_POST["telephone"]; ?></td> </tr> <tr> <td align="right">E-mail: </td> <td><?php echo $_POST["email"]; ?></td> </tr> </table> </body> </html>
<html> <body> <?php $myFile=fopen("mydata.txt","r") or exit("Can’t open file!"); // read each line of text from the text file $lastname = fgets($myFile); $firstname = fgets($myFile); $address01 = fgets($myFile); $address02 = fgets($myFile); $town = fgets($myFile); $postcode = fgets($myFile); $telephone = fgets($myFile); $email = fgets($myFile); fclose($myFile); ?> <h1>My Contact Details</h1> <p> The contact details on file are as shown below.<br> Edit the data and save your changes to file. </p> <form action="save_contact_details.php" method="post"> <table> <tr> <td align="right">Last name: </td><td> <?php echo "<input size=\"20\" type=\"text\" name=\"lastname\" value=\"$lastname\">"?> </td> </tr> <tr> <td align="right">First name: </td><td> <?php echo "<input size=\"20\" type=\"text\" name=\"firstname\" value=\"$firstname\">"?> </tr> <tr> <td align="right">Address 01: </td><td> <?php echo "<input size=\"30\" type=\"text\" name=\"address01\" value=\"$address01\">"?> </td> </tr> <tr> <td align="right">Address 02: </td><td> <?php echo "<input size=\"30\" type=\"text\" name=\"address02\" value=\"$address02\">"?> </td> </tr> <tr> <td align="right">Town / city: </td><td> <?php echo "<input size=\"20\" type=\"text\" name=\"town\" value=\"$town\">"?> </td> </tr> <tr> <td align="right">Post code: </td><td> <?php echo "<input size=\"10\" type=\"text\" name=\"postcode\" value=\"$postcode\">"?> </td> </tr> <tr> <td align="right">Telephone: </td><td> <?php echo "<input size=\"15\" type=\"text\" name=\"telephone\" value=\"$telephone\">"?> </td> </tr> <tr> <td align="right">E-mail: </td><td> <?php echo "<input size=\"50\" type=\"text\" name=\"email\" value=\"$email\">"?> </td> </tr> <tr> <td> </td> <td colspan="2" align="left"><input type="submit" value="Save Changes"></td> </tr> </table> </form> </body> </html> create contact html code <html> <body> <h1>The contact details</h1> <p>Please enter your contact details:</p> <form action="save_contact_details.php" method="post"> <table> <tr> <td align="right">First name: </td> <td><input size="20" type="text" maxlength="15" name="firstname"></td> </tr> <tr> <td align="right">Last name: </td> <td><input size="20" type="text" maxlength="15" name="lastname"></td> </tr> <tr> <td align="right">Address line 1: </td> <td><input size="30" type="text" maxlength="50" name="address01"></td> </tr> <tr> <td align="right">Address line 2: </td> <td><input size="30" type="text" maxlength="50" name="address02"></td> </tr> <tr> <td align="right">Town / city: </td> <td><input size="20" type="text" maxlength="20" name="town"></td> </tr> <tr> <td align="right">Post code: </td> <td><input size="10" type="text" maxlength="10" name="postcode"></td> </tr> <tr> <td align="right">Telephone: </td> <td><input size="15" type="text" size="20" maxlength="15" name="telephone"></td> </tr> <tr> <td align="right">E-mail: </td> <td><input size="50" type="text" maxlength="50" name="email"></td> </tr> <tr> <td> </td> <td colspan="2" align="left"><input type="submit" value="Submit"></td> </tr> </table> </form> </body> </html>
Hello, I was wondering how i could count how many times the number 1 appers in the document and 2, 3, 4, 5, 6, 7, 8, 9, 10. The text will have over 1000000 results set out like this: Code: [Select] 2 10 1 4 2 7 5 3 8 10 1 7 7 2 1 9 3 3 7 3 1 5 2 1 4 7 7 9 10 2 5 8 10 9 8 3 2 2 9 6 8 8 8 2 5 1 9 3 5 9 3 4 6 7 5 6 9 2 3 6 2 once it has counted the charicters i want it to put it in to a table I have all redey made the table: Code: [Select] <table border="1"> <tr> <th>1</th> <th>2</th> <th>3</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> </tr> <tr> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> <td>number of numbers</td> </tr> </table> I have looked at the count_chars function but the manule is ver confuzerling if anyone could explane how i could do this it would be great Thanks Jragon Folks, I need help (Php code ) to generate a Dynamic Text on a Base Image. What i want to do is, to make this Image as header on my Site and to make this Header Specific to a Site, i want to Add the Domain Name on the Lower Left of the Image. Got the Idea? Here is the Image link: Quote http://img27.imageshack.us/i/shoppingheader1.jpg/ PHP Variable that holds the Domain name is: $domain All i need the Dynamic PHP Codes that i can put on all my sites to generate this Text on Image (Header) Dynamically... May Anyone Help me with this Please? Cheers Natasha T. I currently have an HTML form where the options for a certain drop-down menu are hard-coded. Instead, I want to use PHP to... 1. Look up the values in a column (cities) in a MySQL table (locations) 2. Make those values the only options in the dropdown menu. Any ideas how I would do this? This is what I have so far. <label for="city">What is your destination city?</label> <select class="form-control" id="city" name="city"> <?php //connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); //grab the city names from the MySQL table $query = "SELECT cities FROM locations"; $res = mysqli_query($dbc, $query); while ($data = mysqli_fetch_assoc($res)) { echo '<option value="'.$data['cities'].'">'.$data['cities'].'</option>'; } //close the db connection mysqli_close($dbc); ?> </select> Hey folks! a two-part problem he PART 1: here's a weird problem i bumped into today. when i leave OUT the 'varTable' section (see the class designations), it generates a table (allbeit messed up for reasons that i'll get into in part 2). but when i put 'varTable' back in, it generates the first array output just fine, but nothing shows for the table. (i need the first to be able to display the array) why does that happen? PART 2: when the table DOES generate, it gives a lot of errors and $i counts up to 7! whaaaaat!? thanks in advance for your help. this has me stumped. i've tried resetting the array, different variable names...nothing worked. i also included the array output at the very bottom. seems like a lot of extra data in there to me...and the [ 0 ] is printing oddly here (spaces prevent odd formatting...). WR! DATABASE TABLE: | id | item | cost | use | -------------------------------- | 0 | basket | 35 | 1 | | 1 | bicycle | 165 | 1 | | 2 | glass | 5 | 1 | | 3 | running shoe | 156 | 1 | | 4 | silver | 300 | 1 | PHP CODE: Code: [Select] <?php include("constants.php"); <?php $connexion = mysql_connect(DB_SERVER, DB_USER, DB_PASS); if(!$connexion) { die("Database Connection Failed: ".mysql_error()); } $selectDB = mysql_select_db("DB_CHOICE", $connexion); if(!$selectDB) { die("Database Selection Failed: ".mysql_error()); } $query = "SELECT * "; $query .= "FROM basic_table"; $results = mysql_query($query, $connexion); if(!$results) { die("Database Query Failed: ".mysql_error()); } ?> <div> <pre class="varTable"> <?php while($checkTable = mysql_fetch_array($results)) { print_r($checkTable); } ?> </pre> </div> <br><br> <div id='codeBlock'> <table class='phpTable' width='500' cellpadding="10"> <?php // generate table header row while ($tableRow = mysql_fetch_array($results)) { echo "<tr>"; for($i=0; $i<count($tableRow); $i++) { echo "<td>" . $tableRow[$i] . "</td>"; } echo "</tr>\n"; } ?> </table> ARRAY OUPUT: Code: [Select] Array ( [0] => 1 [id] => 1 [1] => basket [item] => basket [2] => 35 [cost] => 35 [3] => 1 [usable] => 1 ) Array ( [0] => 2 [id] => 2 [1] => bicycle [item] => bicycle [2] => 165 [cost] => 165 [3] => 1 [usable] => 1 ) Array ( [0] => 3 [id] => 3 [1] => glass [item] => glass [2] => 5 [cost] => 5 [3] => 1 [usable] => 1 ) Array ( [0] => 4 [id] => 4 [1] => running shoe [item] => running shoe [2] => 14 [cost] => 14 [3] => 1 [usable] => 1 ) Array ( [0] => 5 [id] => 5 [1] => silver [item] => silver [2] => 300 [cost] => 300 [3] => 1 [usable] => 1 ) I am trying to write out a calendar style html table with data in each cell, and with a column on the left that shows the times. Basically it should look like this when written out to the webpage: Time Mon Tues Wed Thur Fri Sat 8:00 data data2 9:30 data3 data4 10:00 data5 data6 11:00 data7 data8 The times on the left will vary each month, and the 'data' (these are actually fitness classes held each month) will appear on various days of the week. There is no need to toggle from one month to the next and such, it's just a listing of the current month to display the classes held on which days and at which times. Very easy to do statically in html, but a bit more challenging dynamically. Using MySQL, the table that holds the data looks like this: Code: [Select] schedule_id class_time class_title day_order 1 08:00 data 1 2 08:00 data2 3 3 09:30 data3 2 4 09:30 data4 4 5 10:00 data5 3 6 10:00 data6 5 7 11:00 data7 1 8 11:00 data8 3 The day_order field corresponds to the weekday - Mon is 1, Tues is 2, etc. My query looks like this: Code: [Select] SELECT schedule_id, class_time, class_title, day_orderFROM `class_schedule` order by class_time, day_order Here is the html/ php code to write it out: Code: [Select] <table border="0" cellpadding="2" cellspacing="0" width="625"> <tr> <td class="calheader">Time</td> <td class="calheader">Mon</td> <td class="calheader">Tue</td> <td class="calheader">Wed</td> <td class="calheader">Thu</td> <td class="calheader">Fri</td> <td class="calheader">Sat</td> <td class="calheader">Sun</td> </tr> <? $i=0; $first_time = ""; while($i<$num_rows){ $sid = mysql_result($sql,$i,"schedule_id"); $ctime = mysql_result($sql,$i,"class_time"); $cdate = mysql_result($sql,$i,"CURDATE()"); $strtime = date("h:i:s",$cdate.$ctime); $ctitle = stripslashes(mysql_result($sql,$i,"class_title")); $order = mysql_result($sql,$i,"day_order"); if ($ctime != $first_time){ if (isset($first_time)){ echo ""; } if ($first_time == ""){ echo "<tr>\n"; echo "<td class=\"timecell\">". $ctime ."</td>\n"; } $first_time = mysql_result($sql,$i,"class_time"); } $j = 1; while ($j<8 && $first_time != ""){ if ($order == $j){ $thetitle = $ctitle; } else { $thetitle = " "; } echo "<td class=\"calcell\">". $thetitle ."</td>\n"; $j++; } unset($first_time); if (!isset($first_time)) { echo "</tr>\n"; } $i++; } unset($ctitle); unset($thetitle); unset($weekday); unset($sid); unset($clink); unset($order); mysql_close(); The above code sort of works, but the trouble I am having is that it is creating a new table row for each class, even if they occur at the same time slot. It should be putting them on the same row, to the right of the time slot across the days of the week. If anyone could assist, that would be wonderful - I am really stuck with this... Thanks Hello, I am making a small CMS and I having some trouble with making a dynamic menu. I am wondering for a few days how I should make this menu system. I have the follow MySQL table: Code: [Select] CREATE TABLE `pages` ( `id` int(4) unsigned NOT NULL AUTO_INCREMENT, `time` varchar(10) DEFAULT NULL, `lastby` varchar(2) DEFAULT NULL, `order_id` varchar(2) DEFAULT NULL, `text` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB; Now I would like to have a menu system as following that I make menu's in a menu table with a name and a menu ID and that I could place those pages as parent or as subparent. How could I manage to turn my theory into reality? Hello all; I have a client that has a members area. He asked me to password protect it, which I did simply by assigning one static password. Now he wants a full username/login system where the member can set their own password, which I have never done before. I assume I'd just set up a Table with three fields, (one for name, one for password, one for the type of access they have) then check against it for access, but experience has taught me that whenever something seems simple, it's actually very complex. Do any of you know of any good premade templates for this kind of thing? Ideally it'd be session-based (obviously). I found one system he http://frozenade.wordpress.com/2007/11/24/how-to-create-login-page-in-php-and-mysql-with-session/ but it's several years old, and the misspellings in the comments tend to scare me away a bit. Thanks for any help you might be able to provide. Sorry for my bad english but i hope you would understand my query. How can i set 404 not found for database driven pages..? I am using header("HTTP/1.0 404 Not Found"); in my 404 error page and ErrorDocument 404 /404.html, whereas 404.html is my error page. i have an URL http://www.example.com/folder/my-test-for-url-95/ which is opening correctly because it has existence on database. but when i am opening http://www.example.com/folder/my-test-for-url-951/ which has existence on database is also opening without any information but i want here a 404 not found page. How can i do so. Thanks This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=351877.0 Whats the best way to make a database driven menu ? Right now I have a db that looks like id | boats | Inshore id | boats | Offshore id | boats | Bay Boats and so on I'm think of going to database 1 id-1 | boats database 2 id | 1 | inshore or would a multideminsional array work best. My goal is to have the short term format be Boats Inshore Offshore Bay Boats and in the long term a format whose style I can change later, I wanted to get ideas from people in the know and have done this before. Thanks in advance Hi all, I am wondering what the best way to do this is... Take GoDaddy for example, if your domain is about to expire you will get an automatic email. I am wanting to do something similar, If someone orders a Soap Dispenser, I want to send an email (if they accept to receiving emails on the order) each month asking/reminding them to top up on soap. I have been reading but cant find anything adequate, I have seen something about Cron Jobs, but never heard of this before, please could you point me in the right direction. Thanks in advance. Peter create table mimi (mimiId int(11) not null, mimiBody varchar(255) ); <?php //connecting to database include_once ('conn.php'); $sql ="SELECT mimiId, mimiBody FROM mimi"; $result = mysqli_query($conn, $sql ); $mimi = mysqli_fetch_assoc($result); $mimiId ='<span>No: '.$mimi['mimiId'].'</span>'; $mimiBody ='<p class="leading text-justify">'.$mimi['mimiBody'].'</p>'; ?> //what is next? i want to download pdf or text document after clicking button or link how to do that Okay, I've read all the rules for Headers...still can't it to execute properly. At the bottom is my code. I basically want to check the database, see if the user is already registered, and redirect as appropriate (there is no HTML on my page, no info sent to the browser). My server doesn't send any error messages. All I get are white screens. Now, if I do the headers_sent()...it tells me that it's sent right after the initial connection with the database. The ONLY way I can get it to redirect, is if I put <?php header("location:index.php?msg=3"); ?> at hte very top, but then I can't evalute...which doesn't help me much. Here is the code (obviously, I have more...but it's sending headers in these lines) <?php $connection = mysql_connect("localhost","####","#####"); if (!$connection){ echo mysql_errno().": ".mysql_error()."<br/>"; exit; } if(!mysql_select_db("prixaurora")){ echo("Database not found<br>"); } hello, I'm using this code: <?php if (isset($_REQUEST['email'])) { $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $code = $_REQUEST['code'] ; $from = $email; mail("email@email.com", "Winner request id: $name - code: $code", "From:" . $from); } $headers = "From:" . $from; header('Location: index.php?done'); ?> And I'm getting: Code: [Select] Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/config.php:10) in /home/site/public_html/send.php on line 13 This worked before. Many thanks I have a form as a php include and it's giving me this error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/altimusw/public_html/www.csmsolution.com/register.php:6) in /home/altimusw/public_html/www.csmsolution.com/core.php on line 17 Here is the main page that includes the php include: <!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>CSM Solution </title> <style type="text/css"> <!-- #Layer1 { position:absolute; left:100px; top:70px; width:800; height:62px; z-index:1; } .style1 { font-family: Arial, Helvetica, sans-serif; color: #535959; font-size: 12px; } --> </style> </head> <body> <div id="Layer1"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="97"><img src="images/header.jpg" width="800" height="59" border="0" usemap="#Map" /><br /> <img src="images/navbar.jpg" width="800" height="38" border="0" usemap="#Map2" /> <map name="Map2" id="Map2"> <area shape="rect" coords="506,1,552,26" href="contact.php" /><area shape="rect" coords="459,1,502,26" href="form.php" /><area shape="rect" coords="396,-1,455,25" href="login.php" /> <area shape="rect" coords="357,0,393,26" href="index.php" /> </map> </td> </tr> <tr> <td><img src="images/welcome_img.jpg" width="131" height="21" /></td> </tr> <tr> <td><?php include("form.php"); ?></td> </tr> <tr> <td><img src="images/placeholderclouds_bottem.jpg" width="800" height="60" /></td> </tr> </table> </div> </body> </html> Here is the Core.php the error is referring to: <?php //CSM Solution Core. Rahul Parkar 2010 $_config = array(); $_config['db_type'] = "mysql"; $_config['db_server'] = "localhost"; $_config['db_username'] = "altimusw_csm"; $_config['db_password'] = ']17=rXh7tJ0~'; $_config['db_database'] = "altimusw_csm"; $_config['db_tbl_prefix'] = ''; $_config['user_table'] = "customers"; $_config['user_username'] = "username"; $_config['user_password'] = "password"; $_config['user_active'] = "approved"; $_config['user_role1'] = "prirole"; $_config['user_role2'] = "secrole"; $_config['pass_hash_func'] = "SHA1"; session_start(); function fetch_row($query) { build_connection($db); sql_exec($db, $query, $result); sql_fetchone($result, $row); finish_connection($db); return $row; } function build_connection(&$db) { global $_config; if ($_config['db_type'] == "mysql") { $db = mysql_connect($_config['db_server'], $_config['db_username'], $_config['db_password']) or die(mysql_error()); mysql_select_db($_config['db_database'], $db) or die(mysql_error()); } } function sql_exec(&$db, $query, &$result) { global $_config; if ($_config['db_type'] == "mysql") $result = mysql_query($query, $db) or die(mysql_error() . "/$query"); } function sql_fetchone(&$result, &$row) { global $_config; if ($_config['db_type'] == "mysql") { $row = mysql_fetch_assoc($result); @mysql_free_result($result); } } function sql_do(&$db, $query) { global $_config; sql_exec($db, $query, $noclue); finish_connection($db); } function finish_result(&$result) { global $_config; if ($_config['db_type'] == "mysql") @mysql_free_result($result); } function finish_connection(&$db) { global $_config; if ($_config['db_type'] == 'mysql') mysql_close($db); } function check_auth($username, $password) { global $_config; $row = fetch_row("SELECT `" . $_config['user_active'] . "`, `" . $_config['user_password'] . "`, " . $_config['pass_hash_func'] . "('" . $password . "') AS `passcheck`, `fname`, `lname` FROM `" . $_config['user_table'] . "` WHERE `" . $_config['user_username'] . "`='" . $username . "' LIMIT 1"); if (!$row[$_config['user_active']]) { return -1; } else { if ($row[$_config['user_active']] != 1) { return -2; } else if ($row[$_config['user_password']] == $row['passcheck']) { $_SESSION['username'] = $username; $_SESSION['fname'] = $row['fname']; $_SESSION['lname'] = $row['lname']; return 1; } else { return -1; } } } function load_access() { global $_config; if ($_SESSION['username']) { $row = fetch_row("SELECT `" . $_config['user_role1'] . "` FROM `" . $_config['user_table'] . "` WHERE `" . $_config['user_username'] . "`='" . $_SESSION['username'] . "' LIMIT 1"); $role1 = $row[$_config['user_role1']]; $_SESSION['role1'] = $role1; } else { return -1; } } function has_level() { for ($i = 0; $i < func_num_args(); $i++) { if (func_get_arg($i) == $_SESSION['role1']) { return 1; } } return 0; } ?> My error: Code: [Select] Warning: Cannot modify header information - headers already sent by (output started at /www/zxq.net/w/e/b/webaskius/htdocs/index.php:7) in /www/zxq.net/w/e/b/webaskius/htdocs/functions.php on line 6 Now, I can't quite figure out why it's doing this. The section of code that is causing this problem is above any HTML tags, at the very beginning of the file. <?php include('functions.php'); ?> <link href="style.css" rel="stylesheet" type="TEXT/CSS"> <img src="logo.png" border="0"> <div id="maincontent"> As you can see, the functions that cause this error are at the VERY beginning of my file. This is where they are called within index.php: if(mysql_num_rows($query_verify_login) > 0) { create_cookie(10000, 'user', $username); redirect('index.php'); } else { echo 'Woops! You\'ve entered in the wrong username and password combination!'; } And finally, my functions: <?php //our cookie creator function function create_cookie($time, $name, $data) { setcookie($name, $data, time()+$time); } function redirect($url) { header('Location: '. $url .''); } function get_replies($id) { //set query to find posts that match our id $query_get_replies = mysql_query("SELECT * FROM replies WHERE to = {$id}"); return mysql_num_rows($query_get_replies); } ?> |