Problem with php's rename function


Posted on 16th Feb 2014 07:03 pm by admin

So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempts to copy the users xml file(i stored all users information, in xml files as a backup of my database). They're all located in a folder named "xml", which is located in the root directory of my website, as is 'delete_user.php'. What i want to do is, that the file name is changed when the person's user account is deleted. Here's the code i've tried to do it with, i get an 'invalid directory / file error' when i try to run the script.

Code: <?php $path = "/xml/";
// you cannot see it here, but $login contains a username. (The username is the name of the file)
Did you know?Explore Trending and Topic pages for more stories like this.
// eg. an user named "sharal" would have an associated xml file named "sharal.xml"
// this is not exactly what i want it to do, but it simply renames the file with it's original name
// and adds "old" behind it
$file = $login;
$old = "old";
$new_path = $login . $old;

rename($path.$file.".xml", $path.$new_path.".xml"); ?>
No comments posted yet

Your Answer:

Login to answer
102 Like 9 Dislike
Previous forums Next forums
Other forums

Insert Failing.
Hey,
I am making a Sign up page for a website, but the insert query into the Database does not se

Undefined Index Notice In Internet Explorer Only
I am getting the following notice:

QuoteNotice: Undefined index: jrox in /home/ycsn/public_h

question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.

I hav

Help a newbee save my job !
Hey guys i am dying here i am new to php and would like for someone to help me with this problem

iMatch stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,

Need Successful Return
Hello I am currently working a form here, and I have everything figured out except when I click the

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

sql error
I have been looking at this code for 20mins and can't work out what I am doing wrong. There is somet

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash