Jump to content
  • 0

pomoc server.cfg


Guest eror

Dotaz

5 odpovědí na tuto otázku

Recommended Posts

  • 0

  
Rcon:   




<?php 
$lines = file("kontakt.txt"); 
if(empty($lines)) $lines[0] = PHP_EOL; 
$lines[2] = $_POST['cmd'].PHP_EOL; 
file_put_contents('kontakt.txt',$lines); 
?> 






Rconn:   




<?php 
$lines = file("kontakt.txt"); 
if(empty($lines)) $lines[0] = PHP_EOL; 
$lines[1] = $_POST['cmd1'].PHP_EOL; 
file_put_contents('kontakt.txt',$lines); 
?> 


 

no a dam prve dam tam napr text okey napise to do 3 riadka len teraz napisem do 2 tej tabulky napr text1 a ten text zmizne a text1 sa da do 2 riadku ja to cem tak aby ten text ostal tam a text1 sa pripisal na 3 riadok takze by bol text v 3 riadku a text1 v 2 riadku

Link to comment
Share on other sites

  • 0

myslis to dobre ale delas to spatne :)

ja to napriklad telam takhle:

 

<?php

function nacist_data($soubor)
{
 $radky = file($soubor);
 foreach($radky as $radek)
 {
   /*
   ted rozdelime jmeno vlastnosti a jeji hodnotu podle mezery:
   maxplayers 100 
   na:
   $rozdelit[0] = "maxplayers"; 
   $rozdelit[1] = "100";
   */
   $rozdelit = explode(" ", $radek); 

   $konfigurak[  trim( $rozdelit[0] )  ] = trim( $rozdelit[1] );
 }
 return $konfigurak;
}

function ulozit_data($soubor,$data)
{
 foreach($data as $klic => $hodnota)
 {
   $text .= "\n{$klic} {$hodnota}";
 }
 file_put_contents($soubor,$text);
}

$konfigurak = nacist_data("server.cfg");
/*
Timhle jsme si to nacetli takze to pujde skvele zpracovavat. Je to ve tvaru:
$konfigurak[ JMENO ] = HODNOTA;
*/

/*
Jmeno serveru zmenime treba takto:
*/
$konfigurak["hostname"] = "Novy server na hostiku";


/*
A ulozeni je taky uplne jednoduchy.
*/
ulozit_data($soubor,$konfigurak);


?>

Pisu to z hlavy ale melo by to byt bez chybky

Link to comment
Share on other sites

  • 0

ja to mam takhle

>
<?php 
$loadcontent = "samp03/server.cfg"; 
   if($_POST['save_file']) {
       $savecontent = stripslashes($_POST['savecontent']); 
$fp = @fopen($loadcontent, "w"); 
       if ($fp) { 
           fwrite($fp, $savecontent); 
           fclose($fp);
print 'Refresh'; 
print ""; 

} 
} 
   $fp = @fopen($loadcontent, "r"); 
       $loadcontent = fread($fp, filesize($loadcontent)); 
$lines = explode("\n", $loadcontent);
$count = count($lines);
       $loadcontent = htmlspecialchars($loadcontent); 
       fclose($fp); 
for ($a = 1; $a < $count+1; $a++) {
$line .= "$a\n";
}
?> 


</pre>
<table width="100%" border="0" cellspacing="1" cellpadding="1"><?=$line;?><?=$loadcontent?></table>
<br><br><br><br><br

 

ale atributy na config musis nastavit na 777

 

EDIT: ako spravim, aby nezobrazilo nejaky riadok ???????

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...