Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,677 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,206 people online right now. Registration is fast and FREE... Join Now!




User System Confusion

 
Reply to this topicStart new topic

User System Confusion

Xmod
post 4 Aug, 2007 - 03:28 PM
Post #1


New D.I.C Head

*
Joined: 19 Jan, 2007
Posts: 35


My Contributions


I am doing a script that will allowed users to register and have a blog my question is how can i make the script to read the right info from header for example I know how to make php to read and pull down the info from something (header) like this http://url/blog.php?u=Xmod but I want to make it like this so it is an easier url http://url/Xmod ??? If you have examples or even recommend me a good tutorial I will apreciated thanks smile.gif i'm just confused right now and I cant anything working.
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 4 Aug, 2007 - 03:51 PM
Post #2


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,933



Thanked 118 times

Dream Kudos: 8525

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


You would want to look into mod_rewrite in PHP, this allows you to assign custom URL's then have them redirected to the appropriate place without changing he URL being shown in address bar.

I have also included a mod_rewrite cheat sheet (in pdf format) for you to look at.



Attached File(s)
Attached File  mod_rewrite_cheat_sheet.pdf ( 324.35k ) Number of downloads: 28
User is offlineProfile CardPM

Go to the top of the page

Xmod
post 4 Aug, 2007 - 05:22 PM
Post #3


New D.I.C Head

*
Joined: 19 Jan, 2007
Posts: 35


My Contributions


Ok look here is a bit of my code on how im actually doing it... (flog.php?u=xmod/) I really need some help to change it to this (xmod/) My Idea is when new users register to create a folder with their usernames and copy and paste flog.php (which actually would be index.php) into their folder and that would allow me to access to their data. but i dont want it to be xmod/index.php?u=xmod I want it to be xmod/index.php smile.gif

CODE

<?php require_once('config.php'); ?>
<?php
if (isset($_GET['u'])) {
$userName = $_GET['u'];
}
$q1 = "SELECT * from flogUser WHERE user_name = '$userName'";
$r1 = mysql_query($q1) or die(mysql_error());
$userInfo = mysql_fetch_array($r1);
?>
<html>
<title><?=$userInfo[user_title]?></title>
<body>
</body>
</html>


I am reading now more about mod_rewrite but it is the first time im actually using it... I havent find anything helpful yet buf if I do. I will update... smile.gif

This post has been edited by Xmod: 4 Aug, 2007 - 05:24 PM
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 4 Aug, 2007 - 06:05 PM
Post #4


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,933



Thanked 118 times

Dream Kudos: 8525

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


With mod_rewrite you can capture www.yoursite.com/xmod and forward them to www.yoursite.com/index.php?u=xmod but in the address bar www.yoursite.com/xmod will be showing (the user wont know they're not at the other URL).With mod_rewrite in the .htaccess file you could add

CODE

RewriteEngine On
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?u=$1


Now with this instead of typing yoursite.com/index.php?u=xmod you can type yoursite.com/xmod and both will take you to the same place. Remember this is done in .htaccess file
User is offlineProfile CardPM

Go to the top of the page

Xmod
post 4 Aug, 2007 - 09:36 PM
Post #5


New D.I.C Head

*
Joined: 19 Jan, 2007
Posts: 35


My Contributions


Thx! it works flatlessly! I had to do some changes on my http.conf because it wasnt allowing .htacces to be active it had this... AllowOverride None and i changed it to this AllowOverride All. that fixed everything now its letting .htaccess make the correct changes biggrin.gif
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 4 Aug, 2007 - 10:05 PM
Post #6


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,933



Thanked 118 times

Dream Kudos: 8525

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


QUOTE(Xmod @ 4 Aug, 2007 - 10:36 PM) *

Thx! it works flatlessly! I had to do some changes on my http.conf because it wasnt allowing .htacces to be active it had this... AllowOverride None and i changed it to this AllowOverride All. that fixed everything now its letting .htaccess make the correct changes biggrin.gif


No problem, glad I could help. If you run into further problems feel free to open a new question and we will be here to help smile.gif

Happy Coding!
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 06:32AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month