Page 1 of 1
Verifying Users
Posted: Fri Apr 08, 2005 2:52 pm
by anthony88guy
I have a small login membership area and only want certain viewers allowed to access the infomation. So if your a administrator of my site, i want you to be able to verify signed up users that arnt verified. How should i go about doing this? I was thinking about having a checkbox and you click that then it will verify all the users that have the check box checked. i.e
$username "check box"
$username "check box"
$username "check box"
$username "check box"
$username "check box"
$username "check box"
$username "check box"
|Submit|
Something like that, using foreach loops to display all the usernames and checkboxes.
Posted: Fri Apr 08, 2005 3:24 pm
by Chris Corbyn
Whats your criteria for verifying users? As in, surely there's not just a list of users with checkboxes and you just go "Yes, I'll verify you, and you, and you, Oh heck, I'll just verify you all without checking you're ok to verify..."

What makes a user ok to verify

Posted: Fri Apr 08, 2005 3:46 pm
by anthony88guy
Well it concerns a game, if you are part of a certain alliance then you may be verified. When you sign up you enter your stats link, so the username will be a link to their stats.
Posted: Fri Apr 08, 2005 3:53 pm
by John Cartwright
A simple, untested, way.
Code: Select all
<?php
$user = array('user1','user2','user3','user4','user5');
echo '<form action="" method="POST">';
foreach ($user as $newuser) {
echo '<input type="checkbox" name="users['.$newuser.']" value="checked"> '. $newuser .'<br />';
}
echo '<input name="" type="submit">
</form>';
if (!empty($_POST))
{
foreach ($_POST['users'] as $user => $value)
{
mysql_query("UPDATE `users` SET `verified` = 1 WHERE `username` = '".$user."' LIMIT 1 <br />");
}
}
?>
Edit | Updated, Tested.
Posted: Fri Apr 08, 2005 4:28 pm
by Burrito
I would make the checkbox name a "blank" array and put the values of the usernames in the value attribute.
ex:
Code: Select all
<input type="checkbox" name="users[]" value="<?=$username;?>"><?=$username;?>
then use your foreach loop to loop over the values to "confirm" them.
I've never seen it done the way Jcart suggested, but that doesn't mean much...It probably works as well

Posted: Tue Apr 12, 2005 2:04 pm
by anthony88guy
I am having trouble with the following code:
When i try and access the page, it never loads. It tries to but get caught somwhere.
Never Mind, i played around with the code, and now it works.
Posted: Tue Apr 12, 2005 8:44 pm
by anthony88guy
Sorry for the double post but it different questions then before. I have my code that displayes the users and the info i need to display in order to verify them. But now how do i actully verify them?
So i each user that is checked and when the form is submited then it should for each user update the status feild in the table to "1". I noticed Jcarts script their but how would i tie that in?