problems with require / include..
i have 2 folders, folder forum and exam. inside folder forum , i have folder admin, and data and in folder admin.
folder forum
- folder admin
-file config.php
-file admin.php
- folder data
-file global.php
-file member.php
folder exam
-folder abc
-file 1.php
in my 1.php, i include global.php.
<?php
require (\"../forum/global.php\");
?>
so when i run my 1.php, i got this error:
Fatal error: Cannot redeclare stripslashesarray() in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum/global.php on line 11
i didn't include or require global.php before...why there is error saying i redeclare that function??
Mark Hensler posted this at 17:53 — 12th December 2001.
He has: 4,048 posts
Joined: Aug 2000
Your declaring that function somewhere. Check all your included files to make sure that none of them have any function definitions for it.
You may also want to think about using require_once()
Mark Hensler
If there is no answer on Google, then there is no question.
joyce posted this at 02:04 — 13th December 2001.
They have: 164 posts
Joined: Nov 2001
why do i need all this for?? well, pls go to this page...then u will understand what am i trying to do..
http://www.certifyexpress.com/exam/bea/1.php
if i'm login and i choose one of the exam and click:'take the quiz', then i will be brought to those questions....but if i'm not login..i will prompt something (like vbuletin) to let me login..
my problem is...i got that login page prompt..but with errors..and when i login, it goes to page not found....
Mark Hensler posted this at 05:32 — 13th December 2001.
He has: 4,048 posts
Joined: Aug 2000
require_once() does simply that. It will include the file one time, and any additional calls to include that file will be ignored.
This is great for lib files that contain function definitions, so you don't get errors saying that you cannot redeclare a function.
I think your path to global.php is incorrect (from the little diagram you showed me). Try this:
require ("../../forum/global.php");
IMHO, require ("../forum/global.php") is undesired. I prefer to alter my include_path in my .htaccess.
Then I can just say require ("global.php"), and it will always work no matter where I call it from.
You would add a line like this to your .htaccess file:
php_value include_path .:/usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/forum
Mark Hensler
If there is no answer on Google, then there is no question.
joyce posted this at 06:12 — 13th December 2001.
They have: 164 posts
Joined: Nov 2001
i wish to use the vBulletin login to verify my identity in the exam script..
http://www.certifyexpress.com/exam/bea/1.php
the problem i'm facing now is, after i've login, the page won't redirect back to the page where i can choose exam...instead..i was brought to another page. how am i suppose to solve that??
i belief that vbulletin use these few lines to redirect pages after login.
<?php
if ($url!=\"\" and $url!=\"index.php\" and $url!=$HTTP_REFERER) {
if (strpos($url,\"?\")>0) {
$url.=\"&s=$session[dbsessionhash]\";
} else {
$url.=\"?s=$session[dbsessionhash]\";
}
//header(\"Location: $url\");
$url = str_replace(\"\\"\", \"\", $url);
eval(\"standardredirect(\\"\".gettemplate(\"redirect_login\").\"\\",\\"$url\\");\");
} else {
$bbuserinfo=getuserinfo($userid);
eval(\"standardredirect(\\"\".gettemplate(\"redirect_login\").\"\\",\\"$HTTP_REFERER\\");\");
}
?>
for my part, what i need to add in order to make it redirect to the exam page after login??
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.