hey guys
i use this link to go to a users profile
PHP Code:
<a href="<?php echo get_username($_SESSION['user_id']);?> ">
this basicly with the help of htaccess
PHP Code:
RewriteEngine on RewriteBase / RewriteRule ^([^/.]+)/?$ members/profile.php?username=$1 RewriteRule ^([^/.]+)/?$ members/profile.php?id=$1
makes is so you can go to the users profile and their data will appear
profile.php
Code:
<?php include '../index.php';?>
<?php
session_start();
require_once '../settings.php';
$query = "SELECT * FROM users WHERE Username = '$username' LIMIT 1";
if ($result = mysql_query($query)){
if (mysql_num_rows($result)) {
$array = mysql_fetch_assoc($result);
$pemail = $array['Email'];
$puser = $array['Username'];
$pid = $array['ID'];
$pfirst_name = $array['first_name'];
$plast_name = $array['last_name'];
$pabout_me = $array['about_me'];
$pevents = $array['events'];
$pgender = $array['gender'];
$pdob = $array['dob'];
$sql = "SELECT `ext` FROM `user_images` WHERE `user_id`='$pid' LIMIT 1";
?>
<title> <?php echo $puser; ?>'s profile</title><body>
<table width="100%">
<tr>
<td colspan="4">
<div class="c1">
<div align="center">
<p>Welcome to <?php echo $puser; ?>'s profile </p>
<p> </p>
</div>
</div> </td>
</tr>
<tr>
<td width="7%"> <?php $q = mysql_query($sql) or die("Error running query:".mysql_error());
if($q && mysql_num_rows($q) > 0) {
$row = mysql_fetch_array($q);
if(!empty($row)) {
echo "<img src='http://www.runningprofiles.com/members/images/thumbs/". $pid . "." . $row['ext'] . "'";
}
else {
echo 'no image';
}
}
?></td>
<td width="26%">i am <?php echo $pgender;?> and my bday is <?php echo $pdob; ?> </td>
<td width="45%"></td>
<td width="22%" bordercolor="#000000" bgcolor="#99b3b4"><p>Name: <?php echo $pfirst_name; ?><?php echo $plast_name; ?></p>
<p> </p>
<p>About me:</p>
<?php echo $pabout_me; ?></td>
</tr>
</table>
<?php
}
else
{
echo "<center>Sorry no users with that name can be found within our database </center><br />";
}
}
else
{
echo "Query failed<br />$sql<br />" . mysql_error();
}
?>
</body>
</html>
this all works fine.... but recently i have added this Code:
PHP Code:
<? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?>
but the code for this is http://www.mywebsite.com/members/index.php?section=(what ever the page)
so
<a href="?page= <?php echo get_username($_SESSION['user_id']);?> "> user</a>
i belive i have to chnage my mod rewrite to something like RewriteRule ^([^/.]+)/?$ members/index.php?page=?username=$1
to get it all to work :S:S
|