Jump to content

mysql query


pgrevents

Recommended Posts

What i am trying to do is a login script that when the email address in the query shows the activated status at no redirects to a page and if yes continue login. now i kinda know the php but not the mysql query.

 

Heres how i think it would work

1. user logs in and sends post data to login.php

2. the email/username provided will be captured by $username

3. the mysql query searches database for that $username and colname'activated'

4a. if activated says no redirect to activate page

4b. if activated says yes continue log in .......

 

Is there a tutorial out there cause i have not found it yet. Or is my thinking so far past the line i cant see it :) any help would be greatly appreciated

 

thanks peeps

Link to comment
Share on other sites

$email_address = isset($_POST['email_address'])?mysql_real_escape_string($_POST['email_address'])?'';
$sql = "SELECT activated FROM table_name WHERE `email_address` = '{$email_address}' LIMIT 1";
$result = mysql_query($sql);
$activated = mysql_result($result, 0, 0);

if ($activated == "no") {
    header("Location: login.php");
}else {
    header("Location: loggedin.php");
}

 

Just a rough example of how it could be done. Hopefully that gets you going on your feet. If not google PHP Login Tutorial and you should find plenty of full out examples of how to do a login system.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.