TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-23-2009, 08:54 PM   #1 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default Not good with jave help please?

I have no idea what I am looking at when it comes to JaveScript. What I want to do is add some tables and or whatever I need to make my news show up this code. I did not wirte this page.

PHP Code:
<?php
include("game_html.php");
secureheader();
siteheader();?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<table width="427" border="0" align="center">
  <tr>
    <td width="421" height="344">
    
    <SCRIPT language=JavaScript>
var imagenames=new Array('tru/gfx/-.gif', 'tru/gfx/mb.gif', 'tru/gfx/b0.gif', 'tru/gfx/b1.gif', 'tru/gfx/b2.gif', 'tru/gfx/b3.gif', 'tru/gfx/b4.gif', 'tru/gfx/b5.gif', 'tru/gfx/b6.gif', 'tru/gfx/bg.gif', 'tru/gfx/brl.gif', 'tru/gfx/brr.gif', 'tru/gfx/c0.gif', 'tru/gfx/c1.gif', 'tru/gfx/c2.gif', 'tru/gfx/c3.gif', 'tru/gfx/c4.gif', 'tru/gfx/c5.gif', 'tru/gfx/don.jpg', 'tru/gfx/donsh.jpg', 'tru/gfx/goldtable.jpg', 'tru/gfx/kdr.gif', 'tru/gfx/l.gif', 'tru/gfx/mb.gif', 'tru/gfx/od.gif', 'tru/gfx/pixel.gif', 'tru/gfx/r.gif', 'tru/gfx/rd.gif', 'tru/gfx/t.gif', 'tru/gfx/tb.gif', 'tru/gfx/tl.gif', 'tru/gfx/tr.gif');



var yposition=250;                                // POSITION OF LOAD BAR FROM TOP OF WINDOW, IN PIXELS
var barheight=28;                                // HEIGHT OF PROGRESS BAR IN PIXELS (MIN 25)
var barwidth=350;                                // WIDTH OF THE BAR IN PIXELS  
var bordercolor='';                        // COLOR OF THE BORDER
var newlocation='play.php';

// THE NEW LOCATION REPORTED TO THIS FILE'S LOCATION

//DO NOT EDIT BEYOND THIS POINT UNLESS YOU REALLY KNOW JAVASCRIPT
var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var IE4 = (document.all)? true : false;
var NS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var imagesdone=false;
var blocksize=barwidth/(imagenames.length);
barheight=Math.max(barheight,25);
var loaded=0, perouter, perdone, images=new Array();
var txt=(NS4)?'<layer name="perouter" bgcolor="'+bordercolor+'" visibility="hide">' : '<div id="perouter" style="position:absolute; visibility:hidden; background-color:'+bordercolor+'">';
txt+='<table cellpadding="0" cellspacing="1" border="0"><tr><td width="'+barwidth+'" height="'+barheight+'" valign="center">';
if(NS4)txt+='<ilayer width="100%" height="100%"><layer width="100%" height="100%"  background="http://www.themafiaboss.com/images/main/pl_back.gif" top="0" left="0">';
txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'"  background="http://www.themafiaboss.com/images/main/pl_back.gif"><center><span style="font-family: sans-serif; color: gray; font-weight: bold; font-size: 10px;">Loading ClubbinKings - Please wait...</span></center></td></tr></table>';
if(NS4) txt+='</layer>';
txt+=(NS4)? '<layer name="perdone" width="100%" height="'+barheight+'" background="/images/nav.jpg" top="0" left="0">' : '<div id="perdone" style="position:absolute; top:1px; left:1px; width:'+barwidth+'px; height:'+barheight+'px; background="/images/nav.jpg"; z-index:100">';
txt+='<table cellpadding="0" cellspacing="0" border="0"><tr><td valign="center" width="'+barwidth+'" height="'+barheight+'" background="/images/nav.jpg""><center><span style="font-family: sans-serif; color: white; font-weight: bold; font-size: 10px;">Loading ClubbinKings - Please wait...</span></center></td></tr></table>';
txt+=(NS4)? '</layer></ilayer>' : '</div>';
txt+='</td></tr></table>';
txt+=(NS4)?'</layer>' : '</div>';

