Jump to content

Recommended Posts

Hi,

I am using dreamweaver to develop a member area for a client's website. I need to check from the database if the person is logging on for the first time and redirect accordingly and then update the database so that it recognizes the person has logged on before. I am using php/mysql and have created am integer field called firsttime in my database and created my login page. I named the page the login goes to as redirect.php and have a code generated by dreamweaver to protect the page from unauthorized access. I am very new to this but understand the basics of what i want done. If someone could help me flesh it out I'd appreciate it.

1. Select the database

2. select firsttime from the database table where the username is still the session variable (Dreamweaver uses this $_SESSION['MM_Username'])

3. store the result of the query in a variable liek the result in the example below

4. check if the result is 1 (for an old user) and redirects to one.php or if the result is 0 (for a new user) and redirects to zero.php at the same time updating the firsttime field to 1 in this case.

 

Thats about it. I found this example in my search online but i don't know how to customize it to fit my needs. Will really appreciate the help

Regards.

 

 

<?php

 

$checkvisits = "SELECT firsttime FROM churchushers WHERE user=$user";

$result = mysql_query($checkvisits);

if($result <= "1"{

header("Location: first.php";

} else {

?>

I'd extend the user table with an enum, which would hold the "first login" status. Upon login I'd retrieve it from the database along with the username and other details, then (just) before redirecting I'd check its status. If it signaled that this was the first time the user was logging in, I'd update it to the new status, and send the user to the first time page.

Welcome to the forum danielatunrase!

 

Woooo Hoooo! I am not the new guy anymore.

 

The way I would do it is with a table called "members" and a session check. The session check would look like this.

 

<?php
session_start();
if (!isset($_SESSION['username'])) {
    header('Location: ../pages/login.php');
}
?>

 

For every user that doesn't have the 'username' set it will send them to a login page or the page you want to send your new users to. Of course you would have to send them to a create a membership page and script and a login page and script to use this method. If you are interested let me know and I will continue.

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.