vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   Ask the 8ball (https://vborg.vbsupport.ru/showthread.php?t=38060)

dymo 04-29-2002 10:00 PM

Ask the 8ball
 
this is another one of those scriptlets i had collected that i modified to provide a bit of fun for my users but its giving me a bit of a problem, its completely functional, just the response to the question is being parsed to the top of the page rather than under the question

add a template called 8ball
and insert the following
PHP Code:

<html>

<
head>
<
SCRIPT LANGUAGE="JavaScript">

<!-- 
Begin
function checkrequired(which) {
var 
pass=true;
if (
document.images) {
for (
i=0;i<which.length;i++) {
var 
tempobj=which.elements[i];
if (
tempobj.name.substring(0,8)=="required") {
if (((
tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!
pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Error you did not post any "+shortFieldName+" , try again.");
return 
false;
}
else
return 
true;
}
//  End -->
</script>
<
title>$bbtitle Ask the 8Ball?</title>

$headinclude

</head>

<
body>

$header

<table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextraalign="center">

<
tr>

        <
td width="100%"><img src="{imagesfolder}/vb_bullet.gif" alt="" border="0" align="absmiddle">

        <
normalfont><b><a href="index.php?s=$session[sessionhash]">$bbtitle</a> &gt;

       
Ask the 8Ball?</b></normalfont></td>

</
tr>

</
table>

<
br>



<
table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" {tableouterextrawidth="70%" align="center"><tr><td>



<
table cellpadding="10" cellspacing="0" border="0" width="100%"><tr>
      <
td
        <
table width="100%" border="0" cellspacing="0" cellpadding="0">
          <
tr
            <
td>
<
font size="2" face="MS Sans Serif">
<
br><br>
  <
b>Ask the magic 8ball a question!</b>
  <
br>
  <
form onSubmit="return checkrequired(this)" method=post action='8ball.php'>
  <
input type=text size=31 name="requiredquestion" value='Your Question'>
  <
br>
  <
input type=submit value='Ask the Magic 8Ball?'></form><br>
</
td>
       
          </
tr>
        </
table>
        <
table cellpadding="4" cellspacing="1" border="0" bgcolor="{tablebordercolor}" width="100%"
        <
tr>

    <
td colspan="5" bgcolor="{tableheadbgcolor}"><normalfont color="{tableheadtextcolor}"><center><b></b></center></normalfont></td>

  </
tr>



  <
tr>
<
div align="center">

 </
div>
$footer
</body

copy the attached 8ball.php into your forums directory
and then run it ie http://yoursite.com/forums/8ball.php

you can see a working demo here

DWZ 04-30-2002 05:20 AM

augh, need to register :\

can you post a screenshot?

dymo 04-30-2002 05:49 AM

sorry about that forgot i added in the user check to the 8ball system
here are the screen shots
http://www.gamer-networks.com/forums/images/8ball-q.jpg
http://www.gamer-networks.com/forums/images/8ball-a.jpg

John 04-30-2002 06:24 AM

That answer doesn't look too hopeful :S

Admin 04-30-2002 06:38 AM

Quote:

Originally posted by JohnWarwick
That answer doesn't look too hopeful :S
That's the whole point of 8-Ball. ;)

tweak 04-30-2002 07:45 AM

Kool Hack but i get these errors on your forum???

Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site2/fst/var/www/html/forums/8ball.php:1) in /home/virtual/site2/fst/var/www/html/forums/admin/functions.php on line 1647

Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site2/fst/var/www/html/forums/8ball.php:1) in /home/virtual/site2/fst/var/www/html/forums/admin/functions.php on line 1647

Also the answer appears in the top corner??

Floris 04-30-2002 11:24 AM

Does that javascript work on ie5 and ns4 and opera & mozilla ?

dymo 04-30-2002 04:17 PM

Quote:

Originally posted by tweak
Kool Hack but i get these errors on your forum???

Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site2/fst/var/www/html/forums/8ball.php:1) in /home/virtual/site2/fst/var/www/html/forums/admin/functions.php on line 1647

Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site2/fst/var/www/html/forums/8ball.php:1) in /home/virtual/site2/fst/var/www/html/forums/admin/functions.php on line 1647


Also the answer appears in the top corner??

the answer in the corner is a bug hence its a beta release.

the header info you get on my forums is in the process of being hacked right now to support multiple cookies, just refresh it and it goes away.

if anyone has an idea of how to get the answer to appear under the question i could really use it


Xi the js should work on anything higher than ie 4 and ns 4, if the browser cnt use it , it should ignored, the js only provides the idiot correct of someone submitting a blank question
d

M.Smith 05-04-2002 07:17 PM

Quote:

Originally posted by xiphoid
Does that javascript work on ie5 and ns4 and opera & mozilla ?
im suprised ns4 supports html never mind that js :p

GenSec 05-08-2002 10:57 AM

Quote:

Originally posted by dymo


the answer in the corner is a bug hence its a beta release.


Move
PHP Code:

 eval("dooutput(\"".gettemplate("8ball")."\");"); 

up. Place before
PHP Code:

  if (isset($requiredquestion) AND $requiredquestion!="") { 


BigJohnson 05-31-2002 07:16 PM

I like this hack alot and i have added more than a couple hundred different sayings to this 8 Ball. If someone else can create this hack to work with my 8 ball that i made with photoshop and insert the message inside the ball that would be awesome. That would be cool if there was a fading effect when you clicked the buttons after typing in your question and the page doesnt refresh to see you answer. Right when you click the button the 8 ball will fade to the answer. Is anyone with me on this one and willing to help?

GenSec 07-10-2002 06:51 PM

You can look at my version here.

BigJohnson 07-11-2002 02:05 PM

Can you please post your version. That would be great. It looks great. Thanks.

GenSec 07-11-2002 02:27 PM

Îê. Everything in the txt file.

THANKS Dymo for the nice forum addon!

Boofo 07-11-2002 04:19 PM

This part is kindof confusing in your text file:

Step 2: Replace in 8ball.php the last section to:

As is this part:

include("./footer.php"); //may be in your case it should be deleted

Can you please explain it a little better to this newbie? :)

Quote:

Originally posted by GenSec
??. Everything in the txt file.

THANKS Dymo for the nice forum addon!


GenSec 07-11-2002 04:42 PM

If your forum is just VB page
Replace Dymo
PHP Code:

          srand((double) microtime() * 1000000);
          
$count count($answers);
 eval(
"dooutput(\"".gettemplate("8ball")."\");");
          echo 
"You asked:<b> ";
          echo 
$requiredquestion;
          echo 
"</b><br><br>and the answer is: <b> " .
$answers[rand(0,$count)];
  }

  
?> 

without
PHP Code:

include("./footer.php"); 

It's for those who like me using it on nonVb page and has footer.php file.

BigJohnson 07-11-2002 06:36 PM

Ya but can the answer go somewhere else besides below the footer. I hate that part.

GenSec 07-12-2002 05:11 AM

Quote:

Originally posted by BigJohnson
Ya but can the answer go somewhere else besides below the footer. I hate that part.
Why below. I said above and you can see on my page that problem just to move up eval("dooutput(\"".gettemplate("8ball")."\");");

PHP Code:

 <?
 require("./global.php");
if(!$bbuserinfo[userid]) {
  eval("dooutput(\"".show_nopermission()."\");");

 eval("dooutput(\"".gettemplate("8ball")."\");");
  if (isset($requiredquestion)) {
          $answers = array( "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Yes</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">No</font>",                                                                           
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Of Course</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Never</font>",
                                  "Maybe",
                                  "Theres a Chance",
                                  "What do you think I am, psychic?",
                                  "Sometimes",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Im quit sure about that!</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Thats probably true</font>", 
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Hell no..</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Dont even think about it....</font>",
                                  "Maby , maby not",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">You may count on it</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">The chanse is quit as big as seeing Jay Leno in a
g-string</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">I would not even concider it..</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">I must say yes...</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Damnd right ...</font>",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"blue\">Sure thing.</font>.",
                                  "<font face=\"MS Sans Serif\" size=\"2\"
color=\"red\">Hahah your kidding right?</font>",
                                         
                                  "<font face=\"MS Sans Serif\" size =\"2\"
color=\"blue\">If you're lucky</font>");
          srand((double) microtime() * 1000000);
          $count = count($answers);
         echo "<table border=\"0\" align=\"center\" width=\"300\" cellpadding=\"3\" cellspacing=\"1\"><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: {codebackground};\">";
         echo "$bbuserinfo[username]: <b>$requiredquestion</b>";
          echo "</td></tr><tr><TD style='filter:alpha(opacity=10)' onmouseover='nereidFade(this,100,30,5)' onmouseout='nereidFade(this,10,50,5)' background='images/3D.jpg' border=0 HEIGHT='300'  VALIGN='MIDDLE'><center><b>".
$answers[rand(0,$count)];
          echo "</center> </b></td></tr></table>";


  } else {

         echo "<table border=\"0\" align=\"center\" width=\"300\" cellpadding=\"3\" cellspacing=\"1\"><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: {codebackground};\">";
         echo "$bbuserinfo[username]: <b></b>";
          echo "</td></tr><tr><TD style='filter:alpha(opacity=10)' onmouseover='nereidFade(this,100,30,5)' onmouseout='nereidFade(this,10,50,5)' background='images/3D.jpg' border=0 HEIGHT='300' ALIGN='CENTER' VALIGN='MIDDLE'><b><img src='http://www.2x2online.com/forum/$avatarurl'  border=0>";
          echo "</b></td></tr></table>";
}
  ?>


BigJohnson 07-12-2002 01:45 PM

Ya thats what i have but the answer is below the footer on my site.


All times are GMT. The time now is 03:51 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01359 seconds
  • Memory Usage 1,852KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (19)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete