daveoffy Posted December 3, 2008 Share Posted December 3, 2008 I want to make it so each member has a member/profile page that others can view. I know this requires a .htaccess and a PHP page in member-profile.php but can't seem to get it to work and I can't find anything online to help me. Can someone please point me in the right direction so I can get this working. Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/ Share on other sites More sharing options...
awpti Posted December 3, 2008 Share Posted December 3, 2008 RewriteRule /member/(.*)$ member-profile.php?member=$1 Roughly.. my syntax is probably off. Only use (.*) if you have no character limitations. If all users are purely alphanumeric and you want to (and should) enforce that.. use this: RewriteRule /member/([a-zA-Z0-9])$ member-profile.php?member=$1 Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/#findComment-704488 Share on other sites More sharing options...
daveoffy Posted December 3, 2008 Author Share Posted December 3, 2008 I am using RewriteRule /member/([0-9])$ member-profile.php?member=$1 because it is going to display by the member_id. How will I make it so it shows information of that member when people go to member-profile.php?member=$1 or whatever the member_id is? Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/#findComment-704499 Share on other sites More sharing options...
daveoffy Posted December 3, 2008 Author Share Posted December 3, 2008 I got it. For anyone looking how to do this also I will show you below .htaccess Options +FollowSymlinks RewriteEngine on RewriteRule /member_id/([0-9])$ member-profile.php?member_id=$1 change /member_id/ and ?member_id to what in the database you are using for the URL's of the members Than I used member-profile.php for the page so the code is below <?php {Connecting to Database stuff} $sql = "select * from members WHERE member_id = '{$_GET['member_id']}'"; $result = mysql_query ($sql); while ($row = mysql_fetch_array($result)) echo "{$row['member_id']}"; ?> I think you can edit that for your own use. Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/#findComment-704511 Share on other sites More sharing options...
awpti Posted December 3, 2008 Share Posted December 3, 2008 Don't forget to validate that. You can do that easily, since you're pulling data by an integer.. <?php if(ctype_digit($_GET['member_id'])): // do something else: // Fail - it's not an integer value! endif; Addendum: You don't need a while loop if you're only fetching 1 row of data. Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/#findComment-704725 Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 Don't forget to validate that. You can do that easily, since you're pulling data by an integer.. <?php if(ctype_digit($_GET['member_id'])): // do something else: // Fail - it's not an integer value! endif; Addendum: You don't need a while loop if you're only fetching 1 row of data. expanding on security, you should also use mysql_real_escape_string() Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/#findComment-704728 Share on other sites More sharing options...
redarrow Posted December 3, 2008 Share Posted December 3, 2008 If you learn session's then all them get's go to bed... it grate using all the php functions and mod_rewrite apache function but you only needed to use a session for the members id finished.... ill be honest when using mod_rewrite you really need to understand seo concept aswell .......... Only expressing my felling sorry....... Link to comment https://forums.phpfreaks.com/topic/135257-solved-member-pages-member-profileid/#findComment-704732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.