FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


question about something really big..





Diablosblizz
I don't really know how to explain this because my friend needs it...but.. here I go.


I need a php script that will rename a directory (example : blah) to something else (example: blahblah). I also need something in that script to create a database, or a mysql table.

Okay now ill try to break it up if you don't understand it.

When the user registers, the script will rename a directory (example: Blah) to something different (example: blah blah). This script will do this without any errors, or any "Directory changed" text.

Again, while the users registers, the script will also make a database, or a table inside a database.
hexkid
Diablosblizz wrote:
I need a php script that will rename a directory (example : blah) to something else (example: blahblah). I also need something in that script to create a database, or a mysql table.


Have your friends review her needs.
Does she really want to change the directory name 1000 times if there are 1000 registered users?
Does she really need 1000 tables if there are 1000 registered users? Would it not be enough to have 1000 records in one table?

Anyway ... to rename a directory use the rename() function; to create a database, the SQL statement is "CREATE DATABASE newdbname" and to create a table the statement is "CREATE TABLE newtablename (... columns specification ...)".
There might be different options for different database engines; for MySQL check the 5.0 manual
Diablosblizz
Ugh, I don't know anything about php, and either does "she".. meh ill try..
Diablosblizz
Sorry to double reply but I tried this:

Im using this code:

Code:
<?php
rename('woot.php', 'w2oot.php');
?>


and I get this error:

Quote:
Warning: rename(woot.php,w2oot.php) [function.rename]: Permission denied in /home/diablos/domains/worldofbnet.frih.net/public_html/woot.php on line 2


What did I do wrong? I used the example from php.net..


Quote:
Does she really need 1000 tables if there are 1000 registered users? Would it not be enough to have 1000 records in one table?



"She" is hosting a mini hosting server on "her" computer.. so "she" needs to have different databases for different things, for example forums.
hexkid
LOL at the "she" stuff. Thanks for the chuckle Smile

Diablosblizz wrote:
Sorry to double reply but I tried this:

Im using this code:

Code:
<?php
rename('woot.php', 'w2oot.php');
?>


and I get this error:

Quote:
Warning: rename(woot.php,w2oot.php) [function.rename]: Permission denied in /home/diablos/domains/worldofbnet.frih.net/public_html/woot.php on line 2


What did I do wrong? I used the example from php.net..

You didn't do anything wrong Smile
As it happens, you need to lower the security for that file (and probably the directory it is on too).
When you look at the directory from DirectAdmin you'll see a 755 for Perm., right? To allow the script to change it, it should be 777.
BUT DON'T CHANGE public_html TO 777!!! If you need to change a directory permission, it's better to create a new directory and leave public_html alone.
So you'll end up
755 .../public_html
777 .../public_html/newdirectory
777 .../public_html/newdirectory/woot.php
Again, DON'T CHANGE public_html TO 777!!!


Diablosblizz wrote:
Quote:
Does she really need 1000 tables if there are 1000 registered users? Would it not be enough to have 1000 records in one table?



"She" is hosting a mini hosting server on "her" computer.. so "she" needs to have different databases for different things, for example forums.

ok ... creating databases and tables on the fly would be a good option (reread the MySQL manual).
Pay attention to security (who has access to what -- can user2 read data from user1?)
Related topics
UT2004 U like the game? Do u have any question post here.
Big Dbs
Uploading of big files is forbidden?
how much i s your house?
Question: Answers please.
Did the Big Bang just happen or did God make it happen?
Question
Flat file question
WILL universe ever end?
could online quizes be a big threat
what happened before the big bang?
Tsunami Question For Anyone
Question about King of Queens.
Boy in China born with second penis on his back
Dubai Celebrates Tallest Building in the World
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.