The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NewsManger / xml question
#4
oh and could you please check my code? It gives no errors, but it dosent works.... im too tired to debug it Sad

Code:
<?php

$ip=$_SERVER['REMOTE_ADDR'];
$key=$_GET["securitykey"];
$status=$_GET["status"];


if ($key=="md5ior6xsomk485asegilsa"){
writeDetails();//change the key here and in your ServerIP config file!
}else{
echo "Fail";
}


function writeDetails()
{
if(isset($_GET["status"])&&isset($_GET["players"])&&isset($_GET["maxplayers"])&&isset($_GET["writeonlineplayers"])){

$ip=$_SERVER['REMOTE_ADDR'];
$status=$_GET["status"];
$players=$_GET["players"];
$maxplayers=$_GET["maxplayers"];
$function=$_GET["writeonlineplayers"];
$File = "status.xml";

    $xml = @new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><item></item>');
    if ($status=="Offline") $ip="-";
    $xml->addChild('ip', $ip);
    $xml->addChild('players', $players);
    $xml->addChild('maxplayers', $maxplayers);
    $xml->addChild('function', $function);
    XMLsave($xml, $file);
}else{
echo "Missing data!";
}
}
class SimpleXMLExtended extends SimpleXMLElement{  
  public function addCData($cdata_text){  
   $node= dom_import_simplexml($this);  
   $no = $node->ownerDocument;  
   $node->appendChild($no->createCDATASection($cdata_text));  
  }
}
function XMLsave($xml, $file) {
    $xml->asXML($file);
    
    if (defined('GSCHMOD')) {
        chmod($file, GSCHMOD);
    } else {
        chmod($file, 0755);
    }
}
function getXML($file) {
    $xml = @file_get_contents($file);
    $data = simplexml_load_string($xml, 'SimpleXMLExtended', LIBXML_NOCDATA);
    return $data;
}

?>
Reply


Messages In This Thread
NewsManger / xml question - by rigor789 - 2011-10-02, 23:32:47
NewsManger / xml question - by mvlcek - 2011-10-02, 23:42:41
NewsManger / xml question - by rigor789 - 2011-10-02, 23:43:30
NewsManger / xml question - by rigor789 - 2011-10-02, 23:56:03



Users browsing this thread: 1 Guest(s)