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 Not Storing ID


I am attempting to create a login in script using a session variable to hold the user id. I have got the log in facility working. Just before I redirect the user I set the session variable to the ID.

Then when I get to the next page I check to see if the session exists, if it does then I output it. The only problem is that instead of outputting the ID I keep getting 'Session ID: Resource id #7' Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Storing Value In Session - Session_start(): Cannot Send Session Cookie - Headers Already Sent By.
when i am storing value in session i am geting this error

session_start(): Cannot send session cookie - headers already sent by.

View Replies !
Storing Object In Session
I'm trying to figure out how to store an object in session. To try
this, I have apache2 and php5 running on my windows machine. I used the
2 files below. First i run test.php, which creates the object, puts
some data in it, and stores it in the session. test2.php retrieves the
object from the session and prints the data. Works fine on my windows
machine. However, when I upload these 2 files to my hosting provider,
then it does not work anymore. I get no errors, but the object seems to
be empty. The provider is running php4.3 ... Can someone help me find a
way to fix this?

Code:

View Replies !
Session Variables Not Storing
i recently read the tutorial on this site about e-commerce. im completing the second lesson and i cant seem to get any of the session variables to store. im sure there isnt a problem with the code as its directly from the tutorial. ive played around with settings in my php.ini file but cant seem to get anywhere. im a real novice at this stuff so any info would be great!

View Replies !
Storing Variables In A Session
I'm sending a number of variables between 2 pages using the form GET method, and I want to store them in a session. The variables are basically called after dates and they will equal "yes" if the user has selected them.

Eg. they might have selected 3 tickboxes in page 1:

$07042007 = yes
$18042007 = yes
$22042007 = yes

which get sent to page 2 via the URL
is there any way of storing these in session variables of the same names?

View Replies !
Storing Data In Session
Have a question about storing data in session. I have a blog site with users of course. Instead of having to make a call to getUserData() each time I want user data inside a function (or defining it globally) I thought about storing the data in a session variable and doing one of two things. Keeping that throughout the lifetime of the session, and only re-querying if a change has been made since the request was pulled (Date field in the user table of last_modified) or just storing it in session and un setting the data each page.

Not sure which (if any) is better. Most likely there will be about 20 fields stored, username, email, and some options the user is able to set which should only be boolean variables. I think storing it in session and testing against the timestamp would work great but before I start coding this for my whole site would like to know some input.

View Replies !
Storing An Array In A Session
i have an array full of things but i would like to use it throughout the whole site so how do i store it in a session at this script extracts an array

foreach ($pages as $value)

{
$count++;
$_SESSION['$pages["$count"]'] = $value;
}

and sticks it into an array in a session but its not working.

View Replies !
Storing Variables In Session
I am re-creating the insurance booking form here storing variables such as telephone number and address are fine as the have a single and unique name to reference them to. However with the list of names & DOB - because the amount of rows produced depends on how many the user specifies I do know what method to use to recall them when I want to display them on screen a couple of pages later. I have managed to give each text box name on every row a unique reference i.e.

"surname1" "dob1"
"surname2" "dob2"

So its just finding out the way to recall them each.

View Replies !
Storing Login Name In Session
i m storing login name in session and i wanna make logout so i m using unset function but its not working and the session still has the variable. here is my code

if(isset($_SESSION['Login_Name']))
unset($_SESSION['Login_Name']);

echo '<script language="javascript">
window.location="login.php";
</script>'

View Replies !
Storing Objects In A Session 5.2.0
I have read the message boards in this group and others. I still have
not been able to pull my obect out of a session and use it. Here is how
I store it in a session: Code:

View Replies !
Storing An Object In A Session Variable
Is it safe to store an object in a session variable, allowing it to be unserialized without the class definition loaded in some cases, then, later, unserialize with the class definition loaded and continue using normally? e.g.

page 1: load class definition, start session, create new object, store in session variable

page 2: start session, don't access object stored in session

page 3: load class definition, start session, access properties / methods of object stored in session

The PHP manual says

It is strongly recommended that you include the class definitions of all such registered objects on all of your pages . . . If you don't and an object is being unserialized without its class definition being present, it will lose its class association and become an object of class stdClass without any functions available at all . . .

What I am wondering is whether that explanation should be qualified by "for that request". That is, does unserializing the object without the class definition loaded only cripple the object for that request, or does it permanently damage it when it is reserialized?

I tried a quick, simple test by creating three pages that behave as described above, and it appeared to work fine.

View Replies !
Storing Radio/checkboxes Using Session
can this be done on radio buttons and checboxes? It works fine for text fields and dropdown munes but I am not sure how I can do this with radio buttons.

The problem is that if a radio button is checked it wouldn't show on the preview part. Nor does pressing the back button. I would like to shipt it to the database eventually. PHP Code:

View Replies !
Storing Session Data In Mysql
how i can store session data in a MySql Database...this is because my use multiple servers and session data can get lost?

View Replies !
Storing Session Info In MySQL
I've written a login system which uses session variables to store details about the user. The site isn't holding sensitive data, so this isn't a problem.

What I'd like to do though, is store each login in mySQL and use it to automatically log the user back in next time around. Also want to use the logged in information for statistical information, such as how many registered users are logged in, and how many guests are going around on the site.

I know vBulletin uses a system similar to this, by storing the session ID in a database and using it from there. Can anyone explain roughly how this would work for logging in the first time, and relogging in next time?

View Replies !
Storing A Cart Object Within A PHP Session
I'm currently building an object-oriented shopping cart with PHP 4.3.2 and
MySQL 4.0.14.

I am looking at storing a Cart object within a PHP session, however I am not
completely sure on the best way to achieve this. I have read up and there
seems to be varying advice. Should I need to serialise and unserialise the
object or is this automatic and should I be using session_register()? For
reference, register_globals is off.

View Replies !
-forgot- Storing Objects In A Session PHP 5.2.0
I have read the message boards in this group and others. I still have
not been able to pull my obect out of a session and use it. Here is how
I store it in a session:

<?
//Include the UserClass & RoleClass so that we can create a user
object.
require_once("UserClass.php");
require_once("RoleClass.php");

//This has to be the first line of code a file if sessions are used.
session_start();

//Create a new user object
$user = new User();
$user->setName($_SERVER['HTTP_OBLIX_GIVENNAME']);

$role = new Role();
$role->setSysName($xml->roles[$i]->systemName);
//Now add the role to the user object.
$user->addRole($role);

//Save the user object in the session
$_SESSION['user'] = $user;
?>

This is how I try to pull the object out:

<?
require_once("UserClass.php");
require_once("RoleClass.php");

session_start();

//Include the UserClass & RoleClass so that we can create a user
object.

//See if there is a user object in the session
if ( isset($_SESSION['user']) ){

//Get user object from session
$user = (User)$_SESSION['user'];
}

I have also just tried:
$user = $_SESSION['user'];

?>

I receive errors like these:
<b>Parse error</b>: syntax error, unexpected T_VARIABLE in
<b>/home/as411161/apache/htdocs/common/vcp_menu2.php</bon line
<b>14</b><br />

I also get this message:
<b>Warning</b>: session_start() [<a
href='function.session-start'>function.session-start</a>]: Node no
longer exists in
<b>/home/as411161/apache/htdocs/common/vcp_menu2.php</bon line
<b>5</b><br />

View Replies !
Storing Values As Session Variables
I have a submit-type button named "done". I am doing print testing and initially, this is what is printed:

Request_Method = GET
Post Data: Array ( )
Sessions: Array ( )

If I enter some values and submit, they are populated into the Post array and not the Sessions array. I have maintained the values and when I submit again, it then populates the values into the Sessions array, however, nothing is able to be passed to the next page. Values are able to be passed to the next page via the Post method. I'm bewildered. Code:

View Replies !
Storing A URL String Into A Session Variable
I'm wondering is there is a way to store the URL of a page into a session variable. I would then use this to create a hyperlink to the page.

View Replies !
Storing An MD5 Hash Of The Login Time In The Session
I am half way through making a site you can only do certain stuff if logged
in to.

So far, you are logged in if there is a session variable with your username,
but I got thinking that presumably someone who worked this out could make a
cookie file with this info in and pretend to be another user. So... what's
the recommended way?

I thought of storing an MD5 hash of the login time in the session and in the
database too, then on each page, comparing the session variable to that in
the db. Theory being, if a hacker had tried making their own cookie file
they wouldnt have the right hash.

View Replies !
Working With Sessions And Storing Credit Card Info Inside A Session
have a security concern working with sessions and storing credit card info inside a session, going to the payment gateway, redirecting back to my page and doing a soap connection and processing the order with the session variables, and then destroying the session afterwards.

is it safe enough to store credit card information in this manner, can hackers get to this? cause its possible to view POST variables with a firefox plugin.

or is it safer to write it to a temporary database table, do what i need to do and then delete the row?

View Replies !
Warning: Session_start() [function.session-start]: Cannot Send Session Cookie - Problems With The Session Variables.
I am have a form on the page registration.html the content is posted to a page called registration.php Although the database is getting populated, i am having problems with the session variables. I get the following errors:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /usr/shared/web/intocore/registration.php:10) in /usr/shared/web/intocore/registration.php on line 41 Code:

View Replies !
Session Problem: Session Exists, But Session Variables Don't Lasts
I have some troubles with session variables. I can easily create a session,
but the variable I append to global session array ( $_SESSION) lasts only
until the end of current function.

I prepared an example that can demonstrate the problem (see code bellow):
The program flow is this:
(1) It starts with "session_start()" and displays "login_form()".
(2) When user enters his username and password, it goes to "login()"
function which sets $_SESSION variables.
(3) This function also "Echoes" session_id and user name to the screen.
(4) Then it goes to "MyProgram()" function. It only "Echoes" the same
variables to the screen.

Strange is, that the session_id is the same in (3) and (4), but the user
name ($_SESSION["username"]) is only in (3), but not in (4). By other
words - $_SESSION["username"] variable filled up by "login()" function is
immediately cleared.

I don't know why.

There must be something missing, but after 3 days of watching it, I can not
find a problem here.

===========================================
<?
Function login($uzivatel, $heslo)
{
$_SESSION["username"] = $uzivatel;
$_SESSION["pass"] = $heslo;
$U_Name=$_SESSION['username'];
echo "Login username: $U_Name<BR>";
echo "Login session ID: ";
echo session_id();
echo "<BR>";
}

