PHP Website Creator...Almost done!
Moderator: General Moderators
PHP Website Creator...Almost done!
Ignore.
Last edited by bumple on Fri Feb 20, 2004 9:36 am, edited 1 time in total.
well, if it were http://www.<span style='color:red;text-decoration:blink' title='Alert a moderator!'>grilled spam</span>.com/index.php?username=bla then that would've saved you some time, you could've used theusername to find out the settingsinthe database and use 1 file to load it up...thats it, but with your setup you will need a script to make the /username/ dir.
look at [php_man]mkdir[/php_man] and [php_man]chmod[/php_man].
after you get the dir you need to make the file in that dir, look at
[php_man]fopen[/php_man] and [php_man]fwrite[/php_man]...
if you know how to do these and i am talking about something else for some weird reasn then please expline more, i dont really understand what you want php to do..
look at [php_man]mkdir[/php_man] and [php_man]chmod[/php_man].
after you get the dir you need to make the file in that dir, look at
[php_man]fopen[/php_man] and [php_man]fwrite[/php_man]...
if you know how to do these and i am talking about something else for some weird reasn then please expline more, i dont really understand what you want php to do..
well, the problem is, I want it to be easy to access...maybe not <span style='color:red;text-decoration:blink' title='Alert a moderator!'>grilled spam</span>.com/username/index.php....but users.<span style='color:red;text-decoration:blink' title='Alert a moderator!'>grilled spam</span>.com/username
Is there anyway I can do it like xanga...when you type in http://www.xanga.com/idiot ... it redirects you to http://www.xanga.com/home.aspx?user=idiot
is there any way to do that?
Is there anyway I can do it like xanga...when you type in http://www.xanga.com/idiot ... it redirects you to http://www.xanga.com/home.aspx?user=idiot
is there any way to do that?
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
you could have a directory as the username and then in that directory an index.php file that contains something like:
Im %99.9 sure that will work!
Code: Select all
<?php
header("Location: http://<span style='color:red;text-decoration:blink' title='Alert a moderator!'>grilled spam</span>.com/index.php?user=idiot");
?>The problem I must first overcome is creating that directory and index.php for the unique users...How would I do that?
First I would do something like: "mkdir $_SESSION['username']" (what should the chmod be here? I ONLY WANT THEM TO BE ABLE TO READ IT).
Then I would have to create an index.php in their folder...how would I do that?
First I would do something like: "mkdir $_SESSION['username']" (what should the chmod be here? I ONLY WANT THEM TO BE ABLE TO READ IT).
Then I would have to create an index.php in their folder...how would I do that?
alright...so how would i make my site work like xanga?
Is there anyway I can do it like xanga...when you type in http://www.xanga.com/idiot ... it redirects you to http://www.xanga.com/home.aspx?user=idiot
All it would do is fetch the information for somebody with the username "idiot"...it shouldn't be too complex.
Is there anyway I can do it like xanga...when you type in http://www.xanga.com/idiot ... it redirects you to http://www.xanga.com/home.aspx?user=idiot
All it would do is fetch the information for somebody with the username "idiot"...it shouldn't be too complex.
I don't want to be too harsh, but if it doesn't sound too complex, why are you asking? The reason I'm bothering is because it sounds more like you are asking someone to write this for you without coming out and saying as much.bumple wrote: All it would do is fetch the information for somebody with the username "idiot"...it shouldn't be too complex.
Which a lot of us feel is a big no no around here.
A couple of others gave you some good ideas and some mentioned some functions to use. All of them valid to one extent or another. Now it's up to you to take those ideas, put your thinking cap on and try to build something.
So go to the manual and check out the mkdir function for example. You'll also see that there are a good number of examples there on how to use it.
Go to google and search for examples on how to redirect pages. Google isn't too complex you know.
You can do it, but you're at that point where you need to start thinking for yourself.
Cheers,
BDKR
BDKR is right, i checked out this post few times to see if you made any prograss, my post gives you all the functions you need, along with the idea about what to do, even if you dont agree with my idea then there still options for you.
how to make user based dir upon regeisterion..
user submits form
validate it
make dir with [php_man]mkdir[/php_man] with $username as dir name...
use [php_man]chmod[/php_man] (0777), and write index.php useing [php_man]fopen[/php_man], [php_man]fwrite[/php_man] and [php_man]fclose[/php_man]
use chmod on the dir u just created and on index.php too (0755)
after confirming that the dir and index.php were made without any errors, do rest of your things like inserting user info in db.
if you need help with writeing files then check out [google]file manipulation with php[/google] @ google..
good luck.
how to make user based dir upon regeisterion..
user submits form
validate it
make dir with [php_man]mkdir[/php_man] with $username as dir name...
use [php_man]chmod[/php_man] (0777), and write index.php useing [php_man]fopen[/php_man], [php_man]fwrite[/php_man] and [php_man]fclose[/php_man]
use chmod on the dir u just created and on index.php too (0755)
after confirming that the dir and index.php were made without any errors, do rest of your things like inserting user info in db.
if you need help with writeing files then check out [google]file manipulation with php[/google] @ google..
good luck.
mod rewrite can turn http://www.foo.com?section=news&article=somenews&page=3 into
http://www.foo.com/news/somenews/3/
(or http://www.something.com?user=me into http://www.something.com/me, where the '/' isn't a directory reference but a placeeholder for the ?var=value pairs in the url, then have a script in the index page's code to check to see if $user is set, exists in the db, other security stuff then redirect to another page)
you simply need a logical and fairly constant variable set coming in via the url and a little bit of regexp experience.
Gremlin
http://www.foo.com/news/somenews/3/
(or http://www.something.com?user=me into http://www.something.com/me, where the '/' isn't a directory reference but a placeeholder for the ?var=value pairs in the url, then have a script in the index page's code to check to see if $user is set, exists in the db, other security stuff then redirect to another page)
you simply need a logical and fairly constant variable set coming in via the url and a little bit of regexp experience.
Gremlin
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany