If I make something I usually put
session_start(); at the top of my page
Cause I use sessions everywhere.
If I make something I usually put
session_start(); at the top of my page
Cause I use sessions everywhere.
---------------
I also use the account: Dentafrice
---------------
Just put the session_start function at the top of your page, you can then add datum you want to store to the superglobal array $_SESSION. You can destroy the user's session by calling the session_destroy function.
I wouldn't replace ob_start but just add session_start under it, session_start isn't a counterpart for ob_start. The function ob_start simply adds all the output (except headers) to a buffer and then sends ("flushes") the page's content to the user's computer at the end. The script might require ob_start is called, as if prior to an outputting function headers are set, you'll be returned with an error (you can't set headers after outputting data, hence why ob_start might have been called). However, the person who coded it originally may have just been an idiot and added it unnecessarily. [:
Last edited by nets; 23-11-2006 at 03:11 PM.
kinda quit.
Rofl. Telling me to learn php.... Yeah very good Tom. Im suprised Henious didn't point out your mistake..
I tested this and it doesn't work.
Also, i love the bit about Dave being stuck up, it really made us laugh. Did you recall your humiliation in "Radio Panel Project" in the coding section..
You have checked to see if a session is set before putting session_start();
How the hell is it going to know if you havn't started the session?
Not to mention you dont need == when setting values, == is used when comparing strings, and it makes it case sensitive.
You are a clever chap![]()
Typo on the two =='s. Also the script does work.Rofl. Telling me to learn php.... Yeah very good Tom. Im suprised Henious didn't point out your mistake..
I tested this and it doesn't work.
Also, i love the bit about Dave being stuck up, it really made us laugh. Did you recall your humiliation in "Radio Panel Project" in the coding section..
You have checked to see if a session is set before putting session_start();
How the hell is it going to know if you havn't started the session?
Not to mention you dont need == when setting values, == is used when comparing strings, and it makes it case sensitive.
You are a clever chap
Does check to see if sessions are started... because if you start them twice you will get a error - it does not to see if a session is defined so please, shut up you PHP newbie.PHP Code:<?php
if (!isset($_SESSION)) {
session_start();
}
?>
Also what humiliation in "Radio Panel Project" are you talking about :s
Lets get some things clear here Mr. Know is all. You may think you know everything about PHP but in fact you do not so stop trying to make out you are the better of us because you'll only end up making enemies.
Tom is excellent at PHP. He is better than most of you, except carl, ect.
So sthu, and learn sessions at PHP.NET
(aimed at people dissing Tom)
Lol i don't think i know everything about php. Im not saying im better than everyone because im not, Henious and Carl are better than me (All i can think of atm)Typo on the two =='s. Also the script does work.
Does check to see if sessions are started... because if you start them twice you will get a error - it does not to see if a session is defined so please, shut up you PHP newbie.PHP Code:<?php
if (!isset($_SESSION)) {
session_start();
}
?>
Also what humiliation in "Radio Panel Project" are you talking about :s
Lets get some things clear here Mr. Know is all. You may think you know everything about PHP but in fact you do not so stop trying to make out you are the better of us because you'll only end up making enemies.
Yeah course it was a typo on the two =='s lol
But why the hell did you put:
Just tell me that then ill leave it..PHP Code:<?php
if (!isset($_SESSION)) {
session_start();
}
?>
I told you.Lol i don't think i know everything about php. Im not saying im better than everyone because im not, Henious and Carl are better than me (All i can think of atm)
Yeah course it was a typo on the two =='s lol
But why the hell did you put:
Just tell me that then ill leave it..PHP Code:<?php
if (!isset($_SESSION)) {
session_start();
}
?>
If session_start(); was called before it would give a error.. Basically its good coding practices and will prevent errors/warning even with E_ALL. Technically it is fine just to call session_start(); without first checking if session_start was called before.
righteo lets stop arguing lol.
I've read somewhere that
"Most coders hate each others way of coding"
Anyway
Lets stop now lol and soz for sounding know it all etc.
Basicly its a fail safe, it checks to see if a session varible exists, if not, it starts the session. If a session varible did exist on the other hand it would know it didnt need to declare a session, and hence avoide an error.
There are circumstances this script may be nessary, aka if your writeing a script for distrbution which is exspected to be includeing in to its users own page and codeing. If the user was useing sessions without it, when included there would be errors, with it, its far more likly to run properly.
On the other hand, in many situations, when a page is top level you know there are not going to be any sessions behind, in that case its really just a waste of code, and server resources (true a few bites bandwidth aint much, but after a billion page loads, it gona add up, so its good practise to code efficanly when possible :p)
I have to admit these sorts of code bites, are a side effect of learning php in a detached way, aka knowing what will do what, while not actualy understanding whats going on in the language "/ Which mostly isnt a problem unless in more complex useage. You will notice alot of people use the scripts they learn of copieing orignaly, even when theres no use for them, when i orignal started with vb for exsample i would often use the with blabla statement to assign my varibles while in many cases there was no need and a simple dbtypeUsers.somepart would have been far more applicable![]()
Lol, I would think nublets' iframes refreshing every 20 seconds would do that quite quick. After a billion page loads, most people would be out of bandwidth, because the rest of the script would be larger, + images and other pages, heh. (1.2tb of bandwidth owns pls)
Oh, and Jackboy dude thing, I didn't pick up on the mistake because I wasn't really paying attention to the thread, just was reading it and noticed your post, which made me lol.
XHTML, CSS, AJAX, JS, php, MySQL.
--
HxF moderators can't read timestamps.
Want to hide these adverts? Register an account for free!