[Tool/Web/Other] [PHP] GetBan (display the banlist on your website)
#21

I get this error?

Код:
Parse error: syntax error, unexpected T_STRING in /home/aspire5630/domains/gaming.serverffs.com/public_html/sa-mp-site/bans.php on line 14
Reply
#22

Quote:
Originally Posted by aspire5630
I get this error?

Код:
Parse error: syntax error, unexpected T_STRING in /home/aspire5630/domains/gaming.serverffs.com/public_html/sa-mp-site/bans.php on line 14
Check your code for any characters that shouldn't be there, something like below would cause that error.

Код:
<?php

echo "value" a;

?>
Quote:
Originally Posted by CalgonX
Easy to make and is pretty CPU intensive in all honesty. MySQL is the way forward.
Or you could use CRON (which most hosting control panels use) and cache it every 10 minutes. If you're like me and dislike mySQL, then this is a suitable way of doing things. Of course, you'll have to edit the code a wee bit.
Reply
#23

that line 14 error is becuase its missing a semicolon , i got it too when i first uploaded this on here when i realized i accidently took it out (backspace = fail) , so just add it to the end of it.
Reply
#24

Hey can you help me out?



How do I make it look like this?
Reply
#25

Parse error: syntax error, unexpected T_STRING in /home/****/domains/*******/public_html/banlist.php on line 14
Reply
#26

Finally, since i dont now shit about php this can help!! i add the script, but no bans are shown.. Do we have to make that part ourself i aint good with html/php/java watever
Reply
#27

Quote:
Originally Posted by [mad
MLK (dino-host.net) ]
Quote:
Originally Posted by Boozmang
man i got all the FTP stuff right but i get this error.
Код:
Fatal error: Call to undefined function ftp_connect()
im kinda new to PHP so could you tell me what i did wrong?
thanks,

Boozman
Your doing something wrong were your defining the Hostname and Username/Password:

Код:
	$ftp_host = "serverhostname ex: could be a ip address"; //put the ip / hostname to your ftp here
	$ftp_user = "ftp login"; //put your login here
	$ftp_pass = "ftp password"; //put your password here
	$banfile = "samp.ban";
That bit.
I'd suggest learning PHP before giving others advice.
As stated by many users before, it really does surprise me that you run a hosting company, and more so that you're apparently coding a PHP panel for it, when you obviously don't have basic PHP knowledge (yes, basic, that error message isn't rocket science, yet you provide a completely incorrect answer showing no PHP skills/knowledge)
[/tinyrant]


Anyway, in reply to Boozmang's problem, if it hasn't been fixed already.

****** goes a long way, obviously since you're new to PHP you might have thought it would be better to post here first, however MLK is completely wrong, it's nothing to do with the values you've set as the hostname/username/password.

Hinted by the error message (Call to undefined function ftp_connect()), it's saying that "ftp_connect" (the PHP function used to connect to your FTP server) is an undefined function (in other words, the function can't be found).

This is usually because your web host (or, perhaps you) used/compiled a version of PHP without FTP enabled (I think the compile option is "--enable-ftp"). If you host it, ****** that error message and you'll find some useful information on how to enable it. If you have it hosted by a web hosting company, contact them (support ticket, email, etc.) and they should be able to enable it for you.

This will also help any other users having the same problem.


