Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 11-02-2008, 11:10 PM
qbn720's Avatar
qbn720 qbn720 is offline
 
Join Date: Mar 2007
Location: New York
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Using Global.php on a dynamic Non-VB Page

Currently, I'm using this modification (Simple vB User Login). 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.
PHP Code:
    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.....
         

Reply With Quote
  #2  
Old 11-02-2008, 11:51 PM
Guest190829
Guest
 
Posts: n/a
Default

You should be quoting each case, since it is a string you are evaluating:

PHP Code:
switch($_GET['p'])
{
     case 
"faq":
          
// whatever
          
break;
     case 
"contact":
          
//etc....

Reply With Quote
  #3  
Old 11-03-2008, 02:57 AM
qbn720's Avatar
qbn720 qbn720 is offline
 
Join Date: Mar 2007
Location: New York
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<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>
Reply With Quote
  #4  
Old 11-03-2008, 03:11 AM
Guest190829
Guest
 
Posts: n/a
Default

Can you post the entire file?
Reply With Quote
  #5  
Old 11-03-2008, 04:07 AM
qbn720's Avatar
qbn720 qbn720 is offline
 
Join Date: Mar 2007
Location: New York
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 Code:
<?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 Code:
<?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 [DATE]1225757446[/DATE] at [TIME]1225757446[/TIME] ---------------

I know it's a great deal to deal with but if any hints or assistance can be made, I would greatly appreciate it.
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:23 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05144 seconds
  • Memory Usage 2,238KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (3)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete