Page 1 of 1

PHP Website Creator...Almost done!

Posted: Mon Feb 09, 2004 9:31 pm
by bumple
Ignore.

Posted: Mon Feb 09, 2004 9:38 pm
by qads
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..

Posted: Mon Feb 09, 2004 10:00 pm
by bumple
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?

Posted: Mon Feb 09, 2004 10:18 pm
by Illusionist
you could have a directory as the username and then in that directory an index.php file that contains something like:

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");
?>
Im %99.9 sure that will work!

Posted: Mon Feb 09, 2004 10:22 pm
by bumple
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?

Posted: Mon Feb 09, 2004 10:56 pm
by mahara
Well, I don't get the reason why you should do that way. It can be too risk, eg when you talk about security problem, you should implement who deserve accessing the directory. There's other things you should consider, including the complexity of implementing the code.

Posted: Tue Feb 10, 2004 12:16 am
by bumple
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.

Posted: Tue Feb 10, 2004 7:02 am
by BDKR
bumple wrote: 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.

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. :wink:

You can do it, but you're at that point where you need to start thinking for yourself.

Cheers,
BDKR

Posted: Tue Feb 10, 2004 6:14 pm
by qads
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.

Posted: Tue Feb 10, 2004 7:18 pm
by Straterra
Also, if he says he doesn't want a bla.php?user=bigtoe , can't he just use modrewrite?

Posted: Fri Feb 20, 2004 7:53 am
by bumple
Ignore.

Posted: Sun Feb 22, 2004 5:10 pm
by Gremlin
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

Posted: Sun Feb 22, 2004 6:22 pm
by John Cartwright
Bumple don't edit your posts and say ignore... maybe someone is having the same problem and wants to read up on it....

Posted: Mon Feb 23, 2004 12:35 am
by bumple
true dat foo

Posted: Mon Feb 23, 2004 5:28 am
by Derfel Cadarn
Phenom wrote:Bumple don't edit your posts and say ignore... maybe someone is having the same problem and wants to read up on it....
True: Bumple sucks! :twisted: :evil: :twisted:
This forumis to learn from mistakes or questions, not to irritate others!
:x :x