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)
// 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

Need help making a script that moves data into acrhive table
Hi,

I'm kinda new to php/mysql

And i wrote a simple script to store sales lead for a b

Encrypt php code?
Is it possible to encrypt php code in files,
so that it displays a load of unreadable characters

Error in write byte array into document in SM58
Hi Gurus,

Getting the following error status in Transactional RFC (SM58) ..... *Error i

BI in Upstream Production operations
Appreciate if you can assist in the following areas:
1) Examples of life before and after BI i

values not being entered into table
hi. I;ve created a form, so that when a user enters data into it, it gets added to a table in a data

Database/Table Collation
What is the Database, and table collations used for? i don't understand what there used for since co

Automatically Detect Phone Model for WAP Jar Deployment
Making a wap site is fairly simple, but I'd like to know if there's a way to make it so that the wap

apart from cron
I need to run a php file every one hour. Is there any other solution apart from cron job?

Using CSS to format MySQL query
Hi,

If i want to have a news page on my site, which displays all records of a table in descen

using a loop help
Hi guys , i need some help. I have this loop :
while ($row = mysql_fetch_assoc($Result)) { ?&

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