PDA

View Full Version : PHP Error.



MrPinkPanther
14-07-2009, 07:48 PM
Ive got this PHP code which creates a folder and copies certain files into it:

<?php
$Name = $_POST['User'];
mkdir ($Name, 0777);

copy('Names.php', $Name . '/Names.php');
chmod($Name . '/Names.php', 0777)

copy('ChangeText.php', $Name . '/ChangeText.php');
chmod($Name . '/ChangeText.php', 0777)

copy('Names.plist', $Name . '/Names.plist');
chmod($Name . '/Names.plist', 0777)

copy('Online.php', $Name . '/Online.php');
chmod($Name . '/Online.php', 0777)

copy('Online.txt', $Name . '/Online.txt');
chmod($Name . '/Online.txt', 0777)

copy('Position.php', $Name . '/Position.php');
chmod($Name . '/Position.php', 0777)

copy('Text.plist', $Name . '/Text.plist');
chmod($Name . '/Text.plist', 0777)

?>

But this error appears:

Parse error: syntax error, unexpected T_STRING in /home/camcreat/public_html/Newuser.php on line 8

Any help? What do I need to change?

Johno
14-07-2009, 07:52 PM
You have forgotten to add the ; on each of the chmod functions :)


<?php
$Name = $_POST['User'];
mkdir ($Name, 0777);

copy('Names.php', $Name . '/Names.php');
chmod($Name . '/Names.php', 0777);

copy('ChangeText.php', $Name . '/ChangeText.php');
chmod($Name . '/ChangeText.php', 0777);

copy('Names.plist', $Name . '/Names.plist');
chmod($Name . '/Names.plist', 0777);

copy('Online.php', $Name . '/Online.php');
chmod($Name . '/Online.php', 0777);

copy('Online.txt', $Name . '/Online.txt');
chmod($Name . '/Online.txt', 0777);

copy('Position.php', $Name . '/Position.php');
chmod($Name . '/Position.php', 0777);

copy('Text.plist', $Name . '/Text.plist');
chmod($Name . '/Text.plist', 0777);

?>

MrPinkPanther
14-07-2009, 08:09 PM
Oh crap yeh. Cheers! +Rep

Want to hide these adverts? Register an account for free!