Ok, im trying to use this script to process the stuff from a form then use it in the script. The script is suppose todo the following in this order.
1.Copy a plain txt document and rename it to the username specified by the user in the forum
2. Chmod the file to 777
3.Write in this stuff from the forum into the txt dcument
4.Rename the txt document turnning it into a bat
5. Echo a dl link.
Error is that i cant get it to use info from the post heres where u can see the current script in not so good action ive tryed multiple was but cant figure anyhting out.
hvc3.com/sbot3
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
$world = $_POST['world'];
$script = $_POST['script'];
$file = 'username.txt';
$newfile = $_POST['user']'.txt';
$filename = $newfile;
$somecontent = 'success';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
chmod($filename, 0777);
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, '@echo off
rem PARAMETERS
rem world=world number
rem username=autostart username
rem password=autostart password
rem autostart=autostart script command
java -cp sbot3.jar Bot world='$_POST['world']' "autostart='$_POST['script']'" "username='$_POST['user']'" "password="'$_POST['pass']'"
pause') === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
{
rename($filename, $_POST['user']'.bat');
}{
echo '<a href='$_POST['user']'.bat>Click Here to dl file</a>';
}
}
?>
please help