How to get user id using php at a page added by ajax ?

Sultan

New member
I can get the id of that user which profile I'm visiting.
If I'm at the user's profile page who's id is 3

http://localhost/post/profile.php?id=3

I can get all information of the user 3. But on the same page I use some ajax and link it to another php file.
How can I get that user id on that page which is linked by the ajax?
Code is here.

profile.php

<html>
<head>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript" src="jquery.elastic.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Wall Post</title>
<script type="text/javascript">

......CODE HERE, I REMOVED DUE TO SHORT CHARACTER LIMIT...........

$.ajax({
type: "POST",

url: "status_update.php",

data: DATA,
cache: false,
success: function(data){
$(data).prependTo(".load_status_out").slideDown("slow");
$(".loading").hide();
$(".input_box").val("So what's on your mind?").css("color","808080").css("height","30px");
}
});
}
return false;
});
});
</script>
</head>
<body>
<?php
$uid = $_GET['id'];
$id = $_SESSION['id'];
$user = mysql_query(" SELECT * FROM users WHERE id = '$uid' ");
$user = mysql_fetch_assoc($user);
echo "<h1>User Information</h1>";
echo "<h3>".$user['firstname']." ".$user['lastname']."</h3>";
echo "<b>Email:</b>"." ".$user['email']."<br>";
echo "<b>Firstname:</b>"." ".$user['firstname']."<br>";
echo "<b>Lastname:</b>"." ".$user['lastname']."<br>";
echo "<b>Date of Birth:</b>"." ".$user['dob']."<br>";
echo "<b>Born at:</b>"." ".$user['dob']."<br>";
$sex = $user['sex'];
if($sex==1){
$sex = "Female";
}
else
$sex = "Male";
echo "<b>Gender:</b>"." $sex <br>";
echo "<b>ID:</b>"." ".$user['id']."<br>";
echo "<b>Viewer ID:</b>"." ".$id."<br>";
echo "<br>";
?>

<?php echo (isset($date)) ? $date : ""; ?>
<h1>Wall Posing</h1>
<div class="con">
<div class="pd">
<div class="share">Share:</div>
<div class="status">Status</div>
<div class="loading"></div>
</div>
<div class="img_top"></div>
<div class="text_status">
<textarea class="input_box">So what's on your mind?</textarea>
<div class="button_outside_border_blue" id="share">
<div class="button_inside_border_blue">
Share
</div>
</div>
<div class="clear"></div>
<div class="load_status_out"></div>
</div>
</div>
<?php

$Members = mysql_query(" SELECT id FROM users") or die(mysql_error());
$numRowsMembers = mysql_num_rows($Members);

$relate = mysql_query(" SELECT * FROM status WHERE user='$id' ");
$row = mysql_num_rows($relate);
for($count = 1; $count <= $row; $count++)
{
$get = mysql_fetch_array($relate);
$post_id = $get['id'];
$status = $get['status'];
$this_user = $get['user'];
$from_user = $get['from'];
$date = $get['date'];

$info = mysql_query(" SELECT * FROM users WHERE id='$from_user' ");
$inf = mysql_fetch_array($info);
$fname = $inf['firstname'];
$lname = $inf['lastname'];

//Line break after every 60
$status = wordwrap($status, 60, "<br />", true);

//Line breaks
$status=nl2br($status);

echo '<div class="load_status">
<div class="status_img">
<img src="img/arow.png" width="50px" height="50px" /></div>
<div class="status_text">
<a href="http://localhost/post/member_profile.php?id='.$from_user.'" class="blue">
'.$fname.' '.$lname.'</a>
<p class="text">'.$status.'</p>
<div class="date">'.$date.' ? <a href="#" class="light_blue">
Like</a> ? <a href="#"
 
Back
Top