Jump to content

sandbox

Members
  • Posts

    8
  • Joined

  • Last visited

sandbox's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Issue #2 is still at hand. Any help would be much appreciated... Everybody in bed?
  2. 1. Exactly! I previously tried elseif statements but without rearranging the branches, and obviously without success. Now that I followed your advice, it's working perfectly. Thank you! 2. I am redoing the whole thing, so SHA512 it is. I'm just unsure about how best to implement this feature, both efficiently and securely.
  3. Sorry, I should have specified that. Each increase in stars loads a new image (e.g. *, **, ***, ****, *****), as opposed to placing one star next to the previous. As it stands, the stars are being outputted next to a new instance of the username, therefore forming something similar to this: user* user** user*** In terms of the salt, I know where you're coming from with both a static and dynamic salt being in the code, but I would still prefer the latter option. How exactly would I go about using the sign up date of a user as a salt? I'm not sure on how I would implement this feature on site registration, and then log in. Thanks for your time.
  4. 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.
  5. @Psycho - Thank you very much for the quick and helpful response/resolutions to my problem. I would have to agree, #2 seems like the best option of the 3 so I will go ahead with that one. Thanks once again for your time.
  6. Hi everyone, Okay, so I'm using the following code to extract my navigation pages from a DB and display them in the footer of the page. My aim is to add an " | " between each link which I have achieved, but as it stands, it also adds an " | " after the last result which is not the affect I'm looking for. Does anybody know a way in which to prevent this? Thanks for taking the time to help. <?php $sql = "SELECT * FROM `navigation` ORDER BY position ASC"; $qry = mysql_query($sql); confirm_query($qry); while ($res = mysql_fetch_array($qry)) { echo "<a href=\"{$res['url']}\">" . $res['page'] . "</a>"; echo " | "; } ?>
  7. @computermax2328 - I didn't even think to use HTML for this and that is certainly thinking outside of the box. I prefer to use PHP on this occasion, but thanks though. @peppericious - So simple! I'm kicking myself now! Many thanks.
  8. Hi, I'm new to the forums and would like to take this opportunity to say hello to everybody. I'm having a slight problem and was wondering if you kind folks could shed some light on it for me please. Basically, I am trying to add numbers, ascending from 1 to 50, to the left side of each persons username. The person with the highest gold amount would have 1. next to their name, then 2. for the second highest, and so forth. I'm thinking a for or foreach loop is the answer, but I cannot seem to get it right. $sql = "SELECT * FROM `users` ORDER BY `gold` DESC LIMIT 50"; $qry = mysql_query($sql); while ($res = mysql_fetch_array($qry)) { echo $res['username'] . " "; echo $res['gold'] . "<br /><br />"; } Thanks for your time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.