HI everybody,
Okay, so I have two problems which I will outline as best I can. Any help with these issues would be very much appreciated.
#1. I have a 'gold' value in my 'users' table. The higher the amount the user has, the better the reward they get. As a reward for procuring gold, I want to affix images to their profile username based on the amount they have. For example, after reaching 100 gold, a single star will be affixed to their usename. After reaching 500 gold, 2 stars will be affixed, etc. I've tried a few different techniques, but I will just post my code below to demonstrate more clearly.
<?php
if (!$_SESSION) {
echo " ";
} else {
if ($user['gold'] >= 100) {
echo "<span class=\"center_text\">" . $user['username'] . "<img src=\"images/green_star_1.png\"></span>";
}
if ($user['gold'] >= 500) {
echo "<span class=\"center_text\">" . $user['username'] . "<img src=\"images/green_star_2.png\"></span>";
}
if ($user['gold'] >= 1000) {
echo "<span class=\"center_text\">" . $user['username'] . "<img src=\"images/green_star_3.png\"></span>";
}
if ($user['gold'] >= 2000) {
echo "<span class=\"center_text\">" . $user['username'] . "<img src=\"images/green_star_4.png\"></span>";
}
if ($user['gold'] >= 5000) {
echo "<span class=\"center_text\">" . $user['username'] . "<img src=\"images/green_star_5.png\"></span>";
}
}
?>
#2. I also have a question regarding salting passwords. Currently, I am using the 'sha1' hashing algorithm to protect my passwords, but for obvious reasons, this does not provide adequate protection. I would like to salt my passwords with that particular user's sign up date. How would I go about doing this? And how is 'sha1' rated in the world of hashing algorithms?
Any input to my topic would be greatly appreciated.
Thank you for taking the time.