Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Demo
Help
Search
Store
Gallery
Contact
Login
Register
Free Arcade Script
»
Forum
»
General
»
General Discussion
»
session variables
Recent
« previous
next »
Print
Pages: [
1
]
Author
Topic: session variables (Read 7322 times)
Dillon
Developer
Sr. Member
Posts: 340
Force: +3/-0
session variables
«
on:
December 03, 2011, 07:53:51 PM »
anyone know how to set a normal variable equal to a session variable i cant seem to get it to work
«
Last Edit: December 03, 2011, 07:56:52 PM by spagetiokillers
»
Logged
Arcade Freak
Adam LaCombe
Sr. Member
Posts: 433
Force: +17/-0
Re: session variables
«
Reply #1 on:
December 03, 2011, 08:00:02 PM »
You mean like..
$userid = $_SESSION['id'];
?
That should work. Just gotta make sure that the $_SESSION['id'] as been set to hold some sort of value first.
Logged
Please visit my blog
Dillon
Developer
Sr. Member
Posts: 340
Force: +3/-0
Re: session variables
«
Reply #2 on:
December 03, 2011, 08:01:34 PM »
thats exactly what i mean but yet for some reason no matter what i do it wont work.
Logged
Arcade Freak
Dillon
Developer
Sr. Member
Posts: 340
Force: +3/-0
Re: session variables
«
Reply #3 on:
December 03, 2011, 08:06:01 PM »
lets say i set it in index.php for FAS and then tried using it in another file it doesnt want to work but if i set it in that file then it will and i dont want to have to set it for every file or do i have to?
Logged
Arcade Freak
Adam LaCombe
Sr. Member
Posts: 433
Force: +17/-0
Re: session variables
«
Reply #4 on:
December 03, 2011, 08:54:12 PM »
I'll give you some examples..
file - starter.php ->
session_start(); ->
$var = $_SESSION['blah'] ->
file - test.php ->
echo - $var
^^ thats not going to work.
file - starter.php ->
session_start() ->
$var = $_SESSION['blah'] ->
file - test.php ->
include('starter.php');
echo - $var
^^ that will work.
So set the var..
Then if you're using the index.php file add another case inside your switch().
Access the file where you try to echo the session var out by using index.php?action=case_name
Logged
Please visit my blog
kurt
Developer
Hero Member
Posts: 634
Force: +16/-1
Re: session variables
«
Reply #5 on:
December 07, 2011, 06:49:19 PM »
You may also be running into the problem that it needs to be set as a global variable in any function, and again in any function declared inside that function, or passed to that function. If not, the script don't see it.
Logged
Newest book -
Final Piece of thePuzzle
Hosting starting at $3.75 a month
Get your own dropship business
Dillon
Developer
Sr. Member
Posts: 340
Force: +3/-0
Re: session variables
«
Reply #6 on:
December 07, 2011, 09:11:18 PM »
LOL kurt i figured that out yesterday. I was like ..........
Logged
Arcade Freak
kurt
Developer
Hero Member
Posts: 634
Force: +16/-1
Re: session variables
«
Reply #7 on:
December 09, 2011, 07:02:52 PM »
If you figured it out already, then you're quicker than me. I still forget lol.
Hey, I keep saying that we don't claim to be professional grade around here, just trying our best. ROTFL
Logged
Newest book -
Final Piece of thePuzzle
Hosting starting at $3.75 a month
Get your own dropship business
Print
Pages: [
1
]
« previous
next »
Free Arcade Script
»
Forum
»
General
»
General Discussion
»
session variables