OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
php-general Digest 23 Mar 2008 10:22:13 -0000 Issue 5363

php-general-digest-helplists.php.net
Date: Sun Mar 23 2008 - 05:22:13 CDT


php-general Digest 23 Mar 2008 10:22:13 -0000 Issue 5363

Topics (messages 271991 through 272005):

sprintf problem...
        271991 by: Richard

Re: sprintf problem... (with simplified code )
        271992 by: Richard

Re: strange list behavior when replying to message on list
        271993 by: Shawn McKenzie
        271994 by: Shawn McKenzie
        271995 by: Shawn McKenzie
        271997 by: Nilesh Govindrajan
        272003 by: Mark Weaver
        272005 by: Nilesh Govindrajan

Re: Comparing file creating dates...
        271996 by: Al

Re: pulling text from a file
        271998 by: Nilesh Govindrajan

Re: spider
        271999 by: Nilesh Govindrajan

Re: question about customized error
        272000 by: Nilesh Govindrajan

Re: selling gpl software?
        272001 by: Nilesh Govindrajan
        272004 by: Larry Garfield

Re: problem with sessions config.
        272002 by: N.Boatswain

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Hello, I'm trying to write a invoice script but I have encountered a
slight problem.
Each product needs to be listed without tax, and at the end of the file
I need to show the VAT. In France VAT is 19.6%
So €10.03 without vat = €12.00 with vat.
So I do this :

$totalwithoutvat = 0;
$totalwithoutvat = 0;
$totalvat =0;
while ( $itemwithoutvat) = each( $px ) )
{
$totalwithoutvat += $itemwithoutvat;
$totalwithoutvat += sprintf("%0.2f", $itemwithoutvat * ( 1 + 19.6/100 ));
$totalvat += sprintf("%0.2f",$itemwithoutvat * 19.6/100);
}
print ("Total Vat =".sprintf("%0.2f",$totalvat)." - Total without vat =
".sprintf("%0.2f",$totalwithoutvat)." - Total with vat =
".sprintf("%0.2f",$totalwithvat));

But I'm not sure I am using sprintf correctly, maybe I should use a
different function because :
When I have one item at 10.03, the result is : Total Vat = 1.97 - Total
without vat = 10.03 Total with vat = 12.00
but if I have two items at 10.03 the result is : Total vat = 3.93 -
Total without vat = 20.06 Total with vat = 23.99
but I need it to be : Total vat = 3.94 - Total without vat = 20.06 Total
with vat = 24.00
So from what I can see, sprintf only seems to work for printing and the
actual result is kept in memory, is this correct ? if so what function
should I use instead?

Thanks in advance :)

Richard

attached mail follows:


Here is a simplifie version of my code :

<?php
$total = 0;
$ht = 10.03;
$vat = 19.6;
$total += $ht*($vat/100+1);
print("Total = ".sprintf("%0.2f", $total));
$total += $ht*($vat/100+1);
print(" - Total 2 = ".sprintf("%0.2f", $total));
?>

I get 12.00 and 23.99 ... what should I do to get 12.00 and 24.00 ?

Richard a écrit :
> Hello, I'm trying to write a invoice script but I have encountered a
> slight problem.
> Each product needs to be listed without tax, and at the end of the
> file I need to show the VAT. In France VAT is 19.6%
> So €10.03 without vat = €12.00 with vat.
> So I do this :
>
> $totalwithoutvat = 0;
> $totalwithoutvat = 0;
> $totalvat =0;
> while ( $itemwithoutvat) = each( $px ) )
> {
> $totalwithoutvat += $itemwithoutvat;
> $totalwithoutvat += sprintf("%0.2f", $itemwithoutvat * ( 1 + 19.6/100 ));
> $totalvat += sprintf("%0.2f",$itemwithoutvat * 19.6/100);
> }
> print ("Total Vat =".sprintf("%0.2f",$totalvat)." - Total without vat
> = ".sprintf("%0.2f",$totalwithoutvat)." - Total with vat =
> ".sprintf("%0.2f",$totalwithvat));
>
> But I'm not sure I am using sprintf correctly, maybe I should use a
> different function because :
> When I have one item at 10.03, the result is : Total Vat = 1.97 -
> Total without vat = 10.03 Total with vat = 12.00
> but if I have two items at 10.03 the result is : Total vat = 3.93 -
> Total without vat = 20.06 Total with vat = 23.99
> but I need it to be : Total vat = 3.94 - Total without vat = 20.06
> Total with vat = 24.00
> So from what I can see, sprintf only seems to work for printing and
> the actual result is kept in memory, is this correct ? if so what
> function should I use instead?
>
> Thanks in advance :)
>
> Richard

attached mail follows:


Mark Weaver wrote:
> Andrew Ballard wrote:
>> On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver <mdw1982mdw1982.com>
>> wrote:
>>> Hi all,
>>>
>>> I'm wondering if anyone else happens to be using Mozilla Thunderbird
>>> and
>>> seeing this behavior, and also if this behavior is a feature or a bug.
>>>
>>> When I hit the reply button to respond to a message most of the time
>>> the
>>> actual sender's address is the one the message is being sent to rather
>>> than the list itself. This is the first mailing list I've been on that
>>> I've seen this behavior; all other lists I'm on when one hits the reply
>>> button, or CTRL+R the mailing list's address is inserted as it
>>> should be
>>> and is expected.
>>>
>>> I know with some email clients there is a menu item specifically there
>>> for responding "to the list" based on whether or not there is a
>>> list-header in the header information but that isn't an available
>>> option
>>> with Thunderbird. Is anyone else seeing this behavior or is there
>>> something I'm missing?
>>>
>>> Mark
>>>
>>
>> It's not specific to Thunderbird or any other mail client. I'm pretty
>> sure it was configured that way on purpose. Have a look at this
>> thread:
>>
>> http://marc.info/?l=php-general&m=105700032521606&w=2
>>
>> Andrew
>>
>
> well, obviously since the issue still exists it's clear that this never
> got resolved. I just don't understand the obstenant behavior of some
> folks in the presence of clear and plain logic. Especially from a
> programmer. Makes no sense at all.
>
> Guess I'm off to create the necessary recipe for Procmail to do the
> adult thing and make sense of the non-sense.
>
I use Thunderbird 2.x on Kubuntu and I just hit reply to this mail. I
have news.php.net setup as a news account. I do receive and have
received frequent timeouts contacting the news server though. Has been
a pain for quite awhile.

-Shawn

attached mail follows:


Mark Weaver wrote:
> Hi all,
>
> I'm wondering if anyone else happens to be using Mozilla Thunderbird and
> seeing this behavior, and also if this behavior is a feature or a bug.
>
> When I hit the reply button to respond to a message most of the time the
> actual sender's address is the one the message is being sent to rather
> than the list itself. This is the first mailing list I've been on that
> I've seen this behavior; all other lists I'm on when one hits the reply
> button, or CTRL+R the mailing list's address is inserted as it should be
> and is expected.
>
> I know with some email clients there is a menu item specifically there
> for responding "to the list" based on whether or not there is a
> list-header in the header information but that isn't an available option
> with Thunderbird. Is anyone else seeing this behavior or is there
> something I'm missing?
>
> Mark
Thunderbird 2.x on Kubuntu, If I 'reply all' I get:

to: mdw1982mdw1982.com
cc: php-generallists.php.net
newsgroup: php.general

If I right click and reply to newsgroup I get newsgroup: php.general

-Shawn

attached mail follows:


Mark Weaver wrote:
> Hi all,
>
> I'm wondering if anyone else happens to be using Mozilla Thunderbird and
> seeing this behavior, and also if this behavior is a feature or a bug.
>
> When I hit the reply button to respond to a message most of the time the
> actual sender's address is the one the message is being sent to rather
> than the list itself. This is the first mailing list I've been on that
> I've seen this behavior; all other lists I'm on when one hits the reply
> button, or CTRL+R the mailing list's address is inserted as it should be
> and is expected.
>
> I know with some email clients there is a menu item specifically there
> for responding "to the list" based on whether or not there is a
> list-header in the header information but that isn't an available option
> with Thunderbird. Is anyone else seeing this behavior or is there
> something I'm missing?
>
> Mark
Thunderbird 2.x on Kubuntu, If I 'reply all' I get:

to: mdw1982mdw1982.com
cc: php-generallists.php.net
newsgroup: php.general

If I right click and reply to newsgroup I get newsgroup: php.general

-Shawn

attached mail follows:


Shawn McKenzie wrote:
> Mark Weaver wrote:
>> Andrew Ballard wrote:
>>> On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver <mdw1982mdw1982.com>
>>> wrote:
>>>> Hi all,
>>>>
>>>> I'm wondering if anyone else happens to be using Mozilla Thunderbird
>>>> and
>>>> seeing this behavior, and also if this behavior is a feature or a bug.
>>>>
>>>> When I hit the reply button to respond to a message most of the time
>>>> the
>>>> actual sender's address is the one the message is being sent to rather
>>>> than the list itself. This is the first mailing list I've been on that
>>>> I've seen this behavior; all other lists I'm on when one hits the reply
>>>> button, or CTRL+R the mailing list's address is inserted as it
>>>> should be
>>>> and is expected.
>>>>
>>>> I know with some email clients there is a menu item specifically there
>>>> for responding "to the list" based on whether or not there is a
>>>> list-header in the header information but that isn't an available
>>>> option
>>>> with Thunderbird. Is anyone else seeing this behavior or is there
>>>> something I'm missing?
>>>>
>>>> Mark
>>>>
>>> It's not specific to Thunderbird or any other mail client. I'm pretty
>>> sure it was configured that way on purpose. Have a look at this
>>> thread:
>>>
>>> http://marc.info/?l=php-general&m=105700032521606&w=2
>>>
>>> Andrew
>>>
>> well, obviously since the issue still exists it's clear that this never
>> got resolved. I just don't understand the obstenant behavior of some
>> folks in the presence of clear and plain logic. Especially from a
>> programmer. Makes no sense at all.
>>
>> Guess I'm off to create the necessary recipe for Procmail to do the
>> adult thing and make sense of the non-sense.
>>
> I use Thunderbird 2.x on Kubuntu and I just hit reply to this mail. I
> have news.php.net setup as a news account. I do receive and have
> received frequent timeouts contacting the news server though. Has been
> a pain for quite awhile.
>
> -Shawn

That's what I also do. :D I have thunderbird 2.x on Fedora 8. So, it
works. :)

attached mail follows:


Nilesh Govindrajan wrote:
> Shawn McKenzie wrote:
>> Mark Weaver wrote:
>>> Andrew Ballard wrote:
>>>> On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver <mdw1982mdw1982.com>
>>>> wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm wondering if anyone else happens to be using Mozilla Thunderbird
>>>>> and
>>>>> seeing this behavior, and also if this behavior is a feature or a
>>>>> bug.
>>>>>
>>>>> When I hit the reply button to respond to a message most of the time
>>>>> the
>>>>> actual sender's address is the one the message is being sent to
>>>>> rather
>>>>> than the list itself. This is the first mailing list I've been on
>>>>> that
>>>>> I've seen this behavior; all other lists I'm on when one hits the
>>>>> reply
>>>>> button, or CTRL+R the mailing list's address is inserted as it
>>>>> should be
>>>>> and is expected.
>>>>>
>>>>> I know with some email clients there is a menu item specifically
>>>>> there
>>>>> for responding "to the list" based on whether or not there is a
>>>>> list-header in the header information but that isn't an available
>>>>> option
>>>>> with Thunderbird. Is anyone else seeing this behavior or is there
>>>>> something I'm missing?
>>>>>
>>>>> Mark
>>>>>
>>>> It's not specific to Thunderbird or any other mail client. I'm pretty
>>>> sure it was configured that way on purpose. Have a look at this
>>>> thread:
>>>>
>>>> http://marc.info/?l=php-general&m=105700032521606&w=2
>>>>
>>>> Andrew
>>>>
>>> well, obviously since the issue still exists it's clear that this never
>>> got resolved. I just don't understand the obstenant behavior of some
>>> folks in the presence of clear and plain logic. Especially from a
>>> programmer. Makes no sense at all.
>>>
>>> Guess I'm off to create the necessary recipe for Procmail to do the
>>> adult thing and make sense of the non-sense.
>>>
>> I use Thunderbird 2.x on Kubuntu and I just hit reply to this mail. I
>> have news.php.net setup as a news account. I do receive and have
>> received frequent timeouts contacting the news server though. Has been
>> a pain for quite awhile.
>>
>> -Shawn
>
> That's what I also do. :D I have thunderbird 2.x on Fedora 8. So, it
> works. :)
>

by the way... I thought everyone would be rather interested to know that
because of the way the list is setup and running at the moment and "not"
hiding the senders email address, it's extremely easy to harvest
addresses from messages. That means that if someone got infected or a
spammer, scammer, etc... ever subscribed to the list it wouldn't be any
trouble at all to get list members' addresses.

It took all of 10 seconds to grep the imap folder where all the messages
I get are stored for the From: header and out popped everyone's address.
Just another reason to hide the sender's address and use the reply-to
header.

--
Mark

"If you have found a very wise man, then you've found a man that at one
time was an idiot and lived long enough to learn from his own stupidity."
==============================================
Powered by CentOS5 (RHEL5)

attached mail follows:


Mark Weaver wrote:
> Nilesh Govindrajan wrote:
>> Shawn McKenzie wrote:
>>> Mark Weaver wrote:
>>>> Andrew Ballard wrote:
>>>>> On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver <mdw1982mdw1982.com>
>>>>> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> I'm wondering if anyone else happens to be using Mozilla Thunderbird
>>>>>> and
>>>>>> seeing this behavior, and also if this behavior is a feature or a
>>>>>> bug.
>>>>>>
>>>>>> When I hit the reply button to respond to a message most of the time
>>>>>> the
>>>>>> actual sender's address is the one the message is being sent to
>>>>>> rather
>>>>>> than the list itself. This is the first mailing list I've been on
>>>>>> that
>>>>>> I've seen this behavior; all other lists I'm on when one hits the
>>>>>> reply
>>>>>> button, or CTRL+R the mailing list's address is inserted as it
>>>>>> should be
>>>>>> and is expected.
>>>>>>
>>>>>> I know with some email clients there is a menu item specifically
>>>>>> there
>>>>>> for responding "to the list" based on whether or not there is a
>>>>>> list-header in the header information but that isn't an available
>>>>>> option
>>>>>> with Thunderbird. Is anyone else seeing this behavior or is there
>>>>>> something I'm missing?
>>>>>>
>>>>>> Mark
>>>>>>
>>>>> It's not specific to Thunderbird or any other mail client. I'm pretty
>>>>> sure it was configured that way on purpose. Have a look at this
>>>>> thread:
>>>>>
>>>>> http://marc.info/?l=php-general&m=105700032521606&w=2
>>>>>
>>>>> Andrew
>>>>>
>>>> well, obviously since the issue still exists it's clear that this never
>>>> got resolved. I just don't understand the obstenant behavior of some
>>>> folks in the presence of clear and plain logic. Especially from a
>>>> programmer. Makes no sense at all.
>>>>
>>>> Guess I'm off to create the necessary recipe for Procmail to do the
>>>> adult thing and make sense of the non-sense.
>>>>
>>> I use Thunderbird 2.x on Kubuntu and I just hit reply to this mail. I
>>> have news.php.net setup as a news account. I do receive and have
>>> received frequent timeouts contacting the news server though. Has been
>>> a pain for quite awhile.
>>>
>>> -Shawn
>>
>> That's what I also do. :D I have thunderbird 2.x on Fedora 8. So, it
>> works. :)
>>
>
> by the way... I thought everyone would be rather interested to know that
> because of the way the list is setup and running at the moment and "not"
> hiding the senders email address, it's extremely easy to harvest
> addresses from messages. That means that if someone got infected or a
> spammer, scammer, etc... ever subscribed to the list it wouldn't be any
> trouble at all to get list members' addresses.
>
> It took all of 10 seconds to grep the imap folder where all the messages
> I get are stored for the From: header and out popped everyone's address.
> Just another reason to hide the sender's address and use the reply-to
> header.
>

