Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old February 6th, 2004, 02:59 PM
taniambutler taniambutler is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 taniambutler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Using Sessions in Oracle

I am using php 4.1 that is run on redhat 9. I am using Oracle 9i.

Here is the question. I am trying to maintain a user session in an oracle database. I am experiencing some problems with storing the session ID in the database. For one reason or another The session ID will not bind properly.

php Code:
Original - php Code
  1.  
  2. function UserLogon($db, $username)
  3. {
  4.  $errorMsg = "";
  5.     $stmt = @OCIParse($db,"insert into SAPNET_WEBSITE.SAPNET_SESSIONS (WEB_SESSIONS_ID, USERNAME, IP_ADDRESS) values (:session, :userName, :ipaddr)");
  6.     //$stmt = @OCIParse($db,"insert into SAPNET_WEBSITE.SAPNET_SESSIONS (IP_ADDRESS, USERNAME) values (:ipaddr, :userName)");
  7.     if (!$stmt)
  8.         $errorMsg = GetDBError($db);
  9.     else
  10.     {
  11.         session_start();
  12.         $sessionID = session_id();
  13.         $ID=$sessionID;
  14.         $ipAddress = GetRemoteIP();
  15.         OCIBindByName($stmt,":userName", $username);
  16.         OCIBindByName($stmt,":session", $ID);
  17.         OCIBindByName($stmt,":ipaddr", $ipAddress);
  18.         if (!@OCIExecute($stmt))
  19.             $errorMsg = GetDBError($stmt);
  20.         OCIFreeStatement($stmt);
  21.     }
  22.     return  $errorMsg;
  23. }
  24.  
  25.  


Is there are specific way to set up the table that I don't know about. Ummm... The table info is

SAPNET_SESSIONS table
WEB_SESSIONS_ID char(32)
IP_ADDRESS varchar(24)
USERNAME varchar(20)

Any Info would be great.
Thanks

Reply With Quote
  #2  
Old February 7th, 2004, 05:04 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Using Sessions in Oracle

look at the function session_set_save_handler().

that is the proper way of storing session data in databases. there is also an example for mysql i think but it should be easy to port it to oracle (if you know oracle that is ;))

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Using Sessions in Oracle


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway