Yet Another "session_start() Cannot Send Session Cache Limiter - Headers Already Sent" Question
I'm somewhat of a newbie to PHP coding, but have developed a site
using the technology, and have been pleasantly surprised by the
capabilities offered. I am more comfortable in the ASP world, however
and am really struggling with managing sessions in PHP, based on my
experiences with managing sessions in ASP.
99.9% of the feedback I have seen when dealing with the errors has
referred to having whitespace before the <?php or after the ?>. I
have opened my source in several different editors and can't find that
to be the case with my code. Aside from having general issues with
the basic methodology in which I am managing sessions, I am completely
perplexed as to why I am getting these errors, from time to time...
For those who might have recommendations on an overall session
management strategy, I basically want to allow my user to come into my
site, through any page that might be bookmarked. Not all pages are
going to require a session, but they may be required to have a session
value set in order to perform certain administrative functions (which
requires a successful login), so I would need to check for the
existence of a session value and log them in and set it, if it doesn't
exist...
Now to my specific problem...
I have an include page called master_session.php, which looks like
this (no whitespaces before or after php tags):
=================================
<?php
if (! isset($ADMIN_session)) {
ob_start();
ob_clean();
session_start();
session_register("ADMIN_session");
}
?>
=================================
I have a login page, which looks like this (no whitespace before the
include of master_session)
=================================
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_session.php'); ?>
<?php if ($content_identifier == false){
$content_identifier = 'parish'}?>
<? $page_title = "Administration"; ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_header.php'); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
master_nav.php'); ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/common/includes/
bg100.php'); ?>
<!----CONTENT AREA -- PLACE INCLUDE PATH AND FILE NAME BELOW---->
<form name="criteria_form" action="adminvalidation.php" method="post">
<table height="100%" border="0" width="81%" align="center"
background="/common/bkgrnds/bg100.gif"">
<tr>
<td colspan="2" height="40"> </td>
</tr>
<? if (${"login"} == "invalid")
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Session_start(): Cannot Send Session Cache Limiter - Headers Already Sent
I'm getting this warning: [15-May-2006 18:11:35] PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php on line 14 line 14 is this: session_start(); why is that creating a warning?
Problem With Session_start() - Cannot Send Session Cookie/cache Limiter
Hi, i am getting the following errors when running my php script: Warning: Cannot send session cookie - headers already sent by (output started at c:apacheapache2htdocs hegainindex.php:4) in c:apacheapache2htdocs hegainindex.php on line 19 Warning: Cannot send session cache limiter - headers already sent (output started at c:apacheapache2htdocs hegainindex.php:4) in c:apacheapache2htdocs hegainindex.php on line 19 ....the script i am trying to run is as follows: <?php session_start(); //start session to get session variables //this code is to check if a custom session variable exists. if none, create one. if (!isset($custom_sessid)) { $custom_sessid = md5($_SERVER['REMOTE_ADDR'] . " " . date("Y-m-d H:i:s")); // create a session id session_register("custom_sessid"); // register newly ceated session variable } $indate = date("Y-m-d H:i:s"); $page_id = 1; //each page will have its own number $insert = "INSERT INTO tracker (tracker_id, page_id, indate, custom_sessid) values (null, $page_id, '$indate', '$custom_sessid')"; $result = mysql_query($insert);....
Cannot Send Session Cache Limiter - Headers Already Sent..
I am using xampp and developed a simple page with the session_start() function. But whenever I browse the page it just shows the following warning just on the first line and the whole page is being browsed from the next line of the warning. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:Program FilesxampphtdocsprojectMain.php:1) in C:Program FilesxampphtdocsprojectMain.php on line 3 That's the problem. We are using xampp version 1.5.5. Could someone plz help me find the problem? Another information is I've sent it to another person and he said it's okay at his PC with apache2triad.So what could be the possible solutions?
Warning: Cannot Send Session Cache Limiter - Headers Already Sent
I am currently working ona site whoch uses logins and sessions... I am trying ti implement the use of fast Tamples class which will allow me to wrap my dynamic content in a static HTML file. However the problem is:- Warning: Cannot send session cache limiter - headers already sent (output started at welcome2.php:1) in /lib/check_session_php.lib on line 3 The check session is an include to check for a valid session, thata user has created upon successful log-in... Anyone familiar with the fast templates class and could possibly help me debug this problem.
Warning: Cannot Send Session Cache Limiter - Headers Already Sent
Here is the error message I get in my page: Warning: Cannot send session cookie - headers already sent by (output started at /web/sites/79/wdhead/www.webheadsolutions.f2s.com/index.php:6) in /web/sites/79/wdhead/www.webheadsolutions.f2s.com/index.php on line 352 Warning: Cannot send session cache limiter - headers already sent (output started at /web/sites/79/wdhead/www.webheadsolutions.f2s.com/index.php:6) in /web/sites/79/wdhead/www.webheadsolutions.f2s.com/index.php on line 352
"Cannot Send Session Cookie ..." I Truely DON'T Output ANYTHING Before Calling Session_start()
there are many postings on this subject, I have read them put don't have an answer. I get these warnings: Cannot send session cookie - headers already sent in, but my php-scripts are okay. As you can see in the code and response below, I really don't output anything. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = my PHP-Code #!/usr/bin/php <?php session_start(); if (!isset($_SESSION['content'])) { $_SESSION['content']=""; $_SESSION['task']=0; } session_regisyoter("content"); error_reporting (E_ALL); set_time_limit(0); ....
Cannot Send Session Cache Limiter
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/minipla/public_html/cart.php:2) in /home/minipla/public_html/cart.php on line 8
Warning: Cannot Send Session Cache Limiter
What does this mean?: "Warning: Cannot send session cache limiter - headers already sent (output started at /home/mysite/www/file.php:2) in /home/mysite/www/includedfile.php on line 6"
Warning: Cannot Send Session Cache Limiter -
I have a login page and whenever I enter the user name and password and hit enter i get the following message: " Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/html/packet/checklogin.php:6) in /var/www/html/packet/checklogin.php on line 23 " sometimes I have to login 2-3 times before i actually get transferred to the next page.
Header("Cache-Control: Public") Not Working
I have read somewhere else in this newsgroup that the way to avoid the message (Warning: Page has Expired blah, blah blah ... ) when one presses the back button is to place the statement header("Cache-Control: public"); at the top of the script. I have done this but I still get the annoying message. The session.cache_expire in php.ini is set to 180. I am using shared SSL.
How Do I Do Something Like $color = ("red", "yellow", "blue")[$colornum]?
How do I take an index of a literal array, instead of a variable? That is, say I want to get the short name of a month. Can I do something like: $monthname = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")[$month]; or do I always have to do: $blah = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $monthname = $blah[$month]; It seems a shame to have to create a variable specifically for this one-shot purpose.
"Premature End Of Script Headers: Php.cgi"
I have compiled PHP 5.2.3 as a CGI binary, and this works. I can, for example, do the following: $ php.cgi hello_world.php X-Powered-By: PHP/5.2.3 Content-type: text/html Hello World! === However, this completely fails when I attempt to route PHP scripts through this new CGI executable with .htaccess. My approach is this: File: doc_root/.htaccess AddHandler phpFive .php Action phpFive /php.cgi (doc_root/php.cgi links to the correct executable) Any PHP page I visit in my browser now returns a 500 error, and the error log contains this: Premature end of script headers: php.cgi It's clearly not the fault of the PHP executable itself, since it works from the command line. === I have also tried renaming the link so it no longer has a .cgi extension. Instead, I now get the following errors on all PHP pages. Warning: Unexpected character in input: ' in php-cgi on line 571 Warning: Unexpected character in input: ' in php-cgi on line 571 Parse error: syntax error, unexpected ',' in php-cgi on line 571 At a wild guess, I'd say that the problem is that the server tries to interpret the PHP executable rather than execute it as a native binary. Any ideas how I can stop that?
Does PHP "cache" Scripts?
A really simple script is driving me up the wall. I have a very simply facility on a website to allow the user to reorder items in a database table as she wishes by clicking a link that (in this case) says "MOVE UP" and links to the script below. This script snippet that does all the work is shown - the database connection is established and after doing its work the script returns the user to the referring page. --------------------------------------------- $sql="select DisplayOrder from CreditType where Id=" . $credcat; $result=mysql_query($sql); $row=mysql_fetch_row($result); $sql="update CreditType set DisplayOrder=" . (($row[0])-1) . " where Id=" . $credcat; mysql_query($sql); $sql="update CreditType set DisplayOrder=" . ($row[0]) ." where DisplayOrder=" . (($row[0])-1) . " and Id<>" . $credcat; mysql_query($sql); -------------------------------------------- On my own server this works perfectly - but when I upload it to my client's shared server it sometimes works and sometimes doesn't. It is intermittent. Could PHP be returning a cached result of the script? If no, what on earth can be happening? If yes, can I stop this from happning from the script (I can't change any settings on the shared host).
Preventing Visitors Ability To "re-visit" A Page Via The "back Button"..
I have a rather complex registration/member sign up form.. which gets a little confused, when a visitor "backs" completely out of the form, then for whatever reason returns to the form. The form contains 'cancel' buttons, which naturally cancel the reg process and redirects them to the document just before they started. JS provides us with the "location.replace()" method, but I can't seem to find a way to coordinate the use of location.replace() with the posting of the form values. In short, I want to "replace" the first step of the form with the "second step". I think what's making this tricky, is that each step of the form are located within the "same" page (register.php). The document works like so: The first step is the "Member Agreement" when they click "agree" (submit) the system creates a new row in the temporary register table of the db. It then issues a registration cookie, which carries the row id, and session value. in addition (for those cookie impared users) we carry the row id and session value in hidden elements. So far, as long as the user continues through the process all is fine, but if they (for whatever reason) back all the way out, and click 'agree' again, the process fails. I guess I have to find a way to force a reload of the 1st step "if they've gone back" OR "replace()" the first step with the second, so as to prevent the user from going "back" to the 1st step of the register page.
Pagnation - Limit Number Of Pages Between "Previous" & "Next" Hyperlinks
Was hoping for some advice with a part of page navigation.... It works at the moment so there is a "Previous" & "Next" Hyperlink underneath the records. In between the Previous & Next links are the number of pages that there is of these records. e.g: Previous 1234 Next This is fine if there are only a few pages of records, but when there are hundreds of pages the numbers are listed and they take up half the web page with them. How can i make it so only limited 10 numbers of pages say appear between the "Previous" & "Next" Hyperlink and as you progress through the pages they are as do the next 10 numbers of pages? Code:
[regex] Stripping Out "name" And "value" Values Out Of Tags, Aaargh
Searched through the site, but couldn't find the right regex syntax I was looking for. the thing i want is, to extract with preg_match_all the given values in a tag... ex. $str = '<input type="text" name="name" value="value">' $pattern = some magic stuff I need to know preg_match_all($pattern, $str, $result); And in result I want to have the values text, name and value AND it's important that the order doesn't matter so structure of tags can be <input type =name= value=> or <input name= class= value= type=> etc, etc...
'Parse Error' Problem In "isset" And "empty"
I've been having some problems with a parse error that I can't figure out (PHP 4.3.11 on Solaris9). Sample code: <?php // getting strange parse errors on this class A { var $value; function A() { $this->value = 1; } function getValue() { return $this->value; } } $a = new A(); if (!empty($a->getValue())) { echo "success"; } else { echo "failure"; } ?> The result of this is: Parse error: parse error, unexpected '(', expecting ')' in /foo/public_html/parse_errors.php on line 15 I also get the same effect with "isset", however, testing with "is_null" or "is_int" produces the correct ("success"/"failure") result. Any ideas?
Aren't Session Variable Preserved Using "Header('Location: Xxx')"?
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target page I don't get any session variable values! BTW, I used a relative location in the Location header, not an absolute URL. The behavior looks like it started another session, but it should not have.
How Can I Remove Session Files In The "tmp" Directory?
How Can I Remove Session Files In The "tmp" Directory? I have just started working with "sessions." A Unix server stores a temporary file in a "tmp" directory. The temporary files include a string of numbers for the sessions variable. I need to devise a way to remove the temporary sessions files from the "tmp" directory on the server. If you would, please respond and indicate: 1). What is the best way to remove the sessions files from the "tmp" directory? or 2). What is the best way to handle the sessions files in the "tmp" directory?
Configuring Php "session.path" On Win2k
I did some messing with php and attempted to install osCommerce, it started crashing apache so I uninstalled php, and apache and now sessions dont work at all. here is my php.ini file Code:
Echo "<!--#include File="top.html" -->";
I have a search script which returns a page of results, however I'd like the returned page to be in the same format as the rest of my site. To do this I've tried adding the HTML for my site to my PHP page with echo" " commands. This works for the plain HTML, but my regular pages also use SSI to do other stuff (some of them even execute other PHP scripts to generate tables of data etc). I've tried echo "<!--#include file="top.html" -->"; but it doesn't work as I get a parse error. My question is, how do I go about doing this properly? Is this possible at all? And if not have you guys got any suggestions to get around this?
Any File Size Limit In <PARAM Name="***" Value="***"> ?
I embed an applet in my php script which has a parameter providing an input file for the jar. Does this file has size limit? The code is as follows: <APPLET ARCHIVE="myapplet.jar" WIDTH=372 HEIGHT=360 VSPACE=0 HSPACE=0 ALIGN=middle> <?php echo "<PARAM NAME="data" VALUE="myfile.">";?> when "myfile" is beyond 15M, my applet cannot load sucessfully, but while this file is limited like 5M or 7M, it works well. Does anybody know is the reason caused by php script limit, applet mechanism, or by different browser?
How To Do PHP "require()" Or TCL "source" In Bash Script
I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure out how to do this in bash script as the requirement is necessary for a migration script to obtain the code from a .cfg file and then be able for the "parent" script to run the code it "imported" from the .cfg file, much like PHP's require() or TCL's "source". This is what I have so far and it fails: if [ -f ivc.cfg ]; then cat ivc.cfg fi Anyone really know bash script well please help, it's a barrier for me not to be able to get just this one piece working.
Warning: Session_start(): Cannot Send Session Cookie
Warning: session_start(): open(/tmpsess_526e492c7e6fbe4887e4c52821b34be7, O_RDWR) failed: No such file or directory (2) in C:Program FilesApache GroupApache2htdocsTempMgtindex.php on line 15 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:Program FilesApache GroupApache2htdocsTempMgtindex.php:15) in C:Program FilesApache GroupApache2htdocsTempMgtindex.php on line 15 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:Program FilesApache GroupApache2htdocsTempMgtindex.php:15) in C:Program FilesApache GroupApache2htdocsTempMgtindex.php on line 15 Warning: Unknown(): open(/tmpsess_526e492c7e6fbe4887e4c52821b34be7, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
Warning: Session_start(): Cannot Send Session Cookie
This is my code: <?php session_start(); session_register("korisnik", "sid"); $korisnik = $username; $sid = session_id(); ?> wherever I put this code on my page i get the following errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /xy/unos_reg.php:3) in /xy/unos_reg.php on line 4 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /xy/unos_reg.php:3) in /xy/unos_reg.php on line 4
"how Many Users Online" With PHP: Session Or DB?
The following two URLs illustrate different approaches to the idea of showing "how many users online" issue. I am looking at two different sites where I am looking into implementing this type of script; one that has mySQL and one that has no db access of any kind; both use PHP 4.1. I (for once) understand what I would need to do to implement it; problem comes in as to which solution would be the fastest, most efficient and most secure considering that one of them deals with sessions (then there is the cookie issue, but that's another issue altogether, see http://www.webkreator.com/php/confi...n-security.html on security issues and cookies/sessions). What would one best recommend I use: the PHP/mySQL solution (for the non-db issue I would have to write complicated XML procedures instead), or sessions? Oh, more info: Site #1 (has mySQL) is Linux/Apache ??/mySQL 3.23.41 and PHP 4.1 Site #2 (has no DB) is generic UNIX/Apache ?? and PHP 4.1
Can You Check If A Session "exists"?
I'm going to start this post with the words so many before it have started. "I'm just beginning to play with sessions..." I'm just experimenting for now, but within the month, I'm planning on writing a basic e-commerce site using PHP/MySQL. I want to store items in a Session, then write to the DB at the end of the transaction. Not sure I'm going about this the right way, but... I was thinking about having a script that gets run on every page, checking if the session has been started. A session would be started when someone clicks on "Add to basket" for the first time. If the session has been started, then I'll display "Click here to check out your basket" if not, then display something like "Basket empty" or something. So, is there a way to check if a session exists without actually starting one? Is there simply a variable to check for? I had been checking for $PHPSESSID, which seemed to be working okay, but if I started a session, $PHPSESSID wouldn't be true in that same script - didn't "exist" until I reloaded the script - but then again, I don't know what the hell I'm doing.
A "few" Old Session Files Never Deleted?
I have session files stored in a special tmp directory specific to a virtual host instance. The Max_lifetime is long 86400 (1 day) which I don't suppose is the problem. Anyway the sessions do indeed expire and "most" of the old session files disappear as expected. Not all however. I am finding several old session files with Unix last mod times weeks in the past. This behavior observed on PHP 4.2 and 4.3.
"Session Side Effect"
I'm being tortured by this warning: Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. ... I've looked the code up and down and I'm no longer using any variables that aren't acquired via $_SESSION['xyx'], etc. What else could trigger this warning message? The only idea I have is that I am checking some variables using "isset". The section of code in question is inserted in different contexts, so I use that to taylor its behavior, would the warning appear just because I checked for the existence of a non-existent variable? If so, that kind of defeats the purpose it seems.
Explain "session.cookie_domain"
I have two session scripts going on the same server... in my ini file the session.cookie_domain is set to nothing as such both scripts are talking to each other and i dont want that so... on the fly ive spec'd this: script 1: ini_set("session.cookie_domain","/cart/"); script 2: ini_set("session.cookie_domain","/cart_2/"); now neither will keep sessions is this possible?
Error In Page When Checking Http_get_vars("myvar") And "myvar" Was Not Passed In URL String
PHP, coming from ASP coding if (HTTP_GET_VARS['b']==1){ print "Yes"; }else{ print "No"; } when "b" is not passed via (http://www.mydomain.com?b=1 an error occurs and the "NO" is printed but an error is printed too. How can I check for the value of "b" so that no error occurs if b is not passed?? example http=www.mydomain.com $myvar=HTTP_GET_VARS['b'] causes an error because "b" does not exist (ie. its not passed in the URL string. $myvar maybe evaluated as NULL or Empty but the error is printed in the page, anyway.
Again "headers Already Sent By ".
Hello, I have composed the following simple php file: <html> <head><title> Title. </title></head> <body> <?php header("Location: http://www.something.com/tmp2.php"); ?> </body> </html> And result of its execution is: Warning: Cannot modify header information - headers already sent by (output started at /home/something/public_html/tmp1.php:4) in /home/something/public_html/tmp1.php on line 5 I thing, that in newsgroups I found a cause of my error: "The reason you are getting this warning is because PHP is trying to send a header (redirecting in this case) to browser, but it cannot, because the output has already started." But now I do not understand what is the use of header("Location: ***");. It can be placed only in the beginning of files, and after browser open this file it (browser) is immediatly redirected to second file. Is it not better to open second file straight away (withou opening the first file)? Further, what I need to do if I want to diplay some file and than, let say in 20 second, user have to be redirected to next file? What I need to do if I want to perform redirection only if some variables have same defined values?
Coding "NEXT" And "PREVOIUS" Buttons
Hi I am stuck here. I am doing a form which dispalys details of client companies. My query includes this statement: .... WHERE CompanyName LIKE %$name% .... What I need is following: if a query returns more then one result I what to "flip" through result with NEXT and PREVIOUS buttons.
Mysql/php - "LIMIT" And "ORDER"
In the following fragment of code, I am querying a database that in order to display a list of films. The list is very long and I would like to offer the possbility to restrain the range of results showned by page keeping in mind that the user should be able to browse forward or backward data if applicable. I know that I have to add the LIMIT method in the MySQL query but I have a hard time figuring how not to get lost in setting it dynamically in the PHP script. Then I have a second question. Is there a more elegant / straightforward way to deal with the display order of the data (cf. $ot, $od and $oy)? Code:
Sticking "if" Or Changes Within A MySQL "where" Array?
I'm not exactly sure how to even ask the question, and I know my terminology is not good as I'm a SQL beginner, but, here goes. I need to find a way to make an if statement within an array...or, the "while" portion of a recordset. The best way I can ask is show what I mean. http://oscarguy.mechphisto.net/awardbrowse.php If you go there and select an award (like Best Picture), leave the year field alone, and select YES and submit, you'll see a lot of results. And I have HR's dividing each entry. What I need to do is group all the entries of the same year, or at least only put HR's between the blocks of years. So, I'd have all the entries for 2002, an HR, then all for 2001, an HR, etc. Here at the bottom I'll include my PHP code I'm using so far. But I have no idea where to even start looking for an answer...if it's even possible. If someone can just give me the name of the function or process or technique, then I can go Web/book searching myself...I just need a direction of where to go. PHP:------------------------------------------------------------------------ ------ $query_RS_award = "SELECT * FROM $award WHERE id != Ƈ' ORDER BY year DESC, w DESC"; //$query_RS_award = "SELECT * FROM $award WHERE year = "$year""; $RS_award = @mysql_query($query_RS_award, $connection) or die("Couldn't query: " . mysql_error()); $totalRows_RS1 = mysql_num_rows($RS_award); while ($row_RS_award = mysql_fetch_assoc($RS_award)) { $award_id = $row_RS_award['id']; $award_tblid = $row_RS_award['tblid']; $award_award = $row_RS_award['award']; $award_year = $row_RS_award['year']; $award_category = $row_RS_award['category']; $award_won = $row_RS_award['w']; $award_film = $row_RS_award['film']; $award_nominee = $row_RS_award['nominee']; $award_note = $row_RS_award['note']; if (!($award_category)) { $award_category = "n/a"; } else { $award_category = $award_category; } if ($award_won == "1") { $award_won = " - Award Winner"; } else { $award_won = ""; } $display_block_Award .= "YEAR: <span class='normalText12White'>$award_year</span><br>FILM: <span class='normalText12White'>$award_film</span><br>CATEGORY: <span class='normalText12White'>$award_category</span><br>NOMINEE: <span class='normalText12White'>$award_nominee</span><span class='normalText12BoldWhite'>$award_won</span><br><blockquote><span class='normalText12White'>$award_note</span></blockquote><hr>"; }
Cookies And "include" Or "require"
i'm having a problem with my setcookie() instructions. Although there are absolutely no html tags in front of them,for some reason PHP3 sends me back the message "oops...php3_SetCookie called after header has been sent"... I do however use two "require" calls, one to a file with a .php extension, and one to a file with an .inc extension. At the beginning of each files there's a Could the cookie failure and the include functions be related ? In my text, I have even wiped out any HTML tags such as "bold, paragraph, line break" tags, even in "echo" commands, but to no avail what am i doing wrong ?
FTP_login + $pass="" And $user=""
I use the following scrit in an Intranet with the user name = "" and the password = "" : <?php $ftp_server = "192.168.25.25"; $ftp_user = ""; $ftp_pass = ""; $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo "Connected at $ftp_user@$ftp_server "; } else { echo "Can't connect with $ftp_user "; } ?> I have the following message : Connected to 192.168.25.25 Warning: ftp_login(): 'USER': Invalid number of parameters in E:www est_ftp.php on line 26 I tried to : ftp_login($conn_id, "", "") but i have the same result...
Why Use "Stripslashes" And "Addslashes" Function
Can someone let me know why one would use strip slashes or add slashes functions. I know what they do but cannot see the exact use for them e.g. if i have a textfield and encase it in an stripslashes function, it will escape any back slashes etc...
Cache-limiter Error
I am getting the following error. I've changed the paths and file names here to protect my client's confidentiality. Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /www/html/app/includes/someincludescript.php:2) in /www/html/app/includes/session.php on line 3 The main script has <? include("/www/html/app/includes/someincludescript.php"); include("/www/html/app/includes/session.php"); .... ?> Of course, session.php has a session_start() in it. My understanding of this error is that someincludescript.php has some kind of output going out of it at line 2. This would cause the session_start() function to hiccup and give the warning. Examining someincludescript.php, it has nothing that should be outputting to the browser. The earliest output in the main script comes after session.php is included. To complicate my problem more, all of it works fine on my development server. When I ship the scripts off to my client and he installs them on his server, the warning happens. I have taken steps to ensure that the DOS/UNIX difference in line endings is not a problem. Both the development and production servers run RedHat Linux. However, the scripts are sent via ftp (ASCII xfer mode) to my Windows machine, emailed to client's Windows machine, ftp'd (ASCII xfer mode) to his machine. His doesn't work. Part of my frustration is that I have no direct influence over the production server. I can accept that, but it makes it very hard to debug problems like this. He says that his PHP errors log doesn't show any errors. I have three suspicions: 1. There is some system setting somewhere, perhaps in php.ini, that is different between the two servers. 2. My client is not installing the scripts correctly (unintentionally) and causing the error. 3. The someincludescript.php script is causing an error at line 2 that tries to write a warning to the browser, which triggers the warning.
Headers For "image Not Found" Image
I'd like to serve an image-not-found image for images... that aren't found.. I'm already using a custom 404 handler page.. but this question could apply to images retrieved from a database or script or whatever... Anyhow, is the 1st method OK, or should #2 be used? ie, does the client/bot or whatever recognize the 404 on method 1? Or, does it think everything is dandy because of the redirect. header('HTTP/1.0 404 Not Found'); header('location: '.$image_url); exit; or header('HTTP/1.0 404 Not Found'); header('Content-Type: image/whatever'); readfile($imagefilepath); exit is one way more better?
If Url Contains "_" Send To 404?
is it possible posible via a header to detect if the url (or $_get["title"] in my case) has underscores and if so send to the 404 page? my old urls had underscore, the new ones use more standard dashes, and the bots are all still roaming the old pages (which don't work and have errors) so I'd like to tell them to not go there I guess via 404..
|