Function login_form()
{
echo ("<DIV ALIGN='center'>
<H1>Test</H1>
<P>Please enter your username and password:</P>
<form action='test.php' method='get'>
<INPUT TYPE='HIDDEN' NAME='login' VALUE=TRUE>
<TABLE BORDER=&#390;'>
<TR>
<TD ALIGN='right'><U>U</U>ser name:</TD>
<TD><INPUT NAME='uzivatel' SIZE=25 ACCESSKEY='U' TYPE='TEXT'></TD>
</TR>
<TR>
<TD align='right'><U>P</U>assword:</TD>
<TD><INPUT NAME='heslo' SIZE=25 ACCESSKEY='P' TYPE='PASSWORD'></TD>
</TR>
<TR>
<TD COLSPAN=2 ALIGN='RIGHT'><INPUT NAME='OK' ACCESSKEY='O' TYPE='SUBMIT'
VALUE='OK' TABINDEX=3></TD>
</TR>
</TABLE>
</FORM></DIV></HTML>");
}

Function MyProgram()
{
$U_Name=$_SESSION['username'];
echo "Program username: $U_Name<BR>";
echo "Program session ID: ";
echo session_id();
echo "<BR>";
}

{
session_start();
if ($_SESSION['username']):
MyProgram();
else:
{
if (!$login):
login_form(0);
else:
login($uzivatel, $heslo);
MyProgram();
endif;
}
endif;
}
?>
===========================================

View Replies !
Storing XML
I'm designing a website that will use XML to store all the content of my
web pages. I will use a PHP script to parse the XML. Should I store the
XML in a MySQL database or should I simply store the XML in *.xml files
on my server? Which would would yield better performance? And would
using one PHP script to parse all the pages be too much on one script
(I'll have about 600 pages)?

View Replies !
Storing Vs Not
printing $database[somevar] a couple times in your code or manipulting it, such as multiplying it by 2, or storing it under $myvar and using $myvar.

View Replies !
Storing Data
Say I have a number: number = 34043923, this represents a wordID, so the word belonging to this wordID is say: forum (whatever).

This can be stored in 4 bytes (so i am told ) BUT when I save it with fopen/fwrite it takes up 8 bytes (1 for every character) and the file can be read (when opening the file it just reads 34043923).

How can I store this data so it takes up only 4 bytes AND how can I do this storing it in a textfield of a mysql db?

View Replies !
Cookie Storing
I have this script so far:

<?
session_start();
if (!isset($_SESSION['track'])) {
$_SESSION['track'] = 0;
} else {
$_SESSION['track']++;
}
?>

Which sets a cookie. I can also check if the cookie exists when the user goes to another page.

How do you store information in the cookie? For example if I want to store a number like 1200, and then get that information from the cookie again when they go to another page?

View Replies !
Storing Classes
I have a script which calls up a class stored in a file FormatText.class . I don't want my .class files to be accessible if anyone types the URL of the class - I only want my class file accessible by a PHP script called by my server. I use

require_once "FormatText.class";o get the class. Where do people typically place the class files when designing software? Shoud I put it in the root folder?

I also have a text file I often call that contains sensitive database information. I placed that file in the main directory, (one up from the www directory). How safe is that file? Is that standard practice?

View Replies !
Storing Dates?
i am trying to design a script for sending mot reminders out 2 clients they sign up online then 10days before there mot expires the script sends a e-mail out reminding them what would be the best way to store the dates in my database?

View Replies !
Storing Array In A Row
I run a site with staff-submitted reviews, and most of them are written
by one author. However, we also do "multiple" reviews. Up until now I
just had a userid for a 'Multiple' account and submitted them under
that, but this makes it harder to print lists of all the reviews by one
person, so ideally I wanna make a multiple select form so we can just
select all the contributors and have the values saved in the database -
in one row (something like "56,34,21" etc).

I've coded a multiple select form with all the authors of articles for
my site on, and I want to store the results of this in one row so I can
grab them as an array later - how can I go about doing this? I just
googled and came across using <select name="author[]"> in my HTML, and
then using serialize() to process it, but it fails. When I run the
following code, the value for 'multiplearray' remains at 0 whether I
select single OR multiple values on the form:

<?php
$dbhost = ###
$dbuser = ###
$dbpass = ###
$dbname = ###

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
connecting to mysql');
mysql_select_db($dbname);

if(isset($_POST['save']))
{

$author = serialize($_POST['author']);

$query = "INSERT INTO review_test (multiplearray) VALUES
('$author')";
mysql_query($query) or die('Error ,query failed');
echo "Query successful!";
}

echo "<form name='test' method='post' action=''>";

$query2 = "SELECT Staff_id, displayname FROM users WHERE
userlevel !=0
ORDER BY username";
$result2 = mysql_query($query2) or die('Error : ' .
mysql_error());

echo "<select name='author[]' id='author[]' multiple='multiple'
size=&#3910;'>";
while($row2 = mysql_fetch_array($result2, MYSQL_NUM))
{
list($Staff_id, $displayname) = $row2;
echo "<option value='$Staff_id'>$displayname</option>";
}

echo "</select>";
echo "<br><br><input name='save' type='submit' id='save' value='Post
Review'>";
echo "</form>";

?>

View Replies !
Storing Dates In DB
What do you think is the best way to store Dates into a database ?
If you want to keep logs or buckups....

I am using date('dmYHis')
but I doesn't work really well ...
Is it better to use date(U) ?

View Replies !
Storing Sessions
Can anyone tell me what is the best way to store sessions into database in order to recognize that user next time he access the site?I thought about IP address but then I remembered that it is different every time.What thing regarding a user is always the same?

View Replies !
Storing Results For Later Use?
Is it possible to store results that are parsed from an xml file and then use them on a different web page? Basically I want to store the data within the nodes and then use that data on another web page. Kinda like adding pagination but instead of gettign the info from a db I am getting it from a xml file. Code:

View Replies !
Storing Sessions...
Does it matter how and where they're stored?

I was reading through this tutorial and I can across a discussion on where sessions are stored. I was under the impression that this wasn't something I had to worry about..

View Replies !
Storing An Array In A Db
I know your first reaction will be "WHY?!?!" But can it be done? Can I store
a php array in a postgresql database?

View Replies !
Storing SQL In A XML File
I'm trying to store a sql statement in a xml file like so:

<sql>"SELECT customers.customers_email_address, customers.customers_password,can_seller_profiles.seller_social_name,manufacturers.manufacturers_imag e FROM customers ,can_seller_profiles ,manufacturers WHERE customers.customers_id = '$acc_id' AND can_seller_profiles.seller_customers_id = '$acc_id' AND manufacturers.manufacturers_id = '$seller_man_id'"</sql>


but when I echo the the sql in php the vars aren't being populated. I'm trying to avoid hard coding the statements do theres something like 30 plus statements.

View Replies !
Storing The Value Of A Textbox
I have a form with a textbox and A submit button. I want the value of the textbox to be stored in a variable so as to pass through to other pages. I have reached this point:

page 1
<?php

session_start();

if (isset($_POST['txtusername']))
   $_SESSION['test'] = $_POST['txtusername'];
$_SESSION['test'] = 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

Im testing it both on localhost and web server. Unfortunately, the opening page is blank.

View Replies !
Mp3 / Pdf Storing Into Database
What's disadvantages of storing mp3/pdf/doc files into database instead of uploading to a folder . If you store into database its very easy to restrict user to download the files.

View Replies !
Storing Passwords
How do you guys go about filtering passwords before storing name. I have my username filter set to only allow numbers and letters but not how to implement a filter for passwords as people may prefer using characters, for better protection, which may inadvertently lead to cross scripting vulnerabilities.

View Replies !
Storing Arrays
Im trying to figure out a good way to store an array in mysql, and be able to retrieve the entire array, back into an array.

Im building a form that allows authors to submit "Tags" for their books, so people can search on these "Tags" and it will search the Authors table in mysql for matching tags, so that readers can simply enter a tag, and find books that match the tags.

For example:

Thru a form, an author might type

php,mysql,development - Those would then by submitted by a form, So what function could i use to put those into an array?

Then how would i store the array in mysql and be able to retrieve it back into an array, for example

/author.php?author=mike

If mike's tags were php,mysql,development id like to list that on the php page next to his book.

So what im trying to do is, 1. Get comma seperated values and put them into an array. 2. Store the array in mysql, and be able to retrieve it back into an array(i know database functions, just not sure what datatype i should use for the column to store these in).

View Replies !
Storing Settings In A DB
I have a table containing two fields, `name` and `value`. Is it possible to loop through all rows in the table, and assign a variable of with the name stored in `name` and value `value`? It's the storing variables when you don't know the name of the variable you're creating that's a problem.

View Replies !
Storing XML In MySQL
What I am trying to accopmlish is to somehow store XML data into MySQL (using PHP I'm guessing). Can anyone point me in the right direction to get started?

View Replies !
Storing URL Value Into A Variable.
Is there any way to store url into a variable and then use the variable to send the user back to the same page from where he came.

View Replies !
Storing Translations
-translations for different languages are stored in .ini files.
-the choosen language is stored in a $_session['lang'] variable.
-for every file accessed i load the .ini file representing the $_session['lang'] and store it in the _strings() array.and use those strings for substitution.

The Question: is it better if i store the translated text once in a similar $_session variable for use during the whole session.or better to create a new instance of the i18n class and reload the .ini translation file for every new page the user access?

View Replies !
Storing App Settings
storing settings in php files like this:

File : settings.php
<?php
$settings['cacheDir']='cache_directory'
$settings['templateDir']='template directory'
?>

File: index.php
require_once("settings.php");

is is secure enough or should i store those settings in constants instead? i mean is there any chance that the user can override those settings when accessing the index.php page from the web?

View Replies !
Storing _FILES
how do you store all the information inside _FILES[] when you do a post. How long does a file stay in the temp dir before you have to move it or it gets deleted. I need to know this because I want one php file to have the upload GUI and another to actually store the file on the server but I do not know how to pass the file information between the two.

View Replies !
Storing On The Fly Images
I have a script that lets users pick an image and add text to it using this php script: Code:

View Replies !
Storing An Image
<?php
header('Content-type: image/jpeg');
$filename="downloads/Image/large/21-47-110-1.jpg";
$img_temp = imagecreatefromjpeg($filename);
$img_thumb=imagecreatetruecolor(132,99);
imagecopyresampled($img_thumb,$img_temp,0,0,0,0,132,99,imagesx($img_temp),imagesy($img_temp));
imagejpeg($img_thumb, "", 60);

//this is the bit I am not sure about.
$handle = fopen("downloads/Image/large/test.jpg", "a");
fwrite($handle, $img_thumb);
fclose($handle);
imagedestroy($img_thumb);
?>

View Replies !
Storing Same Values
I'm working with my MySQL database and had a question. How would you store two of the same values within the same column? I have three: loginName, id (auto_increment), and Image. How would I make it so that loginName can store the same values multiple times? Does it have anything to do with primary, unique, and index keys? Becuase I'm in phpMyadmin right now and I'm tempted to start pressing buttons to find out what they do.

View Replies !
Storing MySQL
I need to store results from a MySQL call to a multidimensional array. My code is as follows: Code:

$db = mysql_connect("localhost", "admin", "password");
mysql_select_db("myDatabase",$db);
$query = "SELECT * FROM content WHERE filetype LIKE 'URL'";
$result = mysql_query($query);

for($i=0;$row = mysql_fetch_array($result);$i++){
$multiResults[$i] = array(mysql_fetch_row($row));
}

View Replies !
Storing Data For Use
I want to store an array on the server for use across multiple pages. I know and have been using sessions, but it just kills me to know that if the user turns cookies off, this is all gonna stop working unless I want that big session id in all urls. Also, the info in this array is by no means specific to each user, its the same for all of them. Is there any alternatives to this? Some way of storing an array which would be accessible by multiple pages.

View Replies !
Storing Object Into Array - OOP
Can I store objects into an array?

$anArray[$index] = $anObject;
$anArray[$index]->aMethod();

I have problems executing the above code. Does anyone knows a better/correct way of doing it? How do I invoke a method belonging to that object?

View Replies !
File For Storing Strings?
Can I store multiple strings in a file and read/write to it as opposed to using a SQL Database? Can anyone offer an example?

View Replies !
Storing Image Into BLOB
I am having one problem which is that:

- I can upload and store image into BLOB field normally on one machine-winXP where installed Apache 2 and php 4.x

- exactly same php code not functioning on the another machine-winXP where running Apache 1.3 and php 4.x

What is problem, can I have help from some one?

When I check the data stored in BLOB field (by means of saving into Desktop using MySQL Control Center) it were always stored 77 bytes of image/jpeg data, and 66 bytes of image/bmp files!

View Replies !

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