Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Having issues with PHP file renaming.
New Posts  All Forums:Forum Nav:

Having issues with PHP file renaming.

post #1 of 3
Thread Starter 
Ive been messing around for php for a while again and i managed to pull files from my archive for my minecraft mod, Cloakboard.
im working on an HTML version, ive already got a login system working, its just a matter of pulling the username and remaining the file to the players username.

Here is my script
my main issues is where to start, Help please?
post #2 of 3
Wouldn't doing something like this solve your issue?
Code:
$old = '/path/example.txt';
$new = '/path/'.$userName.'.txt';
rename($old, $new) or die("Unable to rename $old to $new.");
The files must be owned by the same user running the PHP script.

This might have all the info you need:
http://php.net/manual/en/book.filesystem.php
    
CPUMotherboardGraphicsRAM
i5 750 @ 3.6 P7P55 EVO Gtx 670 DC2T 8gb @1600 cas 9 @1.5v 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb + 3tb seagate none venomous-X + 2 P/P yate loons @5v 8 pro x64 + mint 14 cinnamon x32 
MonitorKeyboardPowerCase
PX2370 random Antec HPC-850 BX-500 aerocool 
MouseMouse PadAudio
CM Storm Spawn QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
    
CPUMotherboardGraphicsRAM
i5 750 @ 3.6 P7P55 EVO Gtx 670 DC2T 8gb @1600 cas 9 @1.5v 
Hard DriveOptical DriveCoolingOS
crucial m4 256gb + 3tb seagate none venomous-X + 2 P/P yate loons @5v 8 pro x64 + mint 14 cinnamon x32 
MonitorKeyboardPowerCase
PX2370 random Antec HPC-850 BX-500 aerocool 
MouseMouse PadAudio
CM Storm Spawn QcK+ Shure SRH 750DJ+FiiO E5 
  hide details  
Reply
post #3 of 3
Quote:
Originally Posted by EduFurtado View Post

Wouldn't doing something like this solve your issue?
Code:
$old = '/path/example.txt';
$new = '/path/'.$userName.'.txt';
rename($old, $new) or die("Unable to rename $old to $new.");
The files must be owned by the same user running the PHP script.
This might have all the info you need:
http://php.net/manual/en/book.filesystem.php

This,

I'd also like to add, that if this is a Linux server, you'll need to set appropriate permissions for the text files.
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
    
CPUMotherboardGraphicsGraphics
Intel Core i7 860 Asus P7P55D-E Pro MSI GTX560 Ti TwinFrozr II SLI MSI GTX560 Ti TwinFrozr II SLI 
RAMHard DriveHard DriveHard Drive
Corsair 8GB DDR3 1600MHz CL9 XMS3 (2 x 4GB) OCZ Vertex 3 SSD Western Digital Caviar Black 1TB 7200RPM 64MB C... Western Digital Caviar Green 1TB ~5900RPM 64MB ... 
Optical DriveCoolingOSMonitor
Lite-On 24x DVD-RW CoolerMaster V8 Windows 7 Professional SP1 3 x Samsung S22B350H 
KeyboardPowerCaseMouse
Ducky Shine II Corsair HX850 CoolerMaster Storm Enforcer Logitech M500 
Mouse PadAudio
Razer Goliathus Microsoft LifeChat LX 3000 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Having issues with PHP file renaming.