Sublime directory Surf the web anonymous Pagerank Monitor


what does this line of ext_user_profile.php?

tomz
Wed 16 May 2007, 04:59 pm GMT +0200
$this->profile_id = (empty($_SESSION['is_rec'])) ? mysql_insert_id() : $ident; 

Coult you explain  detaily  what this line does?

thanks,
tom

tomz
Wed 16 May 2007, 07:34 pm GMT +0200
ok, it must be the same as:
x <x1 ? y : z
and it's the same as
if (x < x1 )
y
else
z

:-)


olaf
Wed 16 May 2007, 10:49 pm GMT +0200
$this->profile_id = (empty($_SESSION['is_rec'])) ? mysql_insert_id() : $ident; 

Coult you explain  detaily  what this line does?

thanks,
tom

thats short for if then else

tomz
Thu 17 May 2007, 11:14 am GMT +0200
ok, and what for a new iprofile_id needs to be set?

olaf
Thu 17 May 2007, 11:20 am GMT +0200
ok, and what for a new iprofile_id needs to be set?

sorry Tom, I can't follow you, please provide clear questions and code examples here

olaf
Thu 17 May 2007, 11:20 am GMT +0200
and don't mess with the class files!

tomz
Thu 17 May 2007, 12:50 pm GMT +0200
sorry Tom, I can't follow you, please provide clear questions and code examples here
I would like to understand the concept of how the user and the user row is identified. It seems to me that all this vars (id, users_id, session id, ident) are responsible for that but I have'nt got it until now.

Here is some code:
function save_profile_date($ident = "", $lang = "", ...) {

if (!empty($ident)) {

$sql = sprintf("UPDATE ...  $this->ins_string($ident, "int"), $_SESSION['user_id']);

} else {

$sql = sprintf("INSERT INTO %s (id, users_id, language, ..., NOW())",

..., $_SESSION['user_id'], $this->ins_string($lang), ...));

}

if (mysql_query($sql) or die (mysql_error())) {

$this->profile_id = (empty($_SESSION['is_rec'])) ? mysql_insert_id() : $ident;

...

}

}

function get_profile_data() {

$this->get_user_info();

$sql = sprintf("SELECT id, language, ... FROM %s WHERE users_id = %d", ... PROFILE_TABLE, $this->id);

$result = mysql_query($sql) or die (mysql_error());

if (mysql_num_rows($result) == 0) {

$this->the_msg = $this->extra_text(1);

return false;

} else {

$_SESSION['is_rec'] = true;

while ($obj = mysql_fetch_object($result)) {

$this->profile_id = $obj->id;

The var $ident seems to decide if an update or an insert record is processed, right?

But how is the user and the responsible table row identified?

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional