vkg Posted July 5, 2011 Report Posted July 5, 2011 Link Mania SA-MP RolePlay ServerDeci vreau si eu un script care sa arate pe o pagina web detaliile dintr-un fisier spre care o sa pun eu adresa, puteti sa mi dati asa ceva ? , un script cu connectare la FTP as vrea pt ca fisierul se afla pe alt FTPMai pe scurt vreau sa fac un BANLIST pentru un server de samp ! Cine imi poate da asa ceva ? Quote
razer_krait Posted July 5, 2011 Report Posted July 5, 2011 (edited) Ar merge cu php foarte usor chiar.Asta este daca ai fisier-ul pe acelasi host cu script-ul php:<?php$a = file("host/nume.extensiefisier");echo "<table border='1'><tr>";for ($i = 1; $i < count($a); $i++) {echo "<td>".$a[$i]."<br />"."</td><tr>"; }echo "</tr></table>";?><?php$a = file_get_contents("http://localhost/alt/c.txt");$a = explode("\n" , $a);echo "<table border='1'><tr>";for ($i = 1; $i < count($a); $i++) {echo "<td>".$a[$i]."<br />"."</td><tr>"; }echo "</tr></table>";?> Edited July 5, 2011 by razer_krait Quote
vkg Posted July 5, 2011 Author Report Posted July 5, 2011 (edited) dar fi atent eu am fisierul pe un host de SERVER SAMP , adica as vrea un script sa se connecteze la ftp pt a deschide fisierul ... adica este un ban.log , intelegi ? este un log si as vrea sa l arate pe pagina, vezi daca gasesti asa ceva Exemplu : eu am fisierul aici : /home/gmisamp/195.225.59.100-7777/samp03/scriptfiles/FTGF/Logs/ban.log , Scriptul nu poate citi fisierul daca nu se connecteaza la FTP nu ? eu as vrea ca scriptul sa se connecteze la ftp si sa ia datele din acel log Edited July 5, 2011 by vkg Quote
razer_krait Posted July 5, 2011 Report Posted July 5, 2011 <?php$source = "ban.log";$target = fopen("target.txt", "w"); //Fisierul situat pe host-ul unde ai pus script-ul php$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");ftp_login($conn,"username-ul tau","parola ta");ftp_fget($conn,$target,$source,FTP_ASCII);ftp_close($conn);$a = file("target.txt");echo "<table border='1'><tr>";for ($i = 1; $i < count($a); $i++) {echo "<td>".$a[$i]."<br />"."</td><tr>"; }echo "</tr></table>";?>Banuiesc ca nu-ti trebuie mai mult.Mai posteaza daca ai nevoie... Quote
vkg Posted July 5, 2011 Author Report Posted July 5, 2011 Eroare:Warning: ftp_login() [function.ftp-login]: Login authentication failed in /home/dwdga/public_html/bans.php on line 6Warning: ftp_fget() [function.ftp-fget]: You aren't logged in in /home/dwdga/public_html/bans.php on line 8Warning: file() [function.file]: Unable to access home/gmisamp/195.225.59.100-7777/samp03/scriptfiles/FTGF/Logs/ban.log in /home/dwdga/public_html/bans.php on line 11Warning: file(home/gmisamp/195.225.59.100-7777/samp03/scriptfiles/FTGF/Logs/ban.log) [function.file]: failed to open stream: No such file or directory in /home/dwdga/public_html/bans.php on line 11Spunemi unde am gresit cu scriptul:<?php $source = "ban.log"; $target = fopen("target.txt", "w"); //Fisierul situat pe host-ul unde ai pus script-ul php $conn = ftp_connect("ftp.gamesiasi.ro") or die("Could not connect"); ftp_login($conn,"gmisamp","*******"); ftp_fget($conn,$target,$source,FTP_ASCII); ftp_close($conn); $a = file("home/gmisamp/195.225.59.100-7777/samp03/scriptfiles/FTGF/Logs/ban.log"); echo "<table border='1'><tr>"; for ($i = 1; $i < count($a); $i++) {echo "<td>".$a[$i]."<br />"."</td><tr>"; } echo "</tr></table>"; ?> cum il vezi mai sus exact asa lam pus, doar ca am pus parola aici am pus ****** sa nu afisez parola ! Quote
vkg Posted July 5, 2011 Author Report Posted July 5, 2011 Si fi atent am mai schimbat ceva la adresa FTP si acum imi da asa:Could not connect Quote
caii Posted July 5, 2011 Report Posted July 5, 2011 $a = file("scriptfiles/FTGF/Logs/ban.log"); Quote
vkg Posted July 6, 2011 Author Report Posted July 6, 2011 Tot nu mi se connecteaza nu stiu ce are , datele sunt corecte cu aceleasi date ma connectez la ftp cu un client, dar scriptul dc nu se connecteaza ?Ma mai ajuta cineva ? Quote
razer_krait Posted July 6, 2011 Report Posted July 6, 2011 Incearca sa scrii in loc de:ftp_fget($conn,$target,$source,FTP_ASCII);ftp_fget($conn,$target,$source,FTP_BINARY);Si in legaura cu conectarea scrie clar failed, poate n-ai ales scris link-u' bun stiu eu. Quote
vkg Posted July 6, 2011 Author Report Posted July 6, 2011 degeaba , nu se connecteaza la ftp, datele sunt bune dar dc ? Quote