• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

PHP - Help Needed - Should be Easy. Rep++ For Help

patriciou

Member
Joined
Dec 26, 2009
Messages
180
Reaction score
6
Hello Otlanders

I have found what i was Looking for But...
I don't really get where the files Should go.
and what file types i have to Create.

http://otland.net/f82/stream-live-your-website-175351/index2.html

I have done the GlobalEvents part but i dont get the Other script.
Is it 1 Script or is it few scripts in 1 file that i have to seperate.

Big Rep++ for person that Will explain it to me :)

ps. I'm really bad with PHP

Regards, Patriciou



That's what i'm on about.

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Cintravia OTS - Stream</title>
        <style type="text/css">
.alpha_wrapper {
        padding-top: 8px;
        float: left;
        position: relative;
        color: #fff;
        width: 96px;
        text-align: center;
}
.name {
        white-space: nowrap;
        color: rgb(0, 255, 0);
        font-size:10px;
        width: 50%;
        margin: 0px auto;
        padding-bottom: 2px;
        font-family: Verdana;
        text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
}
.skull {
        background: transparent url(images/redskull.gif) no-repeat;
        position: absolute;
        top: 31px;
        left: 57px;
        width: 11px;
        height: 11px;
        width: 50%;
        margin: 0px auto;
}
        </style>
</head>
<body style="background-image:url('');background-color:#525453;background-repeat:repeat-x;">
<div style="color:white;float:center;text-align:center;margin: 0 auto;text-shadow:0 0 5px #fff;font-family:Georgia,serif;font-weight:strong;font-size:35px;">Pokemon Portal Livestream</div>
<div id="onlinecount" style="color:white;clear:both;font-family:Arial, sans-serif;float:center;text-align:center;margin:0 auto">Viewers: 0&nbsp;- <a href="#" style="color: white;" onclick="window.close();">Close</a></div>
<div style="box-shadow:0 0 20px #000;clear:both;font-family:Arial, sans-serif;color:white;width:737px;height:605px;border:2px solid black;margin:5px auto;background-image:url('stream.png');text-align:center;overflow:hidden;position:relative;" id="put"></div>
 
<script type="text/javascript">
<!--
function disableSelection(target){
 
    if (typeof target.onselectstart!="undefined")
        target.onselectstart=function(){return false}
 
    else if (typeof target.style.MozUserSelect!="undefined")
        target.style.MozUserSelect="none"
    else
        target.onmousedown=function(){return false}
 
    target.style.cursor = "default"
}
 
disableSelection(document.body);
 
var uid = Math.floor(Math.random()*(10000000-1))+10000000;
function handler(data, hid) {
        if (hid == 1) {
                try { var obj = eval("(" + data + ")"); }
                catch(err) {}
       
                var s = '';
                for (x in obj) {
                        var k = obj[x];
       
                        s += '<div style="z-index:'+(k[1]-20)+';position:absolute;top:'+((k[1]-992)*32-15)+'px;left:'+((k[0]-992)*32-7)+'px;width:64px;height:64px;background:transparent url(';
                        if(k[3] == 0)
                                s += 'images/items/'+k[11]+'.gif';
                        else
                                s += 'outfitter.php?id='+k[3]+'&addons='+k[4]+'&head='+k[5]+'&body='+k[6]+'&legs='+k[7]+'&feet='+k[8]+'&mount='+k[9]+'&dir='+k[10];
       
                        s += ') no-repeat right bottom;">\
                        <div class="alpha_wrapper">\
                                <div class="name" style="margin: 5px 19px">'+x.replace(/(&nbsp)/g,' ')+'<\/div>\
                                <div style="margin-left: 34px; margin-top: -7px; width: 25px; height: 2px; background-color: rgb(0, 191, 0); border: 1px solid black;"><\/div>';
                        if(k[12] >= 3)
                                s += '<div class="skull" style="background-image:url(img/'+(k[12] == 3 ? 'white' : (k[12] == 4 ? 'red' : 'black')) + 'skull.gif);">&nbsp;<\/div>';
                       
                        s += '<\/div><\/div>';
                 }
                document.getElementById('put').innerHTML = s;
                setTimeout("update", 250);
 
        } else {
                /*setTimeout(update, 3000, 2);
                document.getElementById('onlinecount').innerHTML = 'Viewers: '+data+'&nbsp;- <a href="http://pportal.net/">Back to Pokemon Portal Website</a>';*/
        }
}
function update(hid) {
        var xhr;
        try {
                xhr=new XMLHttpRequest();
        }
        catch (e) {
                try {
                        xhr=new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e) {
                        try {
                                xhr=new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch (e) {
                                alert("Your browser does not support AJAX!");
                                return false;
                        }
                }
        }
        if (hid == 1) {
                xhr.open("GET","/cache/stream.json?"+Math.random(), true);
        } else {
                //xhr.open("GET","lv_update.php?id="+uid, true);
        }
        xhr.onreadystatechange=function() {
                if(xhr.readyState==4) {
                        handler(xhr.responseText, hid);
                        setTimeout(update,500,1);
                }
        }
 
        xhr.send(null);
}
//setTimeout(update,100,1);
handler({"2": ["",1003,1003,6,132,2,115,0,132,114,0,3,0,1],
}, 1);
update(1);
//setTimeout(update,100,2);
</script>
</body>
</html>
 
Last edited:
Well, In my Acc maker folder

I have created new File called stream.php

inside the file i have inserted that:

PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
        <title>Cintravia OTS - Stream</title> 
        <style type="text/css"> 
.alpha_wrapper { 
        padding-top: 8px; 
        float: left; 
        position: relative; 
        color: #fff; 
        width: 96px; 
        text-align: center; 
} 
.name { 
        white-space: nowrap; 
        color: rgb(0, 255, 0); 
        font-size:10px; 
        width: 50%; 
        margin: 0px auto; 
        padding-bottom: 2px; 
        font-family: Verdana; 
        text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; 
} 
.skull { 
        background: transparent url(images/redskull.gif) no-repeat; 
        position: absolute; 
        top: 31px; 
        left: 57px; 
        width: 11px; 
        height: 11px; 
        width: 50%; 
        margin: 0px auto; 
} 
        </style> 
</head> 
<body style="background-image:url('');background-color:#525453;background-repeat:repeat-x;"> 
<div style="color:white;float:center;text-align:center;margin: 0 auto;text-shadow:0 0 5px #fff;font-family:Georgia,serif;font-weight:strong;font-size:35px;">Pokemon Portal Livestream</div> 
<div id="onlinecount" style="color:white;clear:both;font-family:Arial, sans-serif;float:center;text-align:center;margin:0 auto">Viewers: 0&nbsp;- <a href="#" style="color: white;" onclick="window.close();">Close</a></div> 
<div style="box-shadow:0 0 20px #000;clear:both;font-family:Arial, sans-serif;color:white;width:737px;height:605px;border:2px solid black;margin:5px auto;background-image:url('stream.png');text-align:center;overflow:hidden;position:relative;" id="put"></div> 
  
<script type="text/javascript"> 
<!-- 
function disableSelection(target){ 
  
    if (typeof target.onselectstart!="undefined") 
        target.onselectstart=function(){return false} 
  
    else if (typeof target.style.MozUserSelect!="undefined") 
        target.style.MozUserSelect="none" 
    else 
        target.onmousedown=function(){return false} 
  
    target.style.cursor = "default" 
} 
  
disableSelection(document.body); 
  
var uid = Math.floor(Math.random()*(10000000-1))+10000000; 
function handler(data, hid) { 
        if (hid == 1) { 
                try { var obj = eval("(" + data + ")"); } 
                catch(err) {} 
        
                var s = ''; 
                for (x in obj) { 
                        var k = obj[x]; 
        
                        s += '<div style="z-index:'+(k[1]-20)+';position:absolute;top:'+((k[1]-992)*32-15)+'px;left:'+((k[0]-992)*32-7)+'px;width:64px;height:64px;background:transparent url('; 
                        if(k[3] == 0) 
                                s += 'images/items/'+k[11]+'.gif'; 
                        else 
                                s += 'outfitter.php?id='+k[3]+'&addons='+k[4]+'&head='+k[5]+'&body='+k[6]+'&legs='+k[7]+'&feet='+k[8]+'&mount='+k[9]+'&dir='+k[10]; 
        
                        s += ') no-repeat right bottom;">\ 
                        <div class="alpha_wrapper">\ 
                                <div class="name" style="margin: 5px 19px">'+x.replace(/(&nbsp)/g,' ')+'<\/div>\ 
                                <div style="margin-left: 34px; margin-top: -7px; width: 25px; height: 2px; background-color: rgb(0, 191, 0); border: 1px solid black;"><\/div>'; 
                        if(k[12] >= 3) 
                                s += '<div class="skull" style="background-image:url(img/'+(k[12] == 3 ? 'white' : (k[12] == 4 ? 'red' : 'black')) + 'skull.gif);">&nbsp;<\/div>'; 
                        
                        s += '<\/div><\/div>'; 
                 } 
                document.getElementById('put').innerHTML = s; 
                setTimeout("update", 250); 
  
        } else { 
                /*setTimeout(update, 3000, 2); 
                document.getElementById('onlinecount').innerHTML = 'Viewers: '+data+'&nbsp;- <a href="http://pportal.net/">Back to Pokemon Portal Website</a>';*/ 
        } 
} 
function update(hid) { 
        var xhr; 
        try { 
                xhr=new XMLHttpRequest(); 
        } 
        catch (e) { 
                try { 
                        xhr=new ActiveXObject("Msxml2.XMLHTTP"); 
                } 
                catch (e) { 
                        try { 
                                xhr=new ActiveXObject("Microsoft.XMLHTTP"); 
                        } 
                        catch (e) { 
                                alert("Your browser does not support AJAX!"); 
                                return false; 
                        } 
                } 
        } 
        if (hid == 1) { 
                xhr.open("GET","/cache/stream.json?"+Math.random(), true); 
        } else { 
                //xhr.open("GET","lv_update.php?id="+uid, true); 
        } 
        xhr.onreadystatechange=function() { 
                if(xhr.readyState==4) { 
                        handler(xhr.responseText, hid); 
                        setTimeout(update,500,1); 
                } 
        } 
  
        xhr.send(null); 
} 
//setTimeout(update,100,1); 
handler({"2": ["",1003,1003,6,132,2,115,0,132,114,0,3,0,1], 
}, 1); 
update(1); 
//setTimeout(update,100,2); 
</script> 
</body> 
</html>

and in my Layout i have added :

PHP:
					<div id="vt_account_menu">
						<div class="header"><img src="layouts/genesis/8918.gif "> <font size="5"><sup>Stream</sup></font></div>
						<ul>
						<li><a href="index.php?subtopic=stream">Live Stream</a></li>
						</ul>
					</div>

But in my acc maker i get this Error:

PHP:
Invalid subtopic. Can't load page.

_________________________________________________


Also in globalevents, I get this Error after turning the server on:

PHP:
[Error - GlobalEvent Interface]
data/globalevents/scripts/stream.lua:onThink
Description:
data/globalevents/scripts/stream.lua:19: attempt to index field 'streampath' (a
nil value)
stack traceback:
        data/globalevents/scripts/stream.lua:19: in function <data/globalevents/
scripts/stream.lua:1>
[Error - GlobalEvents::think] Couldn't execute event: Stream

________________________________________________________

Also. In globalevents script there is a line...
PHP:
streampath = io.open('/var/www/cache/stream.json',"w"),
But i've not got a file called stream.json
 
Try change :

PHP:
<li><a href="index.php?subtopic=stream">Live Stream</a></li>

to

PHP:
<li><a href="index.php?subtopic=stream.php">Live Stream</a></li>
 
Back
Top