Quote:
Originally Posted by `DivX
Parse error: syntax error, unexpected T_STRING in /home/****/domains/*******/public_html/banlist.php on line 14
Check the post by Linx a few posts before, he has an answer which will hopefully help you, too:
Quote:
Originally Posted by Linx [Stunt Revolution
]
that line 14 error is becuase its missing a semicolon , i got it too when i first uploaded this on here when i realized i accidently took it out (backspace = fail) , so just add it to the end of it.
Congratulations to anybody who read this whole post, but I like to provide answers which actually explain the problem to prevent the same problem occurring again, hopefully you will have learnt something. :P

And Linx, great work on this, it's a really nice script.
Reply
#28

Quote:
Originally Posted by CJ101
Finally, since i dont now shit about php this can help!! i add the script, but no bans are shown.. Do we have to make that part ourself i aint good with html/php/java watever
it will return all the bans, thats what the last line does

echo nl2br($bans);

you can format it if you'd like to be layed out different as PureLuck wanted using some string functions, loops and array functions.

also @ evolution.
1. ty
2. if a 14 year old wants to run a hosting company its his/her choice, wether they know what "echo" does or not, and critizing it (as much as i see where your coming from and i hear it too), it will look like flame to a moderator and they will probably delete the post.

i know alot about mlk's situation with server technology and server sided coding, and although it is very basic (very very very basic) we have to remember we were all noobs at one point aswell, just most of us didnt run a hosting company lol. =)

@the guy talking about mysql :
wouldnt that techincally be less efficent because then you would need the plugin on your actual server.
Reply
#29

Now it gives me an 500 Internal Server Error.
Reply
#30

Couldnt connect to your ftp (check your settings!

I put the FTP setting correctly too... Dont i need a port?
Reply
#31

you fuck you thanks....

Код:
<?php
	
	$ftp_host = "adressftp"; //put the ip / hostname to your ftp here
	$ftp_user = "ftpname"; //put your login here
	$ftp_pass = "ftppassword"; //put your password here
	$banfile = "samp.ban";
	
	$con = ftp_connect($ftp_host) or die("Couldnt connect to your ftp (check your settings!");
	ftp_login($con, $ftp_user, $ftp_pass);
	ftp_get($con, "sampban.txt", $banfile, FTP_ASCII);
	ftp_close($con);
	
	$file = fopen("sampban.txt", "r");
	$bans = fread($file, filesize("sampban.txt"));
	fclose($file);
	
	echo nl2br($bans);

?>
Reply
#32


PHP код:
<?php
    
//GetBans by iLinx
    //October 11th/2009
    //Retrieves the samp banlist from your server and echos it back in a neat fashion.
    //Edited by ev0lution
    //October 24th/2009
    
$ftp_host ""//put the ip / hostname to your ftp here
    
$ftp_user ""//put your login here
    
$ftp_pass ""//put your password here
    
$banfile "samp.ban";
    
$con ftp_connect($ftp_host) or die("Couldnt connect to your ftp (check your settings!");
    
ftp_login($con$ftp_user$ftp_pass);
    
ftp_get($con"ban.txt"$banfileFTP_ASCII);
    
ftp_close($con);
    
$file fopen("ban.txt""r");
    
$bans fread($filefilesize("ban.txt"));
    
fclose($file);
    
// Now for ev0lution's hax0rz
    
$exploded explode("\n",$bans,1);      // Split all by new line
    
for($x=0;$x<count($exploded);++$x) {    // Loop through all lines
    
$pie explode(" ",$exploded[$x],1);  // Split line by the first space
    
echo $pie[1]."<br />";                // Echo the second part of the line then an HTML page break
  
}
?>
================================================== ==========================================

PHP код:
<?php
    
//GetBans by iLinx
    //October 11th/2009
    //Retrieves the samp banlist from your server and echos it back in a neat fashion.
    //Edited by ev0lution
    //October 24th/2009
    
$ftp_host ""//put the ip / hostname to your ftp here
    
$ftp_user ""//put your login here
    
$ftp_pass ""//put your password here
    
$banfile "service15/samp03/samp.ban";
    
$con ftp_connect($ftp_host) or die("Couldnt connect to your ftp (check your settings!");
    
ftp_login($con$ftp_user$ftp_pass);
    
ftp_get($con"ban.txt"$banfileFTP_ASCII);
    
ftp_close($con);
    
$file fopen("ban.txt""r");
    
$bans fread($filefilesize("ban.txt"));
    
fclose($file);
    
// Now for ev0lution's hax0rz
    
$exploded explode("\n",$bans,1);      // Split all by new line
    
for($x=0;$x<count($exploded);++$x) {    // Loop through all lines
    
$pie explode(" ",$exploded[$x],1);  // Split line by the first space
    
echo $pie[1]."<br />";                // Echo the second part of the line then an HTML page break
  
}
?>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)