Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





$_SESSION Array


A small problem that has me kinda baffled. This is the situation:

I've set up a self-submitting form FORM.PHP. Once the inputs are
validated, the info gets put in SESSION variables and the script
redirects the user to a review form REVIEW.PHP which displays the info
the user has input and allows them to edit or submit. At the top of
that page, I have the following code:

--- start code ---

foreach ($_SESSION as $key=>$submission) {
if ( empty($submission) || ($submission == "") || (strlen($submission)
== 0) ) {
$DISPLAY[$key] = "« BLANK »";
}
else {
$DISPLAY[$key] = $submission;
}
}

extract($DISPLAY);

--- end code ---

The form then displays the info now extracted from the $DISPLAY array.

By creating a new array $DISPLAY for the $_SESSION variables, the idea
is that this page will indicate the optional fields where the user
didn't input data with the string, "BLANK", without changing data in
the $_SESSION array. At the bottom, there is an edit button which will
take a user back to the original form where the form will be
repopulated with the $_SESSION data.

The problem I'm having is that the blank $_SESSION variables are being
overwritten with the "BLANK" string that's only meant to appear in the
review form. Not a huge problem, but I can't figure out why it is
happening.

Any ideas? I've scoured my code. There's nothing that deliberately
overwrites info in the $_SESSION array on the review page. All I can
figure is it must have something to do with the way FOREACH operates.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Copying A Multidimensional Array To $_SESSION
Specifically, is it possible to copy a multidimensional array into the
$_SESSION array - ie a deep clone of all keys and data?

I naively assumed that

$_SESSION["myArray"'] = $myArray ;

would work but it doesn't appear to work. Is there a single function
or assignment I can use, or would I need to use a "foreach" at every
level?

View Replies !   View Related
Clearing/deleting $_SESSION Array?
I have a $_SESSION array in a nested loop that I need to clear for multiple passes and cannot seem to figure out how to this. I have read the manual on unset and such but there seems to be no clear technique that I can ascertain. PHP Code:

View Replies !   View Related
Limit On The Size Of An Array In $_SESSION?
I have an object in the session-data which contains a search-result list.
It might, at various times, contain 16,000 entries or more.

I seem to be noticing, however, that when the size of the result-list is
more than around 1,000 records ... the object simply does not get saved
into the $_SESSION data at all.

The PHP memory-limit is 30 megs. I never see any curious output in the
Apache logs, and the application does not fail. The trouble is simply that
when the search result is large, and the search-results page enters, it
finds that there is no search-result object in the session data. For a
smaller result set, and /identical/ code, the object is there.

View Replies !   View Related
Removing A Single Value From $_SESSION Array.
What I have here is three select boxes one for all the tables in the db, one listing the table columns in that table and a third to collect the table columns selected stored in a session called $_SESSION['collections'].  Up to this point all that works beautiful the session stores the selected collections.

But heres what I want to be able to do: I want to remove single values from the $_SESSION['collections'].  How do I do that? Code:

View Replies !   View Related
$_SESSION Array Not Taking It's Values
?php
session_start();
if(!isset($_SESSION)){
$_SESSION=array();
}
if (isset($_POST['scheck'])) {
foreach ($_POST as $key => $val) {
if(ereg('^a[0-9]+$',$key)){
$_SESSION['$key'] = $val; ...?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

here is the session data but everytime I check the session values the array allways stays empty.

View Replies !   View Related
$_SESSION Passes Vars BUT NOT ARRAY
NO ONE seems to have had the problem I'm having - and it doesn't make ANY sense.

I'm running php 4.3.3 on a local server; and 4.3.10 on my isp's web server. I've tested this on both with the same results.

all I fricking want to do is pass an array from 1 script to the next - sure sounds simple enough - right? Code:

View Replies !   View Related
Updating Values In A $_SESSION Array
I've been working on a webshop, and I've got most of the functionality up and running. One problem, however, that I don't seem to be able to solve is as follows.

My shopping cart is stored in $_SESSION['cart'] array. As I need to keep tabs on what items are ordered and their quantity I add elements like this: Code:

View Replies !   View Related
Fetch Array - Create A $_SESSION Variable
I am writing a contact management php page. In the page I use mysql_fetch_array() to show the search results. If the user searchs by first name, there are times when multiple entries come up. Once the data is displayed on the screen the user has the option to edit, or delete this entry in the database. So on this one screen it shows all the search results.

If the user clicks on edit or delete, I then create a $_SESSION variable to bring this information to the edit or delete page. However this variable only gets created for the first entry when I do the mysql_fetch_array(). If I choose any entry after the first, it brings over the first entries information. How would I create a variable to bring this over to another page to edit or delete each specific contact. Is there a better way to do this?

View Replies !   View Related
Array Merge Problem - $_SESSION Involvement
I have a form that I have built for submitting a long list of information from the user. If there is a problem that got missed by the javascript validation I would like to catch the error on the server-side with a function I have in the form handler script. Then when they have to go back to the form, it is populated with the information that they had already typed in without having to re-type it again.

The problem is I would think the best way to do this is to create a session variable for each of the fields in the $_POST array. Then on the form itself, use the value = '{$_SESSION['fieldname']}' to populate the fields when they hit the back button. I read that ARRAY_MERGE() does not work.

I am working on a system that we do not know exactly what is already in $_SESSION array (we are basically hacking an existing system) so we need to leave the $_SESSION array intact, but add in the $_POST array. How do I do this easily without spelling out each and every variable explicitly on the form and placing it into the session array?

View Replies !   View Related
Array Problem... - Store This List In $_SESSION['liste'];
the user selects 6 numbers in a list I have to store this list in $_SESSION['liste']; (I cant do it differently) the list is stored like that: 34-21-44-32-12-11 (cant do it differently either)

what I need to do is to explode the array, get rid of the - , sort the values in ascending order and send them to my table as a string. so in the end I should have: 111221323444

I tried using a variation of laserlight's script (given in a previous post) without success... hope that someone will have time to give me a hand again in telling me what I could change in saberlights script to make it work.

View Replies !   View Related
Pass The Current $_SESSION[] Array Variables To Secure Domain
I'm trying to pass the current $_SESSION[] array variables to my secure domain for payment details. I am attempting this via passing the SID via URL thus:

example1.php (Non-SSL)
<?
session_start(); // Start Session
$_SESSION['package']='Package1'
$SID = session_id();
echo $_SESSION['package'] ;
echo "<form action='https://secure.example.com/example2.php?SID=$SID' method='post'><input type='submit' value='Continue'></form>";
?> example2.php (SSL)
<?
session_start(); // Start Session
if (isset($_GET['SID'])) {
$_SESSION['session_id']=$_GET['SID'];
}
echo $_SESSION['package'] ;
?>

View Replies !   View Related
Using $_SESSION
I have included some variables in my code that I want to be passed from page to page, I wrote the code and everything seemed to be working until I tried my pages from my workplace and discovered that the values weren't being passed. I tried lowering the internet security and allowing cookies and it was fixed. How do I write my code so that all ie sessions will allow the values to be retained?

View Replies !   View Related
IE6 $_SESSION
everything works fine in IE7 and Firefox (typical ) - also im new to PHP programming, so i may be omitting something. But searching thru the net, including these forums, i have found a fair few posts about this kind of issue, but none of the suggested solutions seem to work.

anyway heres my code.
session_start();
if($_POST['username'] && $_POST['password'] ) {
    if($_POST['username'] == "correct" && $_POST['password'] == "correct"){
        $_SESSION[username] = "correct";
        $_SESSION[password] = "correct";
    }
}
if($_SESSION[username] == "correct" && $_SESSION[password] == "correct"){
    $loggedIn = 1;


what happens is in IE6, if im on the login page, if i enter correct username and pass, then submit the form, the page reloads and updates correctly to reflect the successful login. but then as soon as i navigate to another page i get magically logged out again.

View Replies !   View Related
Use $_SESSION
Can I use $_SESSION to store objects? e.g.

var $obj = new myclass();
$_SESSION['obj'] = $obj;

View Replies !   View Related
_session &
I can store variables that need to be verified to the database and use them throught the a series of php files?

View Replies !   View Related
Getting Mad With $_SESSION
if(isset($_SERVER["HTTP_REFERER"])) {
session_register("backurl"); $_SESSION["backurl"]=$_SERVER["HTTP_REFERER"];
//session_register("try"); $_SESSION["try"]="TRY";
}

The code itself is pretty easy.
When remove the // of the second line, $_SESSION["try"] is registered and appear in my session file. So what can be wrong with the $_SESSION["backurl "] knowing that:

The $_SESSION["backurl"] is in fact registered (since echo $_SESSION["backurl"] give me what I want), it is just that when I am trying to see its value in the session file, I DON'T SEE IT!

View Replies !   View Related
$_SESSION
What I'm trying to do is something like this, of course it doesn't work...I'm just not sure if it's possible to create (and reference) session arrays in this manor or if i've got a syntax error: PHP Code:

$_SESSION['cart']['itemNumber'] = $itemNumber;
$_SESSION['cart']['itemQty'] = $itemQty;
$_SESSION['cart']['itemDesc'] = $itemDesc;
$_SESSION['cart']['itemPrice'] = $itemPrice;
//...etc

the error I get is: Quote:

View Replies !   View Related
Uses Session_register Rather Than $_SESSION
I'm working with some old code that uses session_register rather than $_SESSION


The variable is registered as follows:
session_unregister('mymessage');
$mymessage = "1";
session_register('mymessage');


Once registered, what is the correct syntax to recover the value from the session variable?

is it simply:

$passed_value = $mymessage;

I tried this, but it doesn't seem to work - it's null when I try to recover the value from another page in the same session.

View Replies !   View Related
$_SESSION Issue
I put together a code that checks for 2 post variables then stores them
in a multi-dim $_SESSION array, something like this:

If ( isset($_POST['value_a'] && isset($_POST['value_b']) )
{
$_SESSION['value']['a'] = $_POST['value_a'];
$_SESSION['value']['b'] = $_POST['value_b'];
}

The problem was that $_SESSION['value']['b'] was being overwritten with
the value for 'a' so that both $_SESSION['value'] vars ended up being
the same (i.e. $_POST['value_b']. I thoroughly tested it to confirm
that this was what happening.

I solved the problem by changing the $_SESSION vars to
$_SESSION['value_a'] and $_SESSION['value_b'].

This was PHP 5, the WAMP package -- I know it's not the latest update
of PHP 5.

My question: is this a bug (perhaps since fixed) or is there a reason
this would be expected behavior?

View Replies !   View Related
$_SESSION, Session_is_registered
Platform: Win2k Server, Apache 1.3, PHP 4.2.3

I understand that when using $_SESSION variables, using the
"session_register()" function should not be done. I have seen no
documentation pertaining the the "why" of this, but I am removing the
offending statements from my code anyway.

Prior to discovering this tidbit, I had been attempting to save some arrrays
in individually registered variables. But the arrays were not being saved
between pages.

I have also attempted to save the array in a $_SESSION variable (e.g.
$SESSION['XYZ']=$XYZ, xyz being an array); still no joy (the data seems to
be ending up in the $_SESSION variable, but again it is not saved between
page requests).

"register_globals" is set to "On" in the INI file.

So, to the PHP world at large I ask "what am I missing"?

View Replies !   View Related
$_SESSION Not Working?
I have two test files called index.php and index2.php.

Index.php:

<?php
session_start();
$_SESSION['sess_var'] = "hello world";

?>

<a href="index2.php">click</a>

-------------------------------------------------------------------------------
Index2.php:

<?php
error_reporting(E_ALL);
session_start();

echo $_SESSION['sess_var'];
?>

Index2.php does not display anything?!?! Any ideas??

I look at the session cookie and it has been set with the following
inside it:

sess_var|s:11:"hello world";

When I placed the line:

error_reporting(E_ALL);

in index2.php I got the following error:

Notice: Undefined index: sess_var in c:program filesapache
groupapachehtdocsindex2.php on line 5

line 5 is:

echo $_SESSION['sess_var'];

View Replies !   View Related
Errors With $_SESSION
the website i'm creating will block "guest" users to some sections of the site. when "guest users" go to "download" page it will show an alert window. logged in members have the access to download page.

in "login.php", i create a $_SESSION var, each member has their own level, depending on the type of features they want;

$_SESSION['mylevel'] = $member_info['level'];
the checking of level to show the alert window is this: Code:

if (($_SESSION[mylevel']=='')||($_SESSION['mylevel']==&#399;')) { ?>
<SCRIPT LANGUAGE=JavaScript>
var agree=alert('Please login first.');
window.location='http://www.mywebsite.com'
</SCRIPT><? }

problem is like this; as a guest user, i go to "download" page, the alert window shows up, saying "please login first". (that's ok) when i log in, then go back to "download" page it still shows the alert window. i have to close the browser first then go to "download" page before its accessible.

View Replies !   View Related
Session_register Or $_SESSION
I am using PHP 4.3 i have heard that we should use $_SESSION rather than session_register to register a session...is it true? also I should no longer use session_is_registered() or anything alike....i should use isset($_SESSION()) instead.

View Replies !   View Related
$_SESSION Vs. $variable
What am I doing wrong?

I set the variable co_name on the first page with an <input.... > and
session_start() at the top of both pages.

Clicking on a link that takes me to the second page:

Script on the second page.

echo $_SESSION['co_name']; Does not display
value of co_name
echo "Variable name co_name = ".$co_name; Displays value of co_name

One book suggested using echo {$_SESSION['co_name']}; Does not run.

Server is Apache2 Triad

View Replies !   View Related
$_SESSION[] And Forms
I am trying to declare session variables on a database 'insert record' page so that they can be used on the redirect page (the page that loads after the records are sent to the database). Currently I have it working but I have found out that session_register() is deprecated, so I'm trying to use $_SESSION like i should.

But I can't get it to work. I have tried everything I can think of, and spent about 10 hours searching for an example that i can understand. Several of them looked right, but didn't work for me. i make some vars from post values: PHP Code:

View Replies !   View Related
Problem Using $_SESSION
I wondered if anyone could offer me some guidance, I wrote this script
using the dzsoft php editor, which links to php.exe and a internal
server.

Though when I run the code the session files are created, but the item
number in the files never increase beyond (0).

I just wondered if there was anyone options in the php.ini I could
change, to allow this premission. Or any session option I could add to
the code.

<?php
error_reporting(E_ALL);
ini_set('display_errors', &#391;');

session_save_path('c:');
session_start();
if (!isset($_SESSION['item1'])) $_SESSION['item1'] = 0;
if (!isset($_SESSION['item2'])) $_SESSION['item2'] = 0;

if(isset($_GET['Item1'])){
$_SESSION['item1']++;
}
if(isset($_GET['Item2'])){
$_SESSION['item2']++;
}
?>

<html>
<head>
<title>Test Page</title>
</head>

<body>

<form>
<input type="submit" name="Item1" value="Item 1">
<input type="submit" name="Item2" value="Item 2">

<p>Number of Item 1 clicks: <?php echo $_SESSION['item1']; ?></p>
<p>Number of Item 2 clicks: <?php echo $_SESSION['item2']; ?></p>
</form>

</body>
</html>

View Replies !   View Related
Work With $_SESSION
I've tried to work with $_SESSION and it's ok...but this way it won't work. PHP Code:

View Replies !   View Related
$_SESSION Does Not Work To Me...
Another newbie question.

I'm using to do a test

$_SESSION["count"]++;

after a POST action, but evry time the page is reloaded $_SESSION is never
initialized... why?

View Replies !   View Related
Using Arrays With $_SESSION
I'm really confused on how to store arrays in a $_SESSION.

Right now to access an array I basically do this:

$lc = $_SESSION["cart"];

$lc[$item] = 1;
(plus some other manipulative code)

$_SESSION["cart"] = $lc;

Is there a better way to do this? I can't seem to figure out a proper
way to include the array index inside the same line as $_SESSION (such
as $_SESSION["cart($item)"].

View Replies !   View Related
Benefits Of Using $_SESSION
I'm running PHP4.2.3 on W2K box with Apache 1.3.2 I need to set up a login page and some session control for a site I'm working on. I know that there are numerous ways of doing this. Can anyone tell me the benefits/pitfalls of using $_SESSION.

over a class (or any other similar class like session control) called sessMan that stores the session detail in MySQL with all sorts of fancy encrypting code. How secure is $_SESSION?

View Replies !   View Related
PHP $_SESSION Expiring In IE 6/*
comp.lang.php,

I have recently launched the new Planet-Tolkien.com, one would think
that writing a message board from scratch and a dynamic weather
system, a simple session login would be the least of my problems
right? Wrong.

It would appear that for Mozilla and Opera keep a $_SESSION is not an
issue and the $_SESSION is continued until the member logs out.
However when members are using Internet Explorer browser (most
versions it seems), they can go around the site for varied amounts of
time, usually less than five minutes and then their $_SESSION will
expire!?

I cannot for the life of me figure out why a server side $_SESSION
would expire on IE but not for MOZ or Opera but it is, and I need to
figure out why and how can I fix this.

REF. All login information is saved as such:

session_save_path("$path/sessions");
session_start(); $_SESSION['session_memberID']=$session_memberID;
$_SESSION['session_username']=$session_username;
$_SESSION['session_groupID']=$membergroup;

View Replies !   View Related
How Do I Set A $_SESSION Variable
This is page is called to delete a row on a table using form input. I
set a session variable based on the result of mysql_query and want to
pass it back to the caller like this.

if (mysql_query($deleteSQL,$emailmanager) &&
mysql_affected_rows()>0) {
$_SESSION["mysql_query_result"] = "Your email address has been
successfully removed";
}else {
$_SESSION["mysql_query_result"] = "Your email address was not
found. Please try again";
}

.....

Here is the return code (generated by Dreamweaver) -

header(sprintf("Location: %s", "http://".$_SERVER['HTTP_HOST'].
$deleteGoTo));

How do I return the session variable to the caller? The $_SESSION
array does not exist on return to the caller. I check it using this
print code -

while ($var = each($_SESSION)) {
printf ("Session key <b>%s</bhas the value of: <b>%s</b><br>",
$var['key'], $var['value']);
}

View Replies !   View Related
$_SESSION Question:
Is there a maximum amount of variables you can stack into a session array?

I have this:

$_SESSION['count'] = $first;
$_SESSION['blah'] = $first;

echo $_SESSION['blah']."--";
echo $_SESSION['count'];

the result is always the same, $_SESSION['count'] = $first; seems to take but the second does not.. I do have several other session values.. just wondering if I reched my limit??  I have tried everything I could think of but no go.

View Replies !   View Related
_SESSION And Form
I am in the progress of creating a script to upload images with, but I have now come to a problem while wanting to add some data to the database.

The form start looks like this:
<form action='upload.php' method='post' enctype='multipart/form-data'>

When I am uploading pictures from gallery.php it is supposed to check if the user has the level required to upload images. So when it sends the data to upload.php it should make a mysql query to check whether the level is high enough or not. The problem, now, is that when you log in your user id is stored in $_SESSION["uid"] which is used in the mysql query, but it does not receive the uid on upload.php. Is there any way in which I can make upload.php receive the $_SESSION["uid"]? In a secure way, not being by inserting the uid in a $_POST or in the link.

I have made a session_start(); in upload.php and required the functions.php (which created the $_SESSION["uid"]) file in upload.php also. None of it makes upload.php get the $_SESSION["uid"].

View Replies !   View Related
$_SESSION Compatibility
does anyone have any stats on the percentage of browsers/environments that support session cookies? Reason I ask is that I might have come up with a spellbinding anti-form-spam solution.

View Replies !   View Related
How Secure Is $_SESSION['id']
i am creating i am basing alot of things around a session id, for example when a customer logs in they are assigned a session id, and on the pages of the website they have many if statements, for example

if($_SESSION['cust'] != ''){

echo "Previous orders<br>Current Orders<br>Logout<br>";

}else{

echo "Login";}

But i was wondering if it is possible to somehow obtain this session id without actually logging in .

View Replies !   View Related
Unset $_SESSION Set Anyway?
On first pageview $_SESSION['allowed'] is set and  $_SESSION['disallowed'] is not. Why? This should only happen upon successfull log-in.

The code appears a bit long, but it's mostly just a log-in routine with various checks. When "allowed" is set, sections should be accessible from links in the menu. Code:

View Replies !   View Related
Isset($_SESSION)
i'm modifying a script which handles a member area but i can't get the utility of a couple of lines and the php manual is not enought clear for me on the matter. Basically after a user login (which username and password), the script start a session and store and pass the value of the username: Code:

View Replies !   View Related
Use $_SESSION['variable'];
this is going to sound really dumb but how to you set a session variable, i know you can use $_SESSION['variable'];, and i have read about session_register and session_unregister my problem is that at present i am using $_SESSION['variable'];

but i dont know how to clear/destroy this because when a Customer enters the website they can login or enter as a guest and if they enter as a guest they can login later, the only problem is when i go to the login later the $_SESSION['variable']; is registered as Guest still so i need to clear this and then reassign them with their customer number.

View Replies !   View Related
$_SESSION Query
I am writing a query and I want to pull a row where the username of the row= $_SESSION["username"] So I write my query like this Code:

View Replies !   View Related
Unset($_SESSION );
ive made a simple log out page using teh followin gto allows users to effectivly log otu e.g. remove records from the current session:

[php
<?php
unset($_SESSION );

?>
[/php]

is there any way to force logout after a certain time perios jsut incase someone doesnt log out?

View Replies !   View Related
$_SESSION Getting Swaped
My user login data is getting messed up, after about 5 minutes of being logged in if 2 people are logged in they will retain their first name session, but swap username sessions randomly. Its very confusing and I don't know why its happening the sessions are recalled as

$_SESSION['firstname'];
$_SESSION['username'];

I don't know how it can confuse username, but not firstname. its very baffling.

View Replies !   View Related
Is $_SESSION Accessible From CLI PHP
Is it possible to access values preset from $_SESSION from within a CLI PHP page? If so, how is it done? Each time I try to access $_SESSION is an empty array; the moment I leave the CLI PHP and return to my calling web-app PHP script, $_SESSION is back again, values and all, completely untouched.

Can $_SESSION be called? If not, then I have a bigger problem inasmuch as $_REQUEST variables set via form/query-string MUST be accessed from within CLI PHP script, and the only way I can think of is to put all of $_REQUEST into $_SESSION, or what else do I do?

View Replies !   View Related
Problems With $_SESSION
I am trying to develop a multi language application where I retrieve the labes from the database. Code:

View Replies !   View Related
$_SESSION, Session_register
I am modifying some scripts to use $_SESSION without registered globals turned on. The scripts curreently use session_register, session_unregister and so on. I need to know what to do to modify the scripts to use $_SESSION. Here is some code from the scripts where the scripts use session_register, unregister, etc.

session_is_registered

PHP Code:

if (session_is_registered("order_no"))
   {
      echo " <td><input type="submit" name="empty" value="Empty Cart"></td>
";
      echo " <td><input type="submit" name="view" value="View Cart"></td>
";
   } ...........................

View Replies !   View Related
$_COOKIE And $_SESSION In PHP
One of the only things that i've come across after coding in PHP for over 2 years now is the error:

Warning: Cannot modify header information - headers already sent by

i understand this when you are doing redirects using code such as:
<?
header("Location: );
exit;
?>

but what i don't understand is what $_SESSION's and $_COOKIES have got to do with the headers. when i do a session_start for example when the page has been redirected to by the method above it brings up the error. Although if i supress the error with an '@' the script functions perfectly.

View Replies !   View Related
$_SESSION, Autostart
I just started with a service provider who's giving me a server to put my scripts. I noticed when I copy scripts that work on my machine to this server, all things $_SESSION are null. I read some on php.net and found that session_autostart has to be set to true in order for me to use $_SESSION variables at all.

Am I reading that right? Obviously, I have no control over this setting on someone else's server so I cannot change it. Is this why my $_SESSION values are all null? Is there a workaround? I tried putting session_start(); at the very beginning of the first script. No change.

View Replies !   View Related
$_SESSION Value Gets Cleared
I am setting a PHP session with the following code:

session_start();
$_SESSION["lang"] = "de";

This is set on a page called "index.php", on "index.php" there is a link to "contact.php". On "contact.php" I am checking for the session value, but it appears to be blank?

Simply using: echo "<strong>HEADER SESSION -> " . $_SESSION["lang"] . "</strong>";

Is there something that is clearing it? I'm not using anything to clear the session value, just don't understand how it is behaving here?

View Replies !   View Related
$_SESSION: Security
I am making a web portal that uses username and password to login but also has different levels of user permissions, i figured the easiest way to ensure pages are only viewed by users that are logged in and of the right permission is to use $_Session vars to store 2 variables:
$_SESSION['logged_on'] =[true][false]
$_SESSION['perm']=[user][exec][admin]

if i enclude the blow code in each page to ensure user is logged in and has the right permissions, is it secure. code: PHP Code:

<?PHP
session_start();
if ($_SESSION['logged_on']==true && $_SESSION['perm']=='admin')
{
     //page content only viewable to admin class users
}
?>

is this system of user tracking and autorization secure, ie cant easily be tampered with to allow a 'user' level user from accessing an admin only section.

View Replies !   View Related
$_SESSION And Simple_xml
I stored some simple_xml data into sessions variables

Example

Code:
$_SESSION['resultat'] = $parsed->toto;
After that, I get the following error message

Code:
Warning: session_start() [function.session-start]: Node no longer exists in C:Program FilesWampwwwetc... on line 2
And I finally solved my problem doing this:

Code:
$_SESSION['resultat'] = (string) $parsed->toto;

But I still have 2 questions: Code:

View Replies !   View Related
Losing $_SESSION Var
My code was running fine until the server was patched with the latest updates. (Novell)

I am trying to secure my phpMyEdit pages. I have a login form and a Master Links page for accessing the different pages. The login (Page 1) is working fine. When it passes the Username/Password screen, it then opens the Admin links page (Page 2).

My $_session vars are fine until I click on one of the links (Page 3) to access another page.

I did an echo on the page (Page 3) for my $_SESSION var which did not show up. BUT this session var does show up on the Admin Links page (Page 2). Does anyone have a clue why my session vars drop on page 3?

View Replies !   View Related
$_SESSION Doesn't Work
i cant't save variables from one php page to another despite i use the session_start and $_SESSION functions.

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved