[PHP] Re: Securing areas of a web site with PHP
[CUT] I am using SESSION on al my secure projects I use a file structur as this: (loginform) - logincheck.php (if not ok-back2login | if ok (start an session)(forward to the secure pages)) When the user logs out: (securepages)-logout.php: ?PHP //go through all the session array an unregister the varname foreach($_SESSION as $key=$val){ session_unregister($key); } // We destroys the session session_destroy(); //if there are an cookie vith the session name we have to unset it //so the browser doesn't hvae the information if(isset($_COOKIE[session_name()])){ // To delete the old cookie unset($_COOKIE[session_name()]); } //we starts an new session session_start(); //and we destroys it again session_destroy(); //Now there are an new session cookie in the browser, //and if the user try go back there are no data stored in the session //we forward the user to an unsecure public page header(Location: ./unsecurepublicpage.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Securing areas of a web site with PHP
I have tested this with all kind of browsers on WIndows, and to make a clean cut I had to do so.. Jason Sheets [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Instead of doing a foreach to unset your session variables you can use session_unset(); which will unset all your session variables for you. Additionally if you are wanting to remove a cookie from a visitor's browser you should use setcookie, not unset $_COOKIE, $_COOKIE allows you to access the value of a cookie but not set or alter the contents of the actual cookie. The manual page for session_unset is http://www.php.net/manual/en/function.session-unset.php The manual page for setcookie is http://www.php.net/manual/en/function.setcookie.php Also once you have executed session_destroy you have deleted the session information from the server, if you delete the sessionid cookie from the browser they will get a new session id the next time a session is started, there is no need to immediatly start and destroy another session. If you do not care if a user gets a new session id the next time they visit your site you do not necessarily have to worry about deleting the sessionid cookie as the data is already destroyed and the cookie will be deleted when they close their browser (if cookie life is 0) or when the cookie lifetime expires. Most if not all of this information is available from the PHP manual at http://www.php.net/manual Jason On Wed, 2003-01-01 at 10:56, David Tandberg-Johansen wrote: [CUT] I am using SESSION on al my secure projects I use a file structur as this: (loginform) - logincheck.php (if not ok-back2login | if ok (start an session)(forward to the secure pages)) When the user logs out: (securepages)-logout.php: ?PHP //go through all the session array an unregister the varname foreach($_SESSION as $key=$val){ session_unregister($key); } // We destroys the session session_destroy(); //if there are an cookie vith the session name we have to unset it //so the browser doesn't hvae the information if(isset($_COOKIE[session_name()])){ // To delete the old cookie unset($_COOKIE[session_name()]); } //we starts an new session session_start(); //and we destroys it again session_destroy(); //Now there are an new session cookie in the browser, //and if the user try go back there are no data stored in the session //we forward the user to an unsecure public page header(Location: ./unsecurepublicpage.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Serializing of OOP into sessions
Hello could somone please explain to me HOW I serialize classes into session and how I get the on the next page!?? Must I do $object = new ObjectName on the next page for the object to be used?? How does this work? Thanks David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php4 / Class / Session
Hello! I am litle confused about this, so I hope someone could give reply on this message an give me the right answer I am comfortable with the use of session, but lately when I have surf around, I have found some documents/tutorials about saving Objects/classes in session It's here I am beginning to be confused Is this for earlier version of Php (Version 3) or what does this mean Is it like this: When a user comes to my site, I intializes all the classes the site needs to run properly, and then I serialize() the class and put them in a session variable Then when the user goes to other places on my site, I only have to unserialize() the class sessionvariable name and use the object EX: First page: ?PHP session_start(); require_once(Aclass); require_once(Bclass); $a = new A; $b = new B; $s[a] = serialize($a); $s[b] = serialize($b); session_register(s); $a-do_something(); $b-do_something_else(); ? Second Page: ?PHP session_start(); $a = unserialize($s[a]); $b = unserialize($s[b]); $a-do_something_on_page2(); $b-do_something_else_on_page2(); ? I hope someone could give a hint on how this work David Tandberg-Johansen -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP] Re: REQUEST QUESTION
Karthikeyan [EMAIL PROTECTED] skrev i melding 002601c1c461$cfa08580$0600a8c0@aspire006..">news:002601c1c461$cfa08580$0600a8c0@aspire006..; Hi Guys, I allready posted this question in detail but I believe I didn't explain it properly. There are 2 hidden variable in my FORM. 1. order = 10 and 2. order=20 I want to retrieve both the orders in the next page say somename.php. How do i do that. Regards, karthikeyan. You must put the in a array like this input type=hidden name=order [1] value=10 input type=hidden name=order [2] value=20 On the nest page you just do echo The first order is .order[1]. and the second order is .order[2]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Classes
Hallo! Can I from inside an Class Intialize other classes, and access them from the ordinary script? Page1php ?PHP require_once(/myclassinc); $my = new MyClass; $my-init(); $fileread-readfile($file=myfiletxt); ? myclassinc ?PHP class MyClass { var classes = Array( classname1=classkey1, classname2=classkey2, classname3=classkey3 ); function init() { foreach ($this-classes as $classname=$classkey){ require_once(/$classnameinc); eval(\$$classkey = new $classname;); } } } ? David -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP] Classes
Hallo! Can I from inside an Class Intialize other classes, and access them from the ordinary script? Page1.php ?PHP require_once(./myclass.inc); $my = new MyClass; $my-init(); $fileread-readfile($file=myfile.txt); ? myclass.inc ?PHP class MyClass { var classes = Array( classname1=classkey1, classname2=classkey2, classname3=classkey3 ); function init() { foreach ($this-classes as $classname=$classkey){ require_once(./$classname.inc); eval(\$$classkey = new $classname;); } } } ? David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How make the time
Thank you Elias [EMAIL PROTECTED] skrev i melding [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... select count(*) from test1 where MINUTE(tm1) = 15 and MINUTE(tm1) = 30 and HOUR(tm1)=12 this query will return you on column containing how many record found in that time range, same as how many customers where surfed at that time where 30-15=interval and 12 is the hour you're checking in! David Tandberg-Johansen [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello! I am trying to make an online booking script for a client (restaurant), and I am using MySQL to store the booking information The restaurant have openings hour from 11:00 - 01:00, but do only take reservation between 11:00-22:30. The client wants to get a report written out over each hour like this: 11:002 Customers 11:1532 Customers 11:3012 Customers ... ... 22:3014 Customers In the MySQL table I have set up the time field as 'time' with 00:00:00 as default. Everything is ok, but I am stuck on how to make this report. The customer have set an interval of 15 mnutes between possible time to book, so I have to make an 'SELECT'-query based on when the restaurant opens to the time of the last possible booking time. But how do I make the timeset (11:00:00 and up to 22:30:00) My far out example: interval = 15; while (time=endtime){ time=starttime DBCONNECTION Select * from booking wher tine_field='time' time = time+interval } Do anyone have any tips on how I can solve this David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How make the time
Hello! I am trying to make an online booking script for a client (restaurant), and I am using MySQL to store the booking information The restaurant have openings hour from 11:00 - 01:00, but do only take reservation between 11:00-22:30. The client wants to get a report written out over each hour like this: 11:002 Customers 11:1532 Customers 11:3012 Customers 22:3014 Customers In the MySQL table I have set up the time field as 'time' with 00:00:00 as default. Everything is ok, but I am stuck on how to make this report. The customer have set an interval of 15 mnutes between possible time to book, so I have to make an 'SELECT'-query based on when the restaurant opens to the time of the last possible booking time. But how do I make the timeset (11:00:00 and up to 22:30:00) My far out example: interval = 15; while (time=endtime){ time=starttime DBCONNECTION Select * from booking wher tine_field='time' time = time+interval } Do anyone have any tips on how I can solve this David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] A tricky problem
This is maybe of topic, but I try. I have this site where the user first selects a langueage, and then i use session_register() to register the information. Then I use the the registered onformatin to dispaly the site text in the user selected language. The user put the selected things in a temp TABLE and when they are finnished the info in the temp TABLE transfere over to a real TABLE. This isn't the problem The problem is: If a user leaves the site because the user doesn't want to go thrue with the order, or if the user closes the broser, then the recods of the selected info are still in the temp TABLE. How can I delete this info when the user leaves or close the browser? Thanks! David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Session
Hey! I have just began to look at session, and I have some question. When I have used session_register('item') and the user navigates further in the site, how do I know what has been registered? David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Is it possible to send a html page via mail()???
Hello ! I wonder if there are any class or script out there that you can give an url or file as an variable and then it sends this as html-mail to a given emailadress. david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Array
How can I delete one record in a array? Example: $myarray = array ("a", "b", "c"); I want to delete/take away "b" so the array is: $myarray = array ("a", "c"); David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How to get information out of an external page?
Hello! I try to get some information from an public DB to controll that the users input is right. I can access the DB via http, so I dont have to logg in to it The public DB write out and plain HTML page. I want to check if only one of the records is the same as the user input. I am only using the information in public DB to verify, and nothing else. Example of output from DB: * Name :Joe Lastname:Doe Userid:45545654 /*this is the information I wants City:New York * I figured out that I have to use fopen () and fread(). Could anyone give mes some hints! Thank's David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Image
Hello! I wonder if anyone can tell me how I can use an another image as an background in a new image? David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] SESSIONS
Hello! Could anyone give me an direction where I can find information something like "session for dummies"! It's not funny anymore. I don't have anymore hair left :-] david -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]