Jump to content

php forum question


chris_rulez001

Recommended Posts

in php, i am hoping to making a forum hosting system, how would you make it so i had this:

 

http://mysite/chosenforumname

 

would i have to use $_FILES or what?

 

this is a general equiry, i am asking how would i make it so when the person signs up and gives them their info, it creates a directory with their chosen forum name? do i need to use $_FILES to do this?

Link to comment
Share on other sites

not really what i am trying to do is get it so if a person goes to their own forum link which would be in the format of:

 

http://mysite/their forum name

 

but i dont want to put all the files into a folder, i want it to be in the root folder

 

example of how i dont want the link to be:

 

http://mysite/foldername/their forum name

 

does this make sence?

 

how would i make it so it worked from the root folder? using copy()? or some other method?

Link to comment
Share on other sites

you actually might not even want to do the mkdir completely.

 

What you will want to do is use an htaccess file.

 

it MUST have a file name of this: .htaccess - place it in the root directory

 

Then... in the file you would put this:

RewriteEngine On
RewriteRule ^http://mysite.com/(.*)$ index.php?username=$1 [nc]

 

you now don't have to make a directory, it will make a fake directory for you, then... all you have to do is type this in:

http://mysite.com/theirForum

When in reality it is actually doing this:

http://mysite.com/index.php?username=theirForum

 

 

then in your php code, you would write it the same as you would write normal php, so...

to echo the persons forum name all you need to do is this:

<?php
echo $_GET['username'];
?>

 

does that all make sense?

Link to comment
Share on other sites

its not working, its redirecting to my hosts page, help? its not actually going to the forum, when i type:

 

http://mysite.com/testforum

 

but when i go to:

 

http://mysite.com/index.php?username=testforum

 

it works. how do i get it so if you type: http://mysite.com/testforum it actually goes to it? i know i have to use .htaccess but i dont know exactly how to it via .htaccess? can someone point me in the right direction?

Link to comment
Share on other sites

im making a forum hosting service, i have a problem:

 

when i type the below its not actually going to the forum:

 

http://mysite.com/testforum

 

but when i type the below, it goes to the forum:

 

http://mysite.com/index.php?username=testforum

 

how do i get it so if you type: http://mysite.com/testforum it actually goes to your forum?

 

in my .htaccess file it says:

 

RewriteEngine On
RewriteRule ^/(.*)$ ^index.php?username=$1

 

can someone help me please?

Link to comment
Share on other sites

you actually might not even want to do the mkdir completely.

 

What you will want to do is use an htaccess file.

 

it MUST have a file name of this: .htaccess - place it in the root directory

 

Then... in the file you would put this:

RewriteEngine On
RewriteRule ^http://mysite.com/(.*)$ index.php?username=$1 [nc]

 

you now don't have to make a directory, it will make a fake directory for you, then... all you have to do is type this in:

http://mysite.com/theirForum

When in reality it is actually doing this:

http://mysite.com/index.php?username=theirForum

 

 

then in your php code, you would write it the same as you would write normal php, so...

to echo the persons forum name all you need to do is this:

<?php
echo $_GET['username'];
?>

 

ive tried this and it not working, can someone help me please?

Link to comment
Share on other sites

ok

 

.htaccess code:

 

RewriteEngine On
RewriteRule ^http://thunderboards.awardspace.co.uk/(.*)$ ^index.php?username=$1 [nc]

 

my php code:

 

<html>
<head>
<title>Message Board - Home</title>
</head>

<body>
<?php
$username = $_GET['username'];

if ($username == true)
{
echo "This is a forum";
}
else
{
echo "";
}
?>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.