View Full Version : Using Global.php on a dynamic Non-VB Page
qbn720
11-02-2008, 11:10 PM
Currently, I'm using this modification (Simple vB User Login (https://vborg.vbsupport.ru/showthread.php?t=173693)). It works well and does great to login and logout. In fact the script works absolutely fine.
However, on my main website, I am experiencing a unique problem whereby each time I click on a dynamic link (index.php?p=whatever_page), it immediately goes to (index.php?p=faq) which is listed first in a long list of id's. I checked the code in the file where I have listed all of my id's and it seems to work correctly (and it also works correctly when I comment out the global.php file).
I was able to isolate the conflicting problem, whenever I utilize and declare my global.php at the top site, it seems to cause this minute error. I was wondering if someone could enlighten me about what is exactly conflicting. I can post full-length codes of both files, if needed. But I'm struggling with this.
Here is a snippet of my get_id file. switch($_GET['p'])
{
case faq: include ('faq.php'); break;
case staff: include ('staff.php'); break;
case affiliation: include('affiliation.php'); break;
case linktous: include('linktous.php'); break;
// Goes On For Several Lines.....
}
Guest190829
11-02-2008, 11:51 PM
You should be quoting each case, since it is a string you are evaluating:
switch($_GET['p'])
{
case "faq":
// whatever
break;
case "contact":
//etc....
}
qbn720
11-03-2008, 02:57 AM
<font face="Tahoma">I changed it, to match the example you provided. However, I am having the same problem as before, it just happens to skip right to the first available case I define. Also, if I comment out the inclusion of global.php, then and only then does the switch statement work.
I'm not sure what causes this problem, but I know that the conflict occurs the moment these two are running simultaneously. Maybe if you guys could point me as to why this is occurring.</font>
Guest190829
11-03-2008, 03:11 AM
Can you post the entire file?
qbn720
11-03-2008, 04:07 AM
Here is my main index.php file. The beginning part of the page is where I declare the global.php. Once I declare it, any time I click on any of my links on the site, it automatically redirects to my first defined case, in this case, faq.php.
<?php
$curdir = getcwd ();
chdir('/home1/otakunow/public_html/forums');
require_once('/home1/otakunow/public_html/forums/global.php');
chdir ($curdir);
if (isset($_GET['p'])) {
$_GET['p'] = str_replace('-', '_', $_GET['p']);
}
?>
<html>
<head>
<meta name="copyright" content="November 2008">
<LINK REL=StyleSheet HREF="css/style.css" TYPE="text/css" MEDIA="Screen" />
</head>
<body>
<div align="center">
<div style="width: 800px; background-color: black;">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="800" valign="top"><?php include('partials/banner.php'); ?>
<br />
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="210" height="259" valign="top">
<!-- Begin Navbar -->
<table width="190" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="190" height="24" valign="top" style="background: url('images/layout/naruto/navbar/navbar-header.jpg') repeat-y top left;"><span class="section_head_white">Otaku</span> <span class="section_head_orange">Navigation</span> </td>
</tr>
<tr>
<td valign="top" style="background: url('layout/naruto/navbar/navbar-cell.jpg') repeat-y top left;"><?PHP include("partials/navigation.php");
?></td>
</tr>
<tr>
<td valign="top"><img src="images/layout/naruto/navbar/navbar-footer.jpg" /></td>
</tr>
</table>
<!-- END Navbar --><br />
<!-- Begin Affiliates -->
<table width="190" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="190" height="24" valign="top" style="background: url('images/layout/naruto/navbar/navbar-header.jpg') repeat-y top left;"><span class="section_head_white">Otaku</span> <span class="section_head_orange">Affiliates</span> </td>
</tr>
<tr>
<td valign="top" style="background: url('images/layout/naruto/navbar/navbar-cell.jpg') repeat-y top left;" ><?php include("partials/affiliates.php"); ?></td>
</tr>
<tr>
<td valign="top" style="background: url('images/layout/naruto/navbar/navbar-cell.jpg') repeat-y top left;" ><?PHP require_once("partials/sitetools.php"); ?></td>
</tr>
<tr>
<td valign="top"><img src="images/layout/naruto/navbar/navbar-footer.jpg" /></td>
</tr>
</table>
<br />
<!-- END Affiliates -->
</td>
<td width="590" valign="top">
<!-- Begin Latest Updates -->
<table width="559" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="559" background="images/layout/naruto/content/content-header.jpg"><span class="section_head_white">Latest</span> <span class="section_head_orange">Updates</span> </td>
</tr>
<tr>
<td background="images/layout/naruto/content/content-cell.jpg"><?php include("partials/latestupdates.php");?></td>
</tr>
<tr>
<td><img src="images/layout/naruto/content/content-footer.jpg" /></td>
</tr>
</table>
<!-- End Latest Updates -->
<br />
<!-- Begin Content -->
<table width="559" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="559" background="images/layout/naruto/content/content-header.jpg">
<span class="section_head_white">Otaku</span> <span class="section_head_orange">Content</span>
</td>
</tr>
<tr>
<td background="images/layout/naruto/content/content-cell.jpg" width="558px">
<div class="margin">
// Acquire IDs for Dynamic Switching.
<?php include("partials/get_id.php"); ?>
</div>
</td>
</tr>
<tr>
<td><img src="images/layout/naruto/content/content-footer.jpg" /></td>
</tr>
</table>
<!-- End Content -->
<!-- Begin Footer -->
<tr>
<td height="81" colspan="2" valign="top"><div align="center"><?PHP include('partials/footer.php');?></div></td>
</tr>
</table></td>
</tr>
</table>
</div>
</div>
<!-- End Footer -->
</body>
</html>
This here is the "get_id.php" file. I use this file as a partial that is included via PHP my index.php page. I have no problems with this page when I comment out global.php, however, global.php is essentially needed so that the login-box above mentioned works correctly.
<?php
switch($_GET['p'])
{
case "faq": include ('faq.php'); break;
case "staff": include ('staff.php'); break;
case "affiliation": include('affiliation.php'); break;
case "linktous": include('linktous.php'); break;
case "mailer": include('contact/mailer.php'); break;
case "featured": include ('featured.php'); break;
case "forbidden": include('forbidden.php'); break;
case "popdod": include ('popdod.php'); break;
case "staff": include('staff.php'); break;
case "login": include('login.php'); break;
case "logout": include ('logout.php'); break;
case "qotm": include('interactive/quizzes/quiz.php'); break;
case "newsarchive": include('news/show_archives.php'); break;
case "comment_submit": include('comments/comments_process.php'); break;
}
?>
Thank you very much for coming to my aid. If you need me to, I can also post the login-box inclusion code though, from my analysis I don't think it is a problem. But if you need me to, I will provide it.
--------------- Added 1225757446 at 1225757446 ---------------
I know it's a great deal to deal with but if any hints or assistance can be made, I would greatly appreciate it.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.