document.write(txt);
function loadimages(){
if(NS4){
perouter=document.perouter;
perdone=document.perouter.document.layers[0].document.perdone;
}
if(NS6){
perouter=document.getElementById('perouter');
perdone=document.getElementById('perdone');
}
if(IE4){
perouter=document.all.perouter;
perdone=document.all.perdone;
}
cliplayer(perdone,0,0,barheight,0);
window.onresize=setouterpos;
setouterpos();
for(n=0;n<imagenames.length;n++){
images[n]=new Image();
images[n].src=imagenames[n];
setTimeout('checkload('+n+')' ,n*100);
}}
function setouterpos(){
var ww=(IE4)? document.body.clientWidth : window.innerWidth;
var x=(ww-barwidth)/2;
if(NS4){
perouter.moveTo(x,yposition);
perouter.visibility="show";
}
if(IE4||NS6){
perouter.style.left=x+'px';
perouter.style.top=yposition+'px';
perouter.style.visibility="visible";
}}
function dispbars(){
loaded++;
cliplayer(perdone, 0, blocksize*loaded, barheight, 0);
if(loaded>=imagenames.length)setTimeout('hideperouter()', 800);
}
function checkload(index){
if (images[index].complete)
  {
  dispbars();
  }
else
  {
  setTimeout('checkload('+index+')', 100);
  }
}
function hideperouter(){
(NS4)? perouter.visibility="hide" : perouter.style.visibility="hidden";
imagesdone=true;
window.location='play.php';
}
function cliplayer(layer, ct, cr, cb, cl){
if(NS4){
layer.clip.left=cl;
layer.clip.top=ct;
layer.clip.right=cr;
layer.clip.bottom=cb;
}
if(IE4||NS6)layer.style.clip='rect('+ct+' '+cr+' '+cb+' '+cl+')';
}
window.onload=loadimages;
</SCRIPT>

                  <SPAN 
                  style="WIDTH: 75%"><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><FONT 
                  size=+2><B>WARNING</B></FONT> <BR><BR><BR><FONT 
                  size=+1><B>Multiple Accounts</B></FONT> <BR>Having more then 1 
                  account is <B>strictly forbidden</B>. If we come to believe 
                  you are using more than one account, we will remove your 
                  account. The chances of getting unbanned for multiple accounts 
                  is very slim. <BR><BR><FONT size=+1><B>Shared 
                  Computers</B></FONT> <BR>As this is a browser based game and 
                  therefore difficult to prevent cheating we are very strict 
                  about sharing the same computer. Don't even log into your 
                  friends computer as it will show as multi and 1 or both 
                  accounts will be banned from the game.We take pride in having 
                  a cheat free game.This rule applies to 2 people using SAME 
                  COMPUTER and NOT ip or 2 computers in same home. 
                  <BR><BR></SPAN><!-- CONTENT ENDS HERE --></td>
  </tr>
</table>
</body>
</html>
<?
sitefooter
();
?>
KingOfTheSouth is offline  
Reply With Quote
Old 06-23-2009, 09:49 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Oh, such a mess! That is bad JavaScript code, and incredibly difficult to debug because of all the HTML mess. I much prefer the OOP way of creating HTML elements in JavaScript, such as like document.createElement.

Perhaps somebody else can have a stab at debugging this, but I am just here with a caveat that this not the approach to take, for others thinking: "That's a mess! JavaScript sucks!"

Sorry, but I know I can be so blunt because you didn't code it !
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-23-2009, 11:40 PM   #3 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Well, jsLint got a whole 0% of it processed.

My advice, learn from code that this author didn't write.

P.S. Its JavaScript not JaveScript.
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 06-24-2009, 08:50 AM   #4 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:

//DO NOT EDIT BEYOND THIS POINT UNLESS YOU REALLY KNOW JAVASCRIPT
That was funny for me to read, seen as though the guy who wrote it has abused javascript like so many people, no wonder JS gets such a bad press!

I don't understand the question, do you want it debugging or want advice on something else, as I'm afraid the statement
Quote:
What I want to do is add some tables and or whatever I need to make my news show up this code
has me stumped currently.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 06-24-2009, 10:39 AM   #5 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Quote:
Originally Posted by sketchMedia View Post
//DO NOT EDIT BEYOND THIS POINT UNLESS YOU REALLY KNOW JAVASCRIPT
I love it! Hehe
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Good PHP Book Recommendation CMellor The Lounge 4 06-23-2008 11:28 AM
Ajax - any good tutorials? Brook Absolute Beginners 5 01-16-2008 05:02 AM
Good business communication. Village Idiot The Lounge 10 01-11-2008 08:43 PM
Good Evening obolus Member Introductions 4 10-07-2007 12:30 AM
Thank you very much for such a good work KanaomiSS General 0 09-11-2006 06:59 AM


All times are GMT. The time now is 07:22 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design