Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 07-19-2009, 07:28 AM   #1 (permalink)
Registered User
 
Join Date: Feb 2009
Posts: 28
OS: Windows Vista


Account Verification (PHP)

Hi all,

Just run myself into a problem with an account verification for a site I'm building.

The idea is that when a new member signs up, their account has to be verified by an admin before they can log in.

I have the database set up to accommodate this...with a 'verified' column (default value 0)

When the admin verifies them, this changes to 1...this all work fine.

However, I'm stumped on what is probably the easiest part - controlling the login page to redirect them elsewhere if their account is not verified...

I understand it is something along the lines of :

PHP Code:
$verified "SELECT verified FROM users WHERE username = '".$_POST['uname']."'";
    
  if (
$verified == 0){
  die(
'Your account is not verified');
  }

if (
$verified == 1){
die(
'The account is verified');

(EDIT: I know the 2nd 'if' isn't exactly needed...its just there to show what I'm trying to do!)

I know this could possibly be way off...the main problem of mine is pulling the 0 or 1 value from the database...

Any push in the right direction would be fantastic!

Cheers,

Colin

Last edited by colinhall; 07-19-2009 at 07:30 AM. Reason: none
colinhall is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 07-20-2009, 12:18 AM   #2 (permalink)
Troubled
 
Join Date: May 2009
Posts: 71
OS: Computer = WXP, Server = linux w/ php 5


Re: Account Verification (PHP)

huh, stumped as well
this is a beast script
calthephenom is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-20-2009, 09:32 PM   #3 (permalink)
Registered User
 
FredT's Avatar
 
Join Date: Nov 2007
Posts: 388
OS: Mac OS X 10.5.7 and XP SP2


Re: Account Verification (PHP)

Not sure what you're looking for... is this it?

PHP Code:
//In the database you need to make sure there are no duplicate usernames if you use this method!
$query "SELECT verified FROM users WHERE username = '".$_POST['uname']."'";
$execute mysql_query($query);
$result mysql_result($execute0);
     
if (
$result == '0'){ //if result cell is 0
     
header("Location: fail.html"); //redirect them to a page
     
die();
}

//rest of page continues 
FredT is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 04:33 AM   #4 (permalink)
Registered User
 
Join Date: Feb 2009
Posts: 28
OS: Windows Vista


Re: Account Verification (PHP)

PHP Code:
$result=mysql_query("select * from users where username='$user' AND password='$pass' AND verified='1'"$db); 

//check that at least one row was returned 

$rowCheck mysql_num_rows($result); 
if(
$rowCheck 0){ 

//register session + redirect to checklogin page 
That's what I came up with, and it works just fine!!
colinhall is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-19-2009, 08:08 PM   #5 (permalink)
Registered User
 
Join Date: May 2009
Posts: 31
OS: xp sp3


Re: Account Verification (PHP)

Hey guys, i'm trying to set up a mysql database where an account status automatically default to inactive or '0'. When a user registers, it sends them an email for them to verify, after verification, the account become active or '1'.

HELP PLEASEEEEEEEEE!!!!!

thanks alot guys!!!
randyrr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-20-2009, 02:59 PM   #6 (permalink)
Design Team Member
 
Redcore's Avatar
 
Join Date: Aug 2007
Location: Jamestown, CA
Posts: 718
OS: Linux Mint 7

My System

Re: Account Verification (PHP)

randyrr, you need to make your own thread rather than hijacking another one.

colinhall - so you got this squared away it looks like? On my authentication system I typically store a session variable that tells my system they're verified and if not, it sends them to the login page. It would be good to make a session token that you store in the database when they login and have each page authenticate that token/user/datetime combo (depending on your performance needs - there are alternative ways). It really depends on how sensitive your data is. I don't have to do this much because I develop for my own intranet system (not much "sensitive data"), so I have everyone authenticate against the Active Directory system and everyone is an employee, so not a lot of mistrust (I still take precautions not to get caught off guard by a disgruntled employee though, hah)
__________________
Free Resources
PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |
Web Design/Programming - KompoZer
(Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting |
Redcore is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-20-2009, 04:19 PM   #7 (permalink)
Registered User
 
Join Date: May 2009
Posts: 31
OS: xp sp3


Re: Account Verification (PHP)

orr, ohhk...thanks RedCore... :( didn't mean to intrude
randyrr is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 04:25 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85