Jump to content

EsOne

Members
  • Posts

    59
  • Joined

  • Last visited

    Never

Posts posted by EsOne

  1. Thanks. Don't quite work though. With the start= section, each page starts every 15. So, page 2 would be start=16, page 3 would be start=31

     

    That script assumes pages go as start=1 for page 1, and start=2 for page 2.

     

     

  2. I currently use the following script to make links from page to page on my website.

    <?php
    echo "<p id=\"pages\">";
    for($i=0;$i<$limit;$i+=15){
    echo "| <a href=\"?start=".($i+1)."\">".($i/15+1)."</a> | ";
    }
    ?>

     

    Now, I am getting so many pages, that management of them is getting difficult.

     

    I want to make it where it only shows the previous 5 pages to the current, and the next 5 pages fromt he current.

    So, if a person was on page 10, It would show  ...5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15...

     

    Keep in mind I am pretty code dumb, as I am just learning. So any help would have to be dumbed down pretty good.

     

    To see what links I am talking about in person, the website is: http://dolphinmania.pandaandpenguin.com/dolphinmania

     

     

  3. Now, who would keep track of the clicks? Would it be the person paying for the adspace, or would it be me?

     

    Sorry, kind of new to all of this adspace stuff.

     

    I'm not sure how to go about going up to a company and be asked details I don't know about.

     

    How does running them work? Like, how are they paid out? Monthly, weekly? How much do you usually see for advertising? I think I've heard somewhere that it can go higher than like 20 cents per click. Does that sound right?

  4. I don't think it falls into any other category.

     

    I want to start allowing businesses to rent adspace from me on my website.

     

    My question is how is this done?

     

    I mean, I know getting the businesses that want to advertise is just as easy as messaging the marketing people of the company, but code side...

     

    How are you usually paid for them. I'm guess per click, but who counts clicks, and how?

     

    How much, and what kind of coding is needed to insert these ads?

  5. I was told I have to put a strip tags code into my shoutbox to make it secure. Only problem, I have no idea where to put it.

     

    Add code to perform strip_tags() on $shout in shoutbox.php

     

    Is what I was told to do...

     

    Here is the shoutbox.php

     

     <?php
    
    /*
    ShoutPro 1.5.2 - shoutbox.php
    ShoutPro is licensed under the Creative Commons Attribution-ShareAlike 2.5 License. For more information see the file LICENSE.TXT in the documentation folder included with this distribution, or see http://creativecommons.org/licenses/by-sa/2.5/.  
    
    This file is shoutbox.php.  It is the main part of ShoutPro.  Do not modify this file unless you know what you're doing.  Simple customization should be done in config.php and your .css stylesheet.
    */
    
    if ($_POST["action"]!="")		$action = $_POST['action'];	
    else if ($_GET["action"]!="")	$action = $_GET["action"];
    
    if ($_POST["name"]!="")			$name = $_POST['name'];
    else if ($_GET["name"]!="")		$name = $_GET["name"];
    
    if ($_POST["pass"]!="")			$pass = $_POST['pass'];
    else if ($_GET["pass"]!="")		$pass = $_GET["pass"];
    
    if ($_POST["shout"]!="")		$shout = $_POST['shout'];
    else if ($_GET["shout"]!="")	$shout = $_GET["shout"];
    
    
    //include.php calls default ShoutPro functions and settings into effect.  ShoutPro cannot run without it.
    require("include.php");
    
    //Generate an array of password protected names, to be transferred to JavaScript later.
    $restricted_names = array();
    $index = 0;
    $FileName="lists/names.php";
    $list = file ($FileName);
    foreach ($list as $value) {
    list ($restrictedname,$namepass,$nameemail,) = explode ("|^|", $value);
    $restricted_names[$index] = trim(strtolower($restrictedname));	
    $index++;
    }
    
    extract($HTTP_REQUEST_VARS); //Extract all GET and POST variables to avoid annoying errors on strangely configured machines.
    
    if($action == "post" && $name && $name != "Name"){
    	//Prepare the name
    	$shout = trim($shout);
    	$shout = stripslashes($shout);
    	$shout = str_replace ("\n", " ", $shout);
    	$shout = str_replace ("\r", " ", $shout);
    	$name = trim($name);
    	$name = killhtml(killscript($name));
    	restrictedname($name,$pass);
    	//Store username in a cookie
    	setcookie("shoutpro_username", "", time() - 31536000);
    	$cookielife = time() + 31536000;
    	setcookie("shoutpro_username", $name, $cookielife);
    }
    ?>
    
    <html><head><title><?=$shoutboxname ?></title>
    <link rel="stylesheet" href="<?=$theme ?>" type="text/css" />
    <style type="text/css">.shout {overflow: hidden;}</style>
    <SCRIPT language="JavaScript">
    function reload() { 
       var loc = "shoutbox.php?";
       if (document.getElementById('moreshouts').style.display == 'inline')
    	loc += "viewall=true&";
    <? if ($userpanelon == "yes"){ ?>
       if (document.getElementById('userpaneloff').style.display == 'inline')
    	loc += "userpanelon=true&";
    <? } ?>
    location.href = loc;
    } 
    
    function checkrname() {
    //This function is called after a name is entered in the form field, and checks if it is registered.
    //If it is, it alerts the user, shows the password box, and focus on it.
    //If not, it focus on the shout textarea.
    var isin = false;
    if (document.getElementById('name').value != ""){
    	for (var i = 0; i < namesarray.length; i++){
    		if (namesarray[i] == document.getElementById('name').value.toLowerCase()){
    			alert("You have entered a registered name.  Please provide the password.");
    			document.getElementById('passwordfield').style.display = 'inline';
    			document.getElementById('pass').focus();
    			isin = true;
    		}
    	}
    }
    if (isin == false){
    	document.getElementById('passwordfield').style.display = 'none';
    	document.getElementById('shout').focus();
    	document.getElementById('shout').select();
    	return false;
    }
    else return true;
    }
    
    function CheckForm(){
    //Check if a name has been entered
    if (document.getElementById('name').value == "" || document.getElementById('name').value == "Name"){
    	alert("<?=$inputname ?>");
    	document.getElementById('name').focus();
    	document.getElementById('name').select();
    	return false;
    }
    
    //Check if a shout has been entered
    if (document.getElementById('shout').value == "" || document.getElementById('shout').value == "Shout!"){
    	alert("<?=$inputshout ?>");
    	document.getElementById('shout').focus();
    	document.getElementById('shout').select();
    	return false;
    }
    
    return true ;
    }
    
    function doviewall() {
    //Make the rest of the shouts viewable
    document.getElementById('moreshouts').style.display = 'inline';
    document.getElementById('viewall').style.display = 'none';
    document.getElementById('viewless').style.display = 'inline';
    }
    
    function doviewless() {
    //Hide more shouts
    document.getElementById('moreshouts').style.display = 'none';
    document.getElementById('viewall').style.display = 'inline';
    document.getElementById('viewless').style.display = 'none';
    }
    
    function openhelp() {
    //Pop up the help window
    window.open('help.php','help_window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=270,height=400')
    }
    
    function stoptmr(){ 
    if(tmron){ 
    	clearTimeout(timerID); 
    	tmron = false; 
    }
    } 
    
    function starttmr(){ 
       stoptmr(); 
       timerID = setTimeout('reload()', <?=$refresh ?>000); 
       tmron = true; 
    } 
    
    var tmron = false;
    var tmrid;
    <? if($refreshmode != "manual")	echo("starttmr();"); ?>
    
    var namesarray = new Array("<?=implode('","', $restricted_names); ?>"); //Convert the PHP array of names to JavaScript for client-side access
    </SCRIPT>
    
    </head>
    <body style="width: <?=$width ?>px !important;">
    <?php
    
    //The following code posts a message.
    if($action=="post"){
    if (!$name)	echo("<script>alert(\"".$inputname."\");</script>");
    else if (!$shout || $shout=="Shout!")	echo("<script>alert(\"".$inputshout."\");</script>");
    else {
    	//Prepare the shout
    	$shout = trim($shout);
    	$shout = stripslashes($shout);
    	$shout = str_replace ("\n", " ", $shout);
    	$shout = str_replace ("\r", " ", $shout);
    	badname($name);
    	if(!namelength($name,$nameminlength,$namemaxlength)) die();  //Check length of name to min and max lengths
    	$shout = first($shout);
    	$name = first($name);
    	if(!length($shout,$minlength,$maxlength)) die(); //Check length of shout to min and max lengths
    	//Find the date and time
    	$date = date("F j, Y", time() + $timeoffset * 3600);
    	$time = date("g:i A", time() + $timeoffset * 3600);
    	//Add the shout to the end of shouts.php
    	if($FilePointer = fopen("shouts.php", "a+")){
    		fwrite($FilePointer,"$name|^|$shout|^|$date|^|$time|^|$_SERVER[REMOTE_ADDR]|^|\n");
    		fclose($FilePointer);
    	}
    }
    echo("<script>location.href='shoutbox.php';</script>");
    }
    
    //Show the shoutbox name if selected
    if ($displayname == "yes")	echo ("<div align=center><b>$shoutboxname</b><br /><br />");
    //Show the form.
    echo("<form name='postshout' method='post' size='300px' action='shoutbox.php?action=post'>\n");
    echo("<input id='name' class='textbox' name='name' type='text' value='");
    if ($_COOKIE["shoutpro_username"])	echo $_COOKIE["shoutpro_username"];
    else	echo "Name";
    echo ("' onFocus=\"stoptmr()\" onBlur=\"checkrname();\"><br />\n"); 
    if ($_COOKIE["shoutpro_username"] && in_array(strtolower($_COOKIE["shoutpro_username"]),$restricted_names))
    echo "<div id='passwordfield' style='display:inline'>";
    else
    echo "<div id='passwordfield' style='display:none'>";
    echo("<input class='textbox' name='pass' id='pass' type='password' value='' onBlur=\"if(this.value != ''){document.getElementById('shout').focus();document.getElementById('shout').select();}\" onFocus=\"stoptmr()\" /><br />\n</div><textarea id='shout' class=textbox name='shout' rows='4' style='width:310px;' onFocus=\"stoptmr()\">Shout!</textarea><br />\n");
    echo("<div id='buttons'><input class=textbox type='submit' id='post' name='post' onFocus=\"this.select();\" value='Post' onclick='return CheckForm();'>\n");
    if ($refreshmode != "auto")	echo("<input class=textbox type=button value='Refresh' onClick=\"reload()\">\n");
    echo("</div></div>");
    $row_count = 0;
    //Display shouts
    $shouts = file("shouts.php");
    $shouts = array_reverse($shouts);
    foreach ($shouts as $item){
    if ($row_count == $numshoutsdisplay){
    	if ($_REQUEST["viewall"] == true)	echo "<div id='moreshouts' style='display:inline'>";
    	else	echo "<div id='moreshouts' style='display:none'>";
    	$viewalled = true; //We already displayed the viewall div
    }
    $row = ($row_count % 2) ? "one" : "two";
    list ($poster,$message,$date,$time,$ip) = explode ("|^|", $item);
    $thisnamecolor = "";
    $thisnamecolor = colornames($poster,$thisnamecolor);
    $message=profanityfilter(shoutcode(smilies(killhtml($message))));		
    $thisshout = "<span style='color: $thisnamecolor !important;' class='name'>$poster:</span> $message";
    $thisshout = killscript($thisshout);
    echo "<div class='shout' id='row-$row' title=\"Posted $date @ $time\">$thisshout</div>";
    $row_count++;
    }
    
    if (!$viewalled) echo "<div id='moreshouts' style='display:none'>";
    
    echo "</div><br /><div id='bottomlinks'>";
    
    if ($row_count > $numshoutsdisplay){
    if ($_REQUEST["viewall"] == true)	echo "<a href='shoutbox.php?viewall=true' onClick='doviewall();' style='display:none' id='viewall'>View All</a><a href='shoutbox.php' onClick='doviewless();' id='viewless'>View Less</a>::";
    else	echo "<a href='shoutbox.php?viewall=true' onClick='doviewall();' id='viewall'>View All</a><a href='shoutbox.php' onClick='doviewless(); ' style='display:none' id='viewless'>View Less</a>::";
    }
    
    echo "<a href=\"javascript:openhelp();\">Help</a>";
    
    if($userpanelon == "yes")
    if ($_REQUEST["userpanelon"] == true) echo "<br /><a href='#' id='userpanelon' onClick=\"document.getElementById('userpanel').style.display='inline';document.getElementById('userpanelon').style.display='none';document.getElementById('userpaneloff').style.display='inline';\" style='display:none'>Open User Panel</a><a href='#' id='userpaneloff' onClick=\"document.getElementById('userpanel').style.display='none';document.getElementById('userpanelon').style.display='inline';document.getElementById('userpaneloff').style.display='none';\" style='display:inline'>Close User Panel</a>";
    else	echo "<br /><a href='#' id='userpanelon' onClick=\"document.getElementById('userpanel').style.display='inline';document.getElementById('userpanelon').style.display='none';document.getElementById('userpaneloff').style.display='inline';\">Open User Panel</a><a href='#' id='userpaneloff' onClick=\"document.getElementById('userpanel').style.display='none';document.getElementById('userpanelon').style.display='inline';document.getElementById('userpaneloff').style.display='none';\" style='display:none'>Close User Panel</a>";
    ?>
    </div><br />
    <div id='userpanel' style='display:<? if ($_REQUEST["userpanelon"] == true) echo "inline"; else echo "none"; ?>'>
    <a href='#' onClick="window.open('userpanel/register.php','userpanel','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=400');"> -->Register a Name</a><br />
    <a href='#' onClick="window.open('userpanel/changepass.php','userpanel','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=400');"> -->Change your Password</a><br />
    <a href='#' onClick="window.open('userpanel/findpass.php','userpanel','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=400');"> -->Reset your Password</a><br /><br />
    </div>
    <?php
    
    ?>
    

     

     

    Where do I put this strip_tags() to make my box secure?

  6. So, my website uses ShoutPro. Well, today iw as looking in my file manager and saw the file "hey.php" in the directory of the shoutbox. I tried opening the file via my file manager, and it made FF stop responding. From what I did see of the code before it froze was milw0rm. I did some research and found that ShoutPro has a security issue, and that it can be used to remotely execute commands. I deleted all files related to it (which was only the hey.php and info.txt, which both had the same looking code in it)

     

    I searched milw0rm and got the following link about the Shoutpro Exploit:

     

    http://www.milw0rm.com/exploits/3758

     

    I am pretty much a newish PHP coder, and do not know very much. Can someone put into dumb terms what this link is saying? What should I do to "sanitize" this code they are referring to?

     

    Sorry if this is the wrong forum  :-[

  7. Thanks for the reply.

     

    I think I am starting to understand. However, i is actually part of the array (As far as I can understand)

     

    I'm actually trying to convert some javascript into PHP.

     

    Here is the js:

     

     var gameCap=0;
    var glowCt=0;
    var fishCt=0;
    
    for(var i in json[2][2]){
    if(json[2][2][i]['in_env']==1){
    fishCt++;
    if(json[2][2][i]['game_specifics']){
    gameCap+=Number(json[2][2][i]['game_specifics']['rewards'][0]['cap']);
    glowCt++;
    }
    }
    } 

     

    I'm trying to basically do for each i part of the array, if "in env" is found in the i section ++ to fishCT

    also if there is a "game specifics" array section to add $gameCap to what is in the "cap" part of the array.

     

    Sorry if I sound dumb in the way I explain. I am quite new to PHP

  8. I have a script that decodes a json file for information, and I am trying to do a for script for information, but I keep getting an error.

     

    I am trying to use the following script

     

    <?php
    
    $gameCap=0;
    $glowCt=0;
    $fishCt=0;
    
    for($i in $hay[2][2]{
    if($hay[2][2]{i}{'in_env'}==1){
    $fishCt++; }
    if($hay[2][2]{i}{'game_specifics'}){
    $gameCap+$hay[2][2]{i}{'game_specifics'}{'rewards'}{0}{'cap'};
    $glowCt++;
    } 
    }
    ?>

     

    And i get:

     

     

    Parse error: syntax error, unexpected T_STRING, expecting ';'

  9. I am *still* new to PHP, and are looking to make something that shows how many people are currently using my site.

     

    Only problem is. I have no idea how to.

     

    I know I have to create a data base that logs ips, but after that, I am clueless.

     

    Any help would be fantastic. If possible, I would like it dummied down, and the "why this does this" thing, instead of just the code.

  10. The main thing I am worried about is the text file that my function is pulling from:

     

    <?php
    function Tank(){
    $ids=file('momos.txt');
    $limit=sizeof($ids);
    $start=$_GET['start'];
    if(!$start){
       $start=1;
    }
    $start=intval($start)-1;
    if($start>1){
       if($start-16<1){
          echo "<a href=\"?start=1\">Prevous Page</a> ";
       }
       else{
          echo "<a href=\"?start=".($start-14)."\">Prevous Page</a> ";
       }
    }
    else{
       echo "<a onclick=\"getLastPage(this);\" href=\"?start=?\">Prevous Page</a> ";
    }
    if($start/15==round($start/15)){
       echo "<a href=\"?start=".($start+1)."\">".($start/15+1)."</a> ";
    }
    else{
       echo "<a href=\"?start=".($start+1)."\" title=\"Current page minus 1 is not a multiple of 15.\">IDK</a> ";
    }
    if($start+16>$limit){
       echo "<a href=\"?start=1\">Next Page</a>";
    }
    else{
       echo "<a href=\"?start=".($start+16)."\">Next Page</a>";
    }
    echo "<table cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"55%\" align=\"center\" bgcolor=\"#000000\"><tbody>";
    for($i=$start;$i<$start+15;$i++){
       if($i<$limit){
          $data=explode("|~|",$ids[$i]);
          if($i/2==round($i/2)){
             $color="#835a17";
          }
          else{
             $color="#fbbe67";
          }
          echo '<tr bgcolor="'.$color.'">'.checkTank($data[0],$data[1],$data[2])."</tr>";
       }
    }
    echo "</tbody></table><p id=\"pages\">";
    for($i=0;$i<$limit;$i+=15){
       echo "<a href=\"?start=".($i+1)."\">".($i/15+1)."</a> ";
    }
    echo "</p>";
    }
    ?>

     

    I want the file momos.txt to be pulled from my server to look for the information

  11. Including a file via a url will only include the output of the script, not any variables, functions or classes.

     

    You need to include files via a system file path.

    Ohhhh. LOL

     

    Is there anyway I could do that? I am making something for someone to use on their own server, but I want the code to stay unseen. That way it can not be copied.

  12. Okay, I have the following function saved in it's own file.

     

    <?php
    function Tank(){
    $ids=file('momos.txt');
    $limit=sizeof($ids);
    $start=$_GET['start'];
    if(!$start){
    $start=1;
    }
    $start=intval($start)-1;
    if($start>1){
    if($start-16<1){
    	echo "<a href=\"?start=1\">Prevous Page</a> ";
    }
    else{
    	echo "<a href=\"?start=".($start-14)."\">Prevous Page</a> ";
    }
    }
    else{
    echo "<a onclick=\"getLastPage(this);\" href=\"?start=?\">Prevous Page</a> ";
    }
    if($start/15==round($start/15)){
    echo "<a href=\"?start=".($start+1)."\">".($start/15+1)."</a> ";
    }
    else{
    echo "<a href=\"?start=".($start+1)."\" title=\"Current page minus 1 is not a multiple of 15.\">IDK</a> ";
    }
    if($start+16>$limit){
    echo "<a href=\"?start=1\">Next Page</a>";
    }
    else{
    echo "<a href=\"?start=".($start+16)."\">Next Page</a>";
    }
    echo "<table cellpadding=\"1\" cellspacing=\"1\" border=\"1\" width=\"55%\" align=\"center\" bgcolor=\"#000000\"><tbody>";
    for($i=$start;$i<$start+15;$i++){
    if($i<$limit){
    	$data=explode("|~|",$ids[$i]);
    	if($i/2==round($i/2)){
    		$color="#835a17";
    	}
    	else{
    		$color="#fbbe67";
    	}
    	echo '<tr bgcolor="'.$color.'">'.checkTank($data[0],$data[1],$data[2])."</tr>";
    }
    }
    echo "</tbody></table><p id=\"pages\">";
    for($i=0;$i<$limit;$i+=15){
    echo "<a href=\"?start=".($i+1)."\">".($i/15+1)."</a> ";
    }
    echo "</p>";
    }
    ?>

     

    In another fil, I am trying to call that fuction up, and used the include as follows:

     

    <?
    include ("http://dolphinmania.pandaandpenguin.com/secure/include.test.php");
    Tank();
    ?>

     

    Normally it would work, as there are other functions in the SAME page as where I made Tank() at that bring back no errors.

     

    This brings back "Fatal error: Call to undefined function Tank() in /home/content/e/s/o/esone/html/dolphinmania/secure/index.php on line 45"

     

    If I include the php where that is at, why is it still insisting it is an undefined function?

  13. Thanks ^_^

     

    I see why it didn't want to work the first time I tried. I had to name it php5.ini

     

    Anyways. I added what you said and now get the following error:

     

     

    Warning: include() [function.include]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/content/e/s/o/esone/html/test/test.php on line 2

     

    Warning: include(http://dolphinmania.pandaandpenguin/secure/index.php) [function.include]: failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/content/e/s/o/esone/html/test/test.php on line 2

     

    Warning: include() [function.include]: Failed opening 'http://dolphinmania.pandaandpenguin/secure/index.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/e/s/o/esone/html/test/test.php on line 2

  14. Including a script from a remote location like that will only include the output of the script. Its not the same as having the script on the local server.

    As long as the output goes onto the persons page is all I need.

    It is very easy script.

     

    I want the output from my script on my server to show on his webpage without having my script on his server.

     

    I was thinking the include would work, but I am not sure on how to change the php.ini file, as 1. I cannot find it, and 2. I don't know what I add. (Newer to php)

     

    I am guessing I would just type:

     

    fopen = on

    allow_url_include = on

     

    But, I don't know. I need help.

  15. I have someone that wants me to write a basic script for his page. The page it will be on in his server will consist of only the script I am writing.

     

    Is there a way (and if so, how?) to make it where the .php file stays on my server, but works on his page on his server? This will make sure none of the script gets altered, or copied.

     

    Yes,  you can place your page.php file for example in /secure/page.php (on your server) and on his server include it on theirs:

    <?php
    include('http://www.your_domain.com/secure/page.php');
    ?>

     

    Note fopen and allow_url_include must be on in php.ini to allow this.

    Thanks AGAIN oni. xD

     

    Now, I just need to find out how to do the second part of your recommendation.

  16. I have someone that wants me to write a basic script for his page. The page it will be on in his server will consist of only the script I am writing.

     

    Is there a way (and if so, how?) to make it where the .php file stays on my server, but works on his page on his server? This will make sure none of the script gets altered, or copied.

  17. 1.) You can use MySQL's LIMIT clause to specify a certain number of rows returned. Example

    $query = "SELECT * FROM table LIMIT 50 ORDER BY id DESC";//get last 50 entries in database
    

     

    2.) In addition to the IP address of the user, the $_SERVER super global has the referrer also (although beware, because this can be spoofed, and is sometimes not sent

     

    $referrer = $_SEVER['HTTP_REFERER'];
    

    I added the LIMIT section to it to make it

     

    $query=mysql_query("SELECT * FROM ip_table LIMIT 50 ORDER BY id DESC");

    But it returns:

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/e/s/o/esone/html/test/jsontest.php on line 30

  18. Hello everyone. I have a script I use to log IPs of who comes onto my pages.

    I actually have two questions on this.

     

    I use the following script to pull the info from my database and echo the results onto the page;

     

    mysql_query("INSERT INTO glowcount (ip) VALUES('".$count."' ) ") or die(mysql_error());
    $thecount=mysql_query("SELECT * FROM glowcount ORDER BY count DESC");
    $showthecount=mysql_fetch_assoc($thecount);
        echo $showthecount['count'];
    

     

    Now, it works just fine, BUT it lists all the IPs, and the list is getting rather long.

    Is there a way to show only a certain number of IPs? Like, limit it to the last 50 people that visited?

     

     

    Also, to the second part. Like on Wordpresses IP tracker, I want it to show which page they were referred from. I do not know if this is possible with my current script to do, but if it is, I would like to know what to do to do it.

     

    Here is my current script for GETTING IPs

     

    $IP =$_SERVER['REMOTE_ADDR']; //Or whatever refined IP
    $Requests =mysql_real_escape_string(print_r($_REQUEST,true)); //Grab server request vars
    $Date =date('D M dS Y h:i a'); //The date, you can use other info..
    $agent = getenv("HTTP_USER_AGENT"); //Or whatever refined IP
    

     

    Now, this part of the script was not written for me, and I was helped on this a while back here on the forums. I am pulling Requests. Now when the person showed me this script, he did not tell me exactly what data the "Requests" holds. This may be the referrer, I don't know. That is why I am asking.

  19. with the following script, I get

    Fatal error: Property name must be a string in /home/content/e/s/o/esone/html/test/123.php on line 24

     

    Anyone maybe know what is causing it?

     

    <?php
    function seconds2HMS($inputval){
    $hh = intval($inputval / 3600);
    $ss_remaining = ($inputval - ($hh * 3600));
    $mm = intval($ss_remaining / 60);
    $ss = ($ss_remaining - ($mm * 60));	
    if($hh<10){
    	$hh='0'.$hh;
    }
    if($mm<10){
    	$mm='0'.$mm;
    }
    if($ss<10){
    	$ss='0'.$ss;
    }
    return $hh.':'.$mm.':'.$ss;
    }
    function checkTank($tankId){
    $aquVs=118;//the current game version number
    $hay=json_decode(file_get_contents("http://www.gaiaonline.com/chat/gsi/index.php?v=json&m=[[6500%2C[1]]%2C[6510%2C[\"".$tankId."\"%2C0%2C1]]%2C[6511%2C[\"".$tankId."\"%2C0]]%2C[6512%2C[\"".$tankId."\"%2C0]]%2C[107%2C[\"null\"]]]&X=".time()));
    $gaiaT=$hay[0][2]->{'gaia_curr_time'};
    $aquaN=$hay[1][2]->{$tankId}->{'name'};
    $userN=$hay[1][2]->{$tankId}->{'user_id'};
    $glowT=$hay[1][2]->{$tankId}->{'game_info'}->{1}->{"open_time"};
    $play=$hay[1][2]->{$tankId}->{'game_info'}->{1}->{"player_count"};
    if($glowT){
    	if($glowT<=$gaiaT){
    		if($glowT+720>$gaiaT){
    			if($play<34){
    				return 'Glowing for '.seconds2HMS($gaiaT-$glowT).' <a target="_blank" href="http://www.gaiaonline.com/tank/'.$userN.'/?userEnvironmentId='.$tankId.'&gsiUrl=www&isInEdit=false&firstTime=&location=popUp&quality=low&version='.$aquVs.'&graphicsServer=http://s.cdn.gaiaonline.com/images/Gaia_Flash/aquarium/&isGameActive=true">[Open Aquarium Link]</a>';
    			}
    			else{
    				return 'Full';
    			}
    		}
    		else{
    			return 'Glowed '.seconds2HMS($gaiaT-$glowT).' ago.';
    		}
    	}
    	else{
    		return 'Glowing in '.seconds2HMS($glowT-$gaiaT).' <a target="_blank" href="http://www.gaiaonline.com/tank/'.$userN.'/?userEnvironmentId='.$tankId.'&gsiUrl=www&isInEdit=false&firstTime=&location=popUp&quality=low&version='.$aquVs.'&graphicsServer=http://s.cdn.gaiaonline.com/images/Gaia_Flash/aquarium/&isGameActive=true">[Open Aquarium Link]</a>';
    	}
    }
    else{
    	return 'Not Glowing';
    }
    }
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.