[FX.php List] Adding Sessions

Laura Long laural at ultimate-products.com
Fri Apr 21 12:01:07 MDT 2006


SESSIONS - I am fairly new to php, but I do have sessions set up and
working on my database/web system - maybe you will find this helpful -
:)

<?php
session_start( );  /*This must be at the top of your page*/


include_once('FX/FX.php');
include_once('FX/server_data.php');

$username=$_REQUEST['username'];  /*The user submits information via a
form and a new record is created in Filemaker*/
$password=$_REQUEST['password'];
$code=$_REQUEST['code'];
$login=new FX($serverIP,$webCompanionPort,'FMPro7');
$login->SetDBData('DATABASE.fp7','LAYOUT');
$login->SetDBPassword('password','PASSWORD');
$login->AddDBParam('code',$code);
$login->AddDBParam('username',$username);
$login->AddDBParam('password',$password);
$loginResult=$login->FMNew();

header("Location: authorize.php"); /*This includes the next page making
all sessions available*/

 foreach($loginResult['data'] as $key=>$loginData) 

 $_SESSION['idCompany']=$loginData['idCompany'][0];  
 $_SESSION['nameCompany']=$loginData['nameCompany'][0];  
 $_SESSION['status']=$loginData['status'][0];  /*Sessions are set to
fields in the database*/

?> 

<?php */This code is placed on the top line of the page AUTHORIZE.PHP
(and all other pages that will access the sessions), making sessions
available to use*/
 // start the session
 session_start();
 header("Cache-control: private"); //IE 6 Fix
?>


Laura Long
Database/Web Designer
Workplace Options, Inc.
(919) 834-6506
http://www.workplaceoptions.com



-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Jonathan
Schwartz
Sent: Friday, April 21, 2006 1:33 PM
To: FX.php Discussion List
Subject: [FX.php List] Adding Sessions


Thanks for all your help, folks.

Now, on to Sessions, to help protect my solution.

This one is particularly sticky because the sessions code spans the 
entire solution, int addition to the handful of session-specific 
files.

I've tried transplanting example code from a couple of different 
sources, without success yet. Source from 'DogWalk' was one.  Don't 
remember source.

Is there a favored set of sessions code that I could/should use, that 
folks know and like?

That way, it will also be easier to ask questions to the list.

Thanks


Jonathan
-- 

Jonathan Schwartz
Schwartz & Company
817 Marin Drive
Mill Valley, CA 94941
Phone: 415-381-1852
jonathan at eschwartz.com - http://www.eschwartz.com

_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list