1,075,659 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by amd_k8 which have been Voted Up

Thats javascript, PHP is server side language, which runs only when it's requested.

And about the time comparison... I do want that you try for yourself, so make some effort, I will just outline the main concept.

I admit that you already have a table of players or something like that. The deal is to have a column in that table which holds the user logout time. (You simply execute a query which inserts the current timestamp generated by the date() function, when the user logs out).
When a user logs in, the time of last logout is requested from the users table and compares with current date and time.
So you have two dates, now use the mktime() to both dates and compare the results.
According to result do your changes to the profile.

All the function examples you will find on php.net

amd_k8
Light Poster
49 posts since Jan 2010
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0

You are selecting a picture rating for each photo right??
Then why all of your comparison you didn't put in the loop?

<?php 
 
$sql="SELECT * FROM photo WHERE type='current'";
$result = mysql_query($sql);

while($row=mysql_fetch_assoc($result))
{
	$rating =$row['votes'];

	if ($rating >= 0 && $rating <= 1) { $rate = "0"; }
	if ($rating >1 && $rating <= 2) { $rate = "../i/shtuki/rt1.gif"; }
	if ($rating >2 && $rating <= 3 { $rate  = "../i/shtuki/rt2.gif"; }
	if ($rating >3 && $rating <= 4) { $rate  = "../i/shtuki/rt3.gif"; }
	if ($rating >4 && $rating <= 5) { $rate  = "../i/shtuki/rt4.gif"; }
	if ($rating >5 && $rating <= 6) { $rate  = "../i/shtuki/rt5.gif"; }

	echo '<li>';
	echo '<img src="' .$row['path'] . '" class="phb"/>' .'<p>' . $row['user'] . '</p>';
	echo "<img src=\"$rate\">" ;
 
	echo '</li>';
}
?>

Next you could use more simpler if's, for example:

if ($rating == 2) { $rate = "../i/shtuki/rt1.gif"; }
		elseif ($rating == 3)  { $rate  = "../i/shtuki/rt2.gif"; }
		elseif ($rating == 4) { $rate  = "../i/shtuki/rt3.gif"; }
		elseif ($rating == 5)  { $rate  = "../i/shtuki/rt4.gif"; }
		elseif ($rating == 6)  { $rate  = "../i/shtuki/rt5.gif"; }
		else $rate = "0";
amd_k8
Light Poster
49 posts since Jan 2010
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0

If you are using utf-8 in meta tag, mention that all source files should be also saved in utf-8.

amd_k8
Light Poster
49 posts since Jan 2010
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0

Using urlencode() may solve the problem, but the thing is that plus and space signs in URL have the same value, they are not recomeded to use at all in URLs.

amd_k8
Light Poster
49 posts since Jan 2010
Reputation Points: 12
Solved Threads: 11
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page rendered in 0.0453 seconds using 2.48MB