It is not possible. This is one of the major drawbacks of mailing lists
/ news groups.

attached mail follows:


you may need to use filemtime() and not filectime();

Jim Lucas wrote:
> Ryan S wrote:
>> Hey all,
>>
>> Heres what i am trying to do:
>>
>> When someone sends a message from my site, i take their ip address and
>> make a file with their ip address in a directory called
>> "hash-directory", the file looks like this: 169.34.534.243.txt
>>
>> I want to make sure they cant send too many messages because of the
>> potential to spam, so I want to limit them to sending a message every
>> X number of minutes... heres what i have written (its not working for
>> some damn reason)
>>
>> ############# Start PHP file ################
>>
>> if(isset($_SERVER['REMOTE_ADDR']))
>> {$rem_address=$_SERVER['REMOTE_ADDR'];}
>>
>> $directory_with_files="hash-directory/";
>> $threshold = strtotime('-2 minutes');
>>
>> echo "File created on: <b>".$rem_address .".txt - ". date("F d Y
>> H:i:s.", filectime($directory_with_files.$rem_address.".txt"))."
>> ".$file_time_details[0]."</b><br><br>";
>>
>> if (file_exists($directory_with_files.$rem_address.".txt")) {
>>
>> if
>> (getdate(filectime($directory_with_files.$rem_address.".txt")) <
>> $threshold)
>
>
> From the manual
>
> This returns a timestamp
> int strtotime ( string $time [, int $now ] )
>
> This returns an hash array with all the date/time info in it.
> array getdate ([ int $timestamp ] )
>
> You are trying to compare two things that are completely different.
>
> Get rid of the getdate() function. All you need is the filectime()
> call, it returns a unix timestamp.
>
>> {echo "<b>Please wait more than 1 minute before
>> posting.</b><br>";}
>> else{echo "<b>Enough time has elapsed.</b><br>";}
>> }
>>
>> ############# END PHP file ################
>>
>>
>> Where am I going wrong?
>>
>> Thanks!
>> Ryan
>>
>> ------
>> - The faulty interface lies between the chair and the keyboard.
>> - Creativity is great, but plagiarism is faster!
>> - Smile, everyone loves a moron. :-)
>>
>>
>>
>>
>>
>> ____________________________________________________________________________________
>>
>> Looking for last minute shopping deals? Find them fast with Yahoo!
>> Search.
>> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
>>
>

attached mail follows:


Richard Kurth wrote:
> I have a text file that looks like the one below. I need to read the
> file into a database.
> I was trying the script below but is not working can you help?
>
> $lines = file_get_contents('clientlist1.txt');
>
> $find="Address:";
> $f= strstr($f,$find);
> $separat="City:";
> $ADDRESS = substr($f, 0, strpos($f,$separat));
> $ADDRESS=ltrim($ADDRESS,"Address:");
> $ADDRESS=trim($ADDRESS);
> echo $ADDRESS;
> echo "<br>";
>
> $find="City:";
> $f= strstr($f,$find);
> $separat="State:";
> $CITY = substr($f, 0, strpos($f,$separat));
> $CITY=ltrim($CITY,"City:");
> $CITY=trim($CITY);
> echo $CITY;
> echo "<br>";
>
> Text File
>
> Address: 5070 myaddress.
> City: mycity State: mystate Zip: 97268
> County:
> Signers
> Name: my name
>
> Address: 3925 myaddress.
> City: mycity2 State: mystate2 Zip: 97268
> County:
> Signers
> Name: my name2

If the place where you run this script has PHP > 5.1 installed, then you
could use SimpleXML for this purpose. If the document MUST be in XML
format. I don't know such methods in PHP 4, etc. On my server, I have
PHP 5.2.5

attached mail follows:


tedd wrote:
> Hi gang:
>
> How do you spider a remote web site in php?
>
> I get the general idea, which is to take the root page, strip out the
> links and repeat the process on those links. But, what's the code? Does
> anyone have an example they can share or a direction for me to take?
>
> Also, is there a way to spider through a remote web site gathering
> directory permissions?
>
> I know there are applications, such as Site-sucker, that will travel a
> remote web site looking for anything that it can download and if found,
> do so. But is there a way to determine what the permissions are for
> those directories?
>
> If not, can one attempt to write a file and record the
> failures/successes (0777 directories)?
>
> What I am trying to do is to develop a way to test if a web site is
> secure or not. I'm not trying to develop evil code, but if it can be
> done then I want to know how.
>
> Thanks and Cheers,
>
> tedd
>

There is a complete search engine called Mihalism Search Engine which
uses PHP to spider websites. Its available for free download. You could
explore its source code and make your own. :)

attached mail follows:


Sudhakar wrote:
> if a user by mistake types the wrong url directly in the address bar ex=
> www.website.com/abou.php instead of
> typing www.website.com/aboutus.php instead of the browser displaying File
> not found or a 404 error message i would like to display a customized page
> which will still have the same look and feel of my website in terms of the
> layout and i would like to
> a) display a message such as = "Page could not be found" and b) the url that
> the user originally typed should remain in the browser = I guess this would
> be the case anyway but i was wondering if something needs to be done in
> order to reatin the original address the user typed.
>
> Does this have to be done from apache perspective or can it be done using
> php. please suggest the procedure in either case apache OR php.
>
> please advice.
>
> thanks.
>

.htaccess:

ErrorDocument 404 /404-error.php

404-error.php:

<?php

....soem code

?>

attached mail follows:


Colin Guthrie wrote:
> Larry Garfield wrote:
>> If the code is "work for hire" and the initial ownership is with the
>> client/company, then there is no distribution and so you are not required to
>> do anything. That includes if you are a full time employee of the company.
>
> OK, that's more or less my understanding.
>
> It is my understanding that, by default, contracting law states that any
> work done under contract is your (the contractor's) copyright (e.g. on a
> very loose contract that is the default case). Many employers of
> contractors will typically change this default stance.
>
>> So in the OP's case, if he takes an existing GPLed project, modifies it in
>> whatever way (including removing mention of the original project), and gives
>> a copy to his client, his only legal obligation is to provide the client with
>> the code under the GPL so that the client can, if he wants, pass the code on
>> to someone else under the GPL. "Someone else" could be a public FTP server
>> or not.
>
> I was half assuming the stance of the employer here was that he did not
> want the changes shared.
>
> So assuming this and the above note about contract law etc., then my
> original statement is correct.
>
> Whether these assumptions are correct in themselves (and this my whole
> thread of assumption breaks down!), I'll leave for future research and
> happily live in my bubble of ignorance ;)
>
> Col
>
>

Larry, read the GPL license. It has can be used, distributed, modified
under GPL only.

attached mail follows:


On Saturday 22 March 2008, Nilesh Govindrajan wrote:

> Larry, read the GPL license. It has can be used, distributed, modified
> under GPL only.

And where have I said otherwise?

--
Larry Garfield AIM: LOLG42
larrygarfieldtech.com ICQ: 6817012

"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson

attached mail follows:


Thanks for your answers people; but i'm still having the problem, ¿any approach to the reason?. Remember everything works fine in on-line servers, so it may not be a problem of the code, but a config. one;cheers,
Nicolas.

> To: php-generallists.php.net
> Date: Sat, 22 Mar 2008 13:58:15 +0530
> From: adminitech7.com
> Subject: [PHP] Re: problem with sessions config.
>
> N . Boatswain wrote:
> > Hello guys; i'm having a problem with session behavior; i'm going straight to it, but first some considerations:
> > PHP Version 5.2.5IIF 5.1Running on localhost (XP machine)I start sessions at the top of every page.
> >
> > A the start of a test page, just as example, i do the assignment: $_SESSION["username"] = "aaa";
> >
> > At the end of the same page i print it's value: echo $_SESSION["username"];
> >
> > And i get the layout: "aaa", as expecteed.
> >
> > Then I redirect to another page. On that one, after initializating the session ("session_start();") print again the $_SESSION["username"] content and the result is empty. If i try the same code on a server (all this is on my local machine), the code works as expected; so i think it is a configuration problem, here is my php.ini part that correspond to session configuration, so you can tell my if i'm doing anything wrong, long comments where removed:
> >
> > [Session]; Handler used to store/retrieve data.session.save_handler = files;session.save_path = "/tmp" BC 13/12/07session.save_path="/tmp"; Whether to use cookies.session.use_cookies = 1;session.cookie_secure = ; This option enables administrators to make their users invulnerable to; attacks which involve passing session ids in URLs; defaults to 0.session.use_only_cookies = 1; Name of the session (used as cookie name).session.name = PHPSESSID; Initialize session on request startup.session.auto_start = 1; Lifetime in seconds of cookie or, if 0, until browser is restarted.session.cookie_lifetime = 0; The path for which the cookie is valid.session.cookie_path = /; The domain for which the cookie is valid.session.cookie_domain =; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript.session.cookie_httponly = ; Handler used to serialize data. php is the standard serializer of PHP.session.serialize_ha
> ndler = php; Define the probability that the 'garbage collection' process is started; on every session initialization.; The probability is calculated by using gc_probability/gc_divisor,; e.g. 1/100 means there is a 1% chance that the GC process starts; on each request.session.gc_probability = 1session.gc_divisor = 1000; After this number of seconds, stored data will be seen as 'garbage' and; cleaned up by the garbage collection process.session.gc_maxlifetime = 1440session.bug_compat_42 = 0session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally stored URLs containing ids.; HTTP_REFERER has to contain this substring for the session to be; considered as valid.session.referer_check =; How many bytes to read from the file.session.entropy_length = 0; Specified here to create the session id.session.entropy_file =;session.entropy_length = 16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to determine HTTP caching aspects; or leave this empt
> y to avoid sending anti-caching headers.session.cache_limiter = nocache; Document expires after n minutes.session.cache_expire = 180session.use_trans_sid = 0; Select a hash function; 0: MD5 (128 bits); 1: SHA-1 (160 bits)session.hash_function = 0; Define how many bits are stored in each character when converting; the binary hash data to something readable.;; 4 bits: 0-9, a-f; 5 bits: 0-9, a-v; 6 bits: 0-9, a-z, A-Z, "-", ","session.hash_bits_per_character = 5; The URL rewriter will look for URLs in a defined set of HTML tags.; form/fieldset are special; if you include them here, the rewriter will; add a hidden <input> field with the info which is otherwise appended; to URLs. If you want XHTML conformity, remove the form entry.; Note that all valid entries require a "=", even if no value follows.url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="
> >
> > Well, thanks and sorry for my english;
> >
> > Nicolás.
> >
> >
> >
> > _________________________________________________________________
> > Watch “Cause Effect,” a show about real people making a real difference. Learn more.
> > http://im.live.com/Messenger/IM/MTV/?source=text_watchcause
>
> It works for me; I am using php-5.2.5 with lighttpd and FastCGI.
>
> I called session_start() on both the pages.
>
> and
>
> I have enabled session.use_trans_sid.
>
> You can temporarily override it from the php script by using this -
> <?
> //...other code
> ini_set("session.use_trans_sid",1);
> //...other code
> ?>
>
> Try and report again.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

_________________________________________________________________
In a rush? Get real-time answers with Windows Live Messenger.
http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_realtime_042008