Hi this is my first script with php.
I have a game server that saves screenshots that I can access through ftp, so I have tried to make a script so other members of the clan can access the screenshots through a website.
but now I have problems because I dont know what next so far I have.
There are 3 file to this. But we shall try and do one at a time!
pbss.inc.php
<?PHP
$ftp_user_name = "****";
$ftp_user_pass = "****";
$ftp_server = "c*****";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to change the directory to somedir
if (ftp_chdir($conn_id, "servers")) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
} else {
echo "Couldn't change directory\n";
}
// try to change the directory to somedir
if (ftp_chdir($conn_id, "by_serverid")) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
} else {
echo "Couldn't change directory\n";
}
// try to change the directory to somedir
if (ftp_chdir($conn_id, "4364")) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
} else {
echo "Couldn't change directory\n";
}
// try to change the directory to somedir
if (ftp_chdir($conn_id, "Punkbuster Screenshots")) {
echo "Current directory is now: " . ftp_pwd($conn_id) . "\n";
} else {
echo "Couldn't change directory\n";
}
$file_open = fopen($conn_id) or die("Unable to open $pbsvss");
$line = fgets($file_open,1024);
$old = array("<p>", "<a href=", ".htm", "</a>");
$new = array("<p>·", "<b><a ONMOUSEOVER=\"status='Click to View this Screenshot';return true\" title=\"Click to View this Screenshot\" href=pbssview.php?pbss=", ".png", "</a></b>");
$text = str_replace($old, $new, $line);
echo "$text";
fclose($file_open);
?>
I look forward to your reply thanks