[PHP] Re: Problem with class and tree-like struct
Ah, i forgott to pass the paramter as a reference... Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with class and tree-like struct
Hello! I made a class which should represent a tree-like structure (PHP 4.3.8). I made a root-nore and added 2 childs. The problem is that the childs are not added to the parent. Why? Martin class TreeItem { var $m_pParent; var $m_sName; var $m_arrChilds = array(); function TreeItem($pParent, $sName) { $this->m_pParent = $pParent; $this->m_sName = $sName; if ($pParent != NULL) $pParent->AddChild($this); } function AddChild($pTreeItem) { array_push($this->m_arrChilds, $pTreeItem); } } $root = new TreeItem(NULL, "Root"); $child1 = new TreeItem($root, "Child 1"); $child2 = new TreeItem($root, "Child 2"); print Count($root->m_arrChilds); // Outputs 0. Why -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to handle cookies?
Hello! I want to use php to gather some informations on a website. You have to login to this website. In a brwoser, a cookie is set at login and identifies you. How can I handle this cookie when using php? Is there an easy way? It would be best just to use fopen("http://...";). Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Testing if cookies are enabled
Hi Aidan, > Think about it. > > Step 1) Analyse the problem. > a) Set a cookie. > b) Test if the cookie has been set. > c) Display data from cookie > > Step 2) Read the fucking manual > a) http://php.net/setcookie > b) http://php.net/setcookie > c) http://php.net/setcookie thanks for your reply, I think you missunderstood, please read more carefully. I know how to set and read a cookie, but as I wrote I wasn't able to set and text a cookie ON THE SAME PAGE. The manual says: http://php.net/setcookie "Once the cookies have been set, they can be accessed ON THE NEXT PAGE." But I have seen pages on which it seems they set und check if the cookie has been set ON THE SAME PAGE. So I want to know how they do that (perhaps with a 302-header or something like that?). Martin Aidan Lister schrieb: If you can't work it out, and have actually done some reading, feel free to ask for some more help. "Martin Schneider" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello! I saw this on some pages and want to do the same: - On one page the user can login. Before that no cookie is set! - On the next page they set the cookie and show either the user data or a warning that the user has disabled cookies and should enable them. I wasn't able to set and text a cookie on the same page! How is it done? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Check if cookies are enabled on one page
Hello! I don't want to alyways set a cookie when a user enters my page. I want to set it when the users logs on, not earlier. The way is: - "Login-Page": The user enters the page where he can enter his name/password in a form and then submits this form. Before this, no cookie should be set. - "After Login-Page": Here the cookie is set for the first time. - If the user has enabled cookies, I want to show him his data. - If the user has disabled cookies, I want to show him a page saying that he should enable cookies. I saw pages doing so, but how is it done? I seem not to be able to set and check a cookie on the same page (or am I wrong?) Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Testing if cookies are enabled
Hello! I saw this on some pages and want to do the same: - On one page the user can login. Before that no cookie is set! - On the next page they set the cookie and show either the user data or a warning that the user has disabled cookies and should enable them. I wasn't able to set and text a cookie on the same page! How is it done? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Testing for cookie?
Hello! Okay, I saw pages doing this and I want exactly the same: - On a page the user can login. Before, no cookie is set. - On the next page, the cookie is set. It shows either the user data (is the login was correct and cookies where enabled) or a page which tells that cookies are disabled. So how is it done? I was not able to set and test a cookie on the same page. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php