|
#1
Apr 11, 2011, 03:03 AM
|
|
[SOLVED] global variables
Hi to all,
maybe someone can help my with this one. On my local wamp server I have global variables activated and I can use sessions for one plugin I modified. The plugin in question is restrict-categories and based from which category (when a category is displayed I added a link to post-new.php) the user wants to post a new post it should give him the option to only check one category the post will be added to (basically all other categories are hidden except the one that the post will belong to).
In atahualpa center-column I added this:
session_start();
$eu_scattitle = single_cat_title("", false);
$eu_scatid = get_cat_ID($eu_scattitle);
$eu_curr_cat = get_category($eu_scatid);
$eu_slug=$eu_curr_cat->category_nicename;
$_SESSION['eu_slug'] = $eu_slug; //this is what I need to be stored and later use in restrict-categories
Now, because globals are disabled, the session variable is lost when the execution enters into another .php file.
Is there a way to declare the variable I need inside the center-column (or in one .php file that belongs to atahualpa) and later to be available in the restrict-categories function?... like global $wpdb; or something?
Thank you.
|
#2
Apr 11, 2011, 03:52 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Try adding
HTML Code:
Global $eu_slug;
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#3
Apr 11, 2011, 02:25 PM
|
|
It's not working,
as soon as another .php file starts execution, the variable is lost.... don't know what to do.... this happens on the site I have hosted by a company.... on my local computer, session variables work but....
|
#4
Apr 12, 2011, 06:47 AM
|
|
No, I can't access php.ini
I just can't figure out why the variable is lost
|
#5
Apr 12, 2011, 07:46 AM
|
|
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
Contact your host and get them to turn them on. If they won't help you, I'd move hosts.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#6
Apr 12, 2011, 10:16 AM
|
|
Yes I think that is what I'll do, thank you. However, I understood that turning global variables on is quite risky, even if the entire platform only uses 1 session variable, will I have any hacker problems?
Thanks
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
FR: Add variables to the paths to images, headers, logo, favicon, etc.
|
interfasys |
Atahualpa 3 Wordpress theme |
0 |
Jan 22, 2011 11:58 AM |
[SOLVED] Notices on undefined indexes, variables and deprecated functions
|
Knut Sparhell |
New Versions, & Updating |
1 |
Jan 3, 2011 08:07 AM |
Can't get a second row to enter HTML variables
|
Thomas |
Sidebars & Widgets |
18 |
May 16, 2010 09:59 AM |
Accessing PHP variables after header sent out
|
twola |
Sidebars & Widgets |
1 |
Oct 2, 2009 11:24 AM |
|