Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2005, 12:35 AM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Horoscope: Why won't it work?

I'm trying to port over the horoscope hack (for my own personal use, not releasing it as I don't have permission), and everything is fine except I can't figure out why it's not reading from the database correctly.

I've got the cron working correctly and the data is sitting there in the database, but zodiac.php just isn't reading it correctly. Here's zodiac.php:

PHP Code:
<?php
/*******************************************\
*    Zodiac v1.0.3            [zodiac.php]    *
*********************************************
*    Created by Steve    For use with VB3    *
*********************************************
*  Zodiac and Horoscope Addon for VBulletin    *
\*******************************************/

/* Define Stuff */
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''zodiac');
$phrasegroups = array();
$specialtemplates = array();
$actiontemplates = array();
$globaltemplates = array('zodiac_main');
require_once(
'./global.php');
require_once(
'./includes/functions_user.php');
$hackname="Zodiac Horoscope";
$horoscopetype="Weekly Horoscope";

/* Set Navigation */
if (isset($_GET['do'])) {
    
$do $_GET['do'];
}

/* Stuff */
if ($do=="aries") {
    
// Aries
    
$title="Aries";
    
$horoscope=$vbulletin->db->query("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="taurus") {
    
// Taurus
    
$title="Taurus";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="gemini") {
    
// Gemini
    
$title="Gemini";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="cancer") {
    
// Cancer
    
$title="Cancer";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="leo") {
    
// Leo
    
$title="Leo";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="virgo") {
    
// Virgo
    
$title="Virgo";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="libra") {
    
// Libra
    
$title="Libra";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="scorpio") {
    
// Scorpio
    
$title="Scorpio";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="sagittarius") {
    
// Sagittarius
    
$title="Sagittarius";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="capricorn") {
    
// Capricorn
    
$title="Capricorn";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="aquarius") {
    
// Aquarius
    
$title="Aquarius";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} elseif (
$do=="pisces") {
    
// Pisces
    
$title="Pisces";
    
$horoscope=$vbulletin->db->query_read("SELECT weekly FROM " TABLE_PREFIX "zodiac WHERE sign='".$do."'");
} else {
    
// None
    
$title="Zodiac Horoscope";
    
$horoscope[weekly]="To view a weekly horoscope please select a zodiac from the following list:<br><li><a href=\"?do=aries\">Aries</a></li> <li><a href=\"?do=taurus\">Taurus</a></li> <li><a href=\"?do=gemini\">Gemini</a></li> <li><a href=\"?do=cancer\">Cancer</a></li> <li><a href=\"?do=leo\">Leo</a></li> <li><a href=\"?do=virgo\">Virgo</a></li> <li><a href=\"?do=libra\">Libra</a></li> <li><a href=\"?do=scorpio\">Scorpio</a></li> <li><a href=\"?do=sagittarius\">Sagittarius</a></li> <li><a href=\"?do=capricorn\">Capricorn</a></li> <li><a href=\"?do=aquarius\">Aquarius</a></li> <li><a href=\"?do=pisces\">Pisces</a></li><br>Thanks.";
}

// Please Do Not alter, remove or make invisible the footer as it is part of the free horoscope feed arrangement
$hackfooter="Powered by: <a href=\"http://hop.clickbank.net/?juseste/branch90\" target=\"_blank\">Astrology Source</a>";

/* Display */
$horoscope=("$horoscope[weekly]");
if (
$horoscope=="") { $horoscope="There appears to be a problem with the Database.<br>The $do weekly horoscope can't be retrieved at this time.<br>Please check back later.<br><b>Thankyou</b>."; }
eval(
'print_output("' fetch_template('zodiac_main') . '");');

?>
Thanks for your help
Reply With Quote
  #2  
Old 09-27-2005, 12:50 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ugh, what a horrible set of if's

What do you mean by "but zodiac.php just isn't reading it correctly" - what result do you get exactly ?
Reply With Quote
  #3  
Old 09-27-2005, 01:01 AM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry for being vague LOL, PHP isn't my strong point

The page is supposed to display a list of Zodiac signs, which it does. When I click on one of them, say "Capricorn" (zodiac.php?do=capricorn) it gives me:
"There appears to be a problem with the database. The capricorn weekly horoscope can't be retrieved at this time. Please check back later."

The data is in the table though, I'm looking at it right now. (screenshot attached)

Here's a link to the original zodiac hack.

If it matters, this is the install code I'm using for the vBulletin product:
PHP Code:
$db->query_write"CREATE TABLE `".TABLE_PREFIX."zodiac` (
        `sign` VARCHAR(12) NOT NULL,
        `weekly` LONGTEXT NOT NULL
        ) TYPE=MyISAM;"
);

$db->query_write("INSERT INTO `".TABLE_PREFIX."zodiac` (`sign`, `weekly`) VALUES ('aries', ''), ('taurus', ''), ('gemini', ''), ('cancer', ''), ('leo', ''), ('virgo', ''), ('libra', ''), ('scorpio', ''), ('sagittarius', ''), ('capricorn', ''), ('aquarius', ''), ('pisces', '');"); 
Again, thanks for your help.
Attached Images
File Type: png mysql.png (25.5 KB, 0 views)
Reply With Quote
  #4  
Old 09-27-2005, 01:18 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

above the line /* Stuff */ add a temp line that says ;

Code:
echo "DO = ".$do; exit;
then run it and report the result.
Reply With Quote
  #5  
Old 09-27-2005, 01:22 AM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It just says "DO = "
Reply With Quote
  #6  
Old 09-27-2005, 01:34 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thought it might;

try this test ;

Code:
echo "DO = ".$vbulletin->GPC['do']; exit;
Reply With Quote
  #7  
Old 09-27-2005, 01:37 AM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Same exact thing, LOL
"DO = "
Reply With Quote
  #8  
Old 09-27-2005, 01:41 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, i'm sure 3.5 does some processing with the POST & GET variables now as part of loading global.php, but I can't remember exactly what, and I don't have the code in front of me.

You can probably fudge it by moving

PHP Code:
/* Set Navigation */ 
if (isset($_GET['do'])) { 
    
$do $_GET['do']; 

above the

PHP Code:
require_once('./global.php'); 
require_once(
'./includes/functions_user.php'); 
Reply With Quote
  #9  
Old 09-27-2005, 01:52 AM
Brent H's Avatar
Brent H Brent H is offline
 
Join Date: Sep 2004
Location: Phoenix, AZ
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Moving the code like you suggested results in a blank page, so that method won't work I guess

Thank you so much for your help so far though, Paul. It's very much appreciated.
Reply With Quote
  #10  
Old 09-27-2005, 02:05 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheHeggy
Moving the code like you suggested results in a blank page, so that method won't work I guess
I don't see how it could do that, you did remove the temp echo & exit ?

Anyway, from memory, in the original code posted above, try changing

PHP Code:
if (isset($_GET['do'])) { 
    
$do $_GET['do']; 

to

PHP Code:
if (isset($_REQUEST['do'])) { 
    
$do $_REQUEST['do']; 

Also, I notice that in your conversion from the original, you have changed all the query_first to query_read - (except one where you just have query) - you don't need to do this and should probably change them back as you only need the first result.
Reply With Quote
Reply


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 03:44 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.06806 seconds
  • Memory Usage 2,330KB
  • Queries Executed 12 (?)
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
  • (2)bbcode_code
  • (6)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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_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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete