7 1563
dangerd napisał(a):
Hello,
Thought I'd try this forum as I got some useful help from here before.
Duncs
The code for all the php pages can be seen by changing the .php
to .txt, i.e:
Hello, first of all http://www.multidome.co.uk/test/authorisation.txt
is wrong - you should call session_start() before sending any data to
the browser (at the beggining of your scripts).
Write it for example one line after error_reporting (null);
(and remove it from auth() function).
Secondly, don't use session_register, just write anything to $_SESSION
(if you are using PHP 4.1 or later).
--
Wiktor Walc http://phpfreelancer.net
On Apr 9, 8:52 pm, iktorn <s...@phpfreelancer.netwrote:
dangerd napisał(a):
Hello,
Thought I'd try this forum as I got some useful help from here before.
Duncs
The code for all the php pages can be seen by changing the .php
to .txt, i.e:
Hello, first of allhttp://www.multidome.co.uk/test/authorisation.txt
is wrong - you should call session_start() before sending any data to
the browser (at the beggining of your scripts).
Write it for example one line after error_reporting (null);
(and remove it from auth() function).
Secondly, don't use session_register, just write anything to $_SESSION
(if you are using PHP 4.1 or later).
--
Wiktor Walchttp://phpfreelancer.net
Thanks for the help Wiktor,
>is wrong - you should call session_start() before sending any data to
the browser (at the beggining of your scripts).
Write it for example one line after error_reporting (null);
(and remove it from auth() function).
The point of having it inside the function is to only start the
session if a session has not already been started. With that in mind,
do you still think I should take it out of the function?
Duncs
On Apr 9, 8:52 pm, iktorn <s...@phpfreelancer.netwrote:
dangerd napisał(a):
Hello,
Thought I'd try this forum as I got some useful help from here before.
Duncs
The code for all the php pages can be seen by changing the .php
to .txt, i.e:
Hello, first of allhttp://www.multidome.co.uk/test/authorisation.txt
is wrong - you should call session_start() before sending any data to
the browser (at the beggining of your scripts).
Write it for example one line after error_reporting (null);
(and remove it from auth() function).
Secondly, don't use session_register, just write anything to $_SESSION
(if you are using PHP 4.1 or later).
--
Wiktor Walchttp://phpfreelancer.net
Hello,
I got rid of the session_register() and the problem persists. I think
what is happening is that the $_SESSION[$authdata] (I took your
advise on board) dissapears after five or so refreshes but then
reappears after another refresh. There does not seem to be a pattern
on the number of refreshes it takes for $authdata to dissapear.
Strange...
Duncs
dangerd napisał(a):
On Apr 9, 8:52 pm, iktorn <s...@phpfreelancer.netwrote:
>dangerd napisał(a):
Hello,
I got rid of the session_register() and the problem persists. I think
what is happening is that the $_SESSION[$authdata] (I took your
advise on board) dissapears after five or so refreshes but then
reappears after another refresh. There does not seem to be a pattern
on the number of refreshes it takes for $authdata to dissapear.
Strange...
Duncs
There is always some reasonable solution for such problems ;)
In http://www.multidome.co.uk/test/gallery.txt authorisation.php
is included afer DOCTYPE declaration, therefore session_start()
isn't called at the beginning of the script and your session is being
lost (if you don't have some output buffering turned on).
The proper way of using session is:
<?
//must be called on every page
session_start();
//after calling session_start(), assign anything to $_SESSION
$_SESSION['foo']='bar';
//now let's generate HTML
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Multidome- The UK's favorite telescopic pool enclosure.</TITLE>
<?
//you can use $_SESSION also after sending text to the browser
$_SESSION['foo2']='kkk';
?>
If it didn't solve your problem, turn on debugging (including E_NOTICE
reporting) - it's the best way to find some bugs in code.
--
Wiktor Walc http://phpfreelancer.net
On Apr 10, 6:44 am, iktorn <s...@phpfreelancer.netwrote:
dangerd napisał(a):
On Apr 9, 8:52 pm, iktorn <s...@phpfreelancer.netwrote:
dangerd napisał(a):
Hello,
I got rid of the session_register() and the problem persists. I think
what is happening is that the $_SESSION[$authdata] (I took your
advise on board) dissapears after five or so refreshes but then
reappears after another refresh. There does not seem to be a pattern
on the number of refreshes it takes for $authdata to dissapear.
Strange...
Duncs
There is always some reasonable solution for such problems ;)
Inhttp://www.multidome.co.uk/test/gallery.txtauthorisation.php
is included afer DOCTYPE declaration, therefore session_start()
isn't called at the beginning of the script and your session is being
lost (if you don't have some output buffering turned on).
The proper way of using session is:
<?
//must be called on every page
session_start();
//after calling session_start(), assign anything to $_SESSION
$_SESSION['foo']='bar';
//now let's generate HTML
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Multidome- The UK's favorite telescopic pool enclosure.</TITLE>
<?
//you can use $_SESSION also after sending text to the browser
$_SESSION['foo2']='kkk';
?>
If it didn't solve your problem, turn on debugging (including E_NOTICE
reporting) - it's the best way to find some bugs in code.
--
Wiktor Walchttp://phpfreelancer.net
Wiktor,
I have tried what you suggested but the problem, still persists. I
have updated the txt code so you can see for yourself.
....any more ideas?
Thanks
Duncs
dangerd napisał(a):
On Apr 10, 6:44 am, iktorn <s...@phpfreelancer.netwrote:
>dangerd napisał(a):
Wiktor,
I have tried what you suggested but the problem, still persists. I
have updated the txt code so you can see for yourself.
...any more ideas?
Thanks
Duncs
replace auth function with these piece of code, should work
function auth ( $login = '', $password = '' )
{
if (isset($_SESSION['authdata']['login'])) {
return TRUE;
}
elseif (!empty($login))
{
if ( $login == myuser && $password == mypass or $login ==
myuser2 && $password == mypass2 ) {
$_SESSION['authdata'] = array ( "login" =$login );
return TRUE;
}
$_SESSION['authdata'] = array();
return FALSE;
}
else {
return FALSE;
}
}
your previous function used "global $authdata;" - variable $authdata
would only exist if you had register_globals turned on.
--
Wiktor Walc http://phpfreelancer.net
On Apr 10, 7:53 am, iktorn <s...@phpfreelancer.netwrote:
dangerd napisał(a):
On Apr 10, 6:44 am, iktorn <s...@phpfreelancer.netwrote:
dangerd napisał(a):
Wiktor,
I have tried what you suggested but the problem, still persists. I
have updated the txt code so you can see for yourself.
...any more ideas?
Thanks
Duncs
replace auth function with these piece of code, should work
function auth ( $login = '', $password = '' )
{
if (isset($_SESSION['authdata']['login'])) {
return TRUE;
}
elseif (!empty($login))
{
if ( $login == myuser && $password == mypass or $login ==
myuser2 && $password == mypass2 ) {
$_SESSION['authdata'] = array ( "login" =$login );
return TRUE;
}
$_SESSION['authdata'] = array();
return FALSE;
}
else {
return FALSE;
}
}
your previous function used "global $authdata;" - variable $authdata
would only exist if you had register_globals turned on.
--
Wiktor Walchttp://phpfreelancer.net
Ace!!
You nailed it. You have made my day!
You are a king amongst men my friend.
Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Al Jones |
last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate
group would you point me toward one that is.
Basically, I seem to be losing session data part way though preparing an...
|
by: Lina Manjarres |
last post by:
Hello,
I have a session variable in a login page. Then I go to a form page where I
uses the ProfileID and the UserID. Then I go to a result page where I would
like to use the UserID as a filter,...
|
by: PJ |
last post by:
A particular page seems to be having issues with correctly setting Session
variables. I am setting a couple of session variables on the Page_Unload
event. While stepping through code, the...
|
by: Harry Simpson |
last post by:
I've come from the old ASP camp where session variables were not used. When
i started using ASP.NET in 2001, I started using them again because it was
ok from what I'd read.
I've been merrily...
|
by: tshad |
last post by:
I have been using the default session state (InProc) and have found that I
have been loosing my information after a period of time (normally 20
minutes).
Is there anyway to find out how much...
| |
by: Alan Wang |
last post by:
Hi there,
Once my application gets complicated and complicated. I found it's really
hard to keep track of Session value I am using in my asp.net application. I
am just wondering if anyone have...
|
by: Phillip N Rounds |
last post by:
I'm writing a user control which has two states: Active & InActive. I
additionally am required that there to be only one active control per page,
and all logic has to be contained within the...
|
by: BillE |
last post by:
When a user opens a new IE browser window using File-New-Window the
integrity of an application which relies on session state is COMPLETELY
undermined. Anyone who overlooks the fact that...
|
by: BillE |
last post by:
Some ASP.NET applications use Session Variables extensively to maintain
state.
These should be re-written to use viewstate, hidden fields, querystring,
etc. instead.
This is because if a user...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |