SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Thread: Counter Thingy

  1. #1
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Counter Thingy

    Hey,
    I havea site about a local themepark whcih is to be reopneing for version 2 in a few weeks time. For version 3 i wish to have a brand new feature which will allow visitors to keep track of which rides they have been on at the park. How would i go about making a system like this where a visitor can create an account, log in, add rides by going throguh the guide and finding the page about tht ride and then checking the "Ridden Box" and then when that user goes back to their main page it shows the details of all the rides which they have been on! I would love to try and get something like this set up and working but i needs some advice to get me going!

    Thanks

    Neil

  2. #2
    is_empty(2); foofoonet's Avatar
    Join Date
    Mar 2006
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should it show :
    - when the date ride was ridden?
    - how many times a ride was ridden?

    and therefore display
    - last ridden date
    - first ridden date
    - total number of rides for "User 123"

    And therefore stuff like:
    - total number of ride for "Ride #34"
    - most popular this week, most pop this month, most improved ride (month/month)
    - most popular when raining etc etc

    I mean is this the direction you want to head for eventually? (what is this anyway? interaction with hand-held devices?)
    Upgrading to Mysql 5? Auto-increment fields now strict
    use NULL
    Or zero or leave the field name out completely.

  3. #3
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    I do not wish to have any handheld integration and it is basically just a mini service to allow users to track which ones they have been on. And no i don# not wish to incorporate the dates parts into it.

    Thanks


    Neil

  4. #4
    is_empty(2); foofoonet's Avatar
    Join Date
    Mar 2006
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.devshed.com/c/a/PHP/Creat...-Login-Script/

    That was no#1 from google with a search for "php login".

    you want to log your user in, and give them a list of rides with a checkbox next to rides.

    They click a checkbox, you store the number of the ride next to the name. Sorted.
    Upgrading to Mysql 5? Auto-increment fields now strict
    use NULL
    Or zero or leave the field name out completely.

  5. #5
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The thing is i have pages in an area of the site called the park guide. From the park guide the visitors can choose a ride name to view more information about. I want a small section on these ride pages to appear if a user is logged in with a checkbox wheich the user can check if they have ridden it. When they click the submit button then the rideid which is a variable on that page would be placed in the users table under rideids so if they rideids field is empty then it would place a single number. If there is already a number present then a "|" would be placed before the new ride id to split the numbers up and then when i need to view a list of rides which the user has ridden then i can explode the "|"'s from the field to get separate numbers. The idea is to have apage where the user is taken to after they have logged in and it will give them a list of rides which they have ridden and what the area is where they have ridden the most rides as all rides belong to a certain area. The are on the ride pages where they can check the "ridden" box needs to change to something like "You have ridden this ride" once they have checked the box, submited it and then returned to that page a while later.

    Thanks

    Neil

  6. #6
    is_empty(2); foofoonet's Avatar
    Join Date
    Mar 2006
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you would make a login script, upon successful login, you would perhaps set a cookie. If the user has that cookie set, then show them the new options box.

    On your table structure is sounds as if you are placing more importance on the rides ridden that you originally said, "it will give them a list of rides which they have ridden and what the area is where they have ridden the most rides as all rides belong to a certain area." in that case you would benefit from creating a referential table.
    person_rides
    =========
    person_ref | ride_ref
    23 | 7
    23 | 6

    meaning person id 23 has ridden rides 6 and 7.

    Then you can create an area table so that:
    rideAreas
    =======
    area_id, description
    1 ""By the lake"

    Then create a referential table:
    rides_rideAreas
    ===========
    area_ref | ride_ref
    1 | 6
    1 | 7

    so then you would be able to see that person 23 rode on 2 rides, 6 and 7 and that they were both by the lake.

    (its just that when you go to that much trouble, why not create a timestamp field, you never know...... )
    Upgrading to Mysql 5? Auto-increment fields now strict
    use NULL
    Or zero or leave the field name out completely.

  7. #7
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do you mean a timestamp field? Also i have the ride and area tables already set up and working so basicallyt i am just trying to add the person part, Thanks for helping. What i do need to know though is when i user is logged in how do i make it so that when i logged in user goes to another page and another and browses the site then when he comes to mark a ride as ridden then he is still logged in?

    Thanks

    Neil

  8. #8
    is_empty(2); foofoonet's Avatar
    Join Date
    Mar 2006
    Posts
    1,000
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once logged in successfully, use a header(Location:$X) to send them to your home page.

    They use the same pages as everyone else sees, its just that they see extra-stuff, becuase they have a cookie set.

    if(isset($_cookie[cookieName]){
    //show rides form
    }
    Upgrading to Mysql 5? Auto-increment fields now strict
    use NULL
    Or zero or leave the field name out completely.

  9. #9
    SitePoint Wizard bronze trophy bigalreturns's Avatar
    Join Date
    Mar 2006
    Posts
    1,295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think from reading your posts that your problem comes down to how to keep a user logged in, even if they go to a different page?
    If I'm right then sessions is what you want. You instruct PHP to create a file on the server, holding information about the user. This is identified to the user by a unique session id. This session id is also stored automatically on the users machine with a cookie, so the right information on the server is identified to the right user.
    It sounds complicated but its really easy to implement. Firstly, on EVERY page that you want the user to be logged in on (easier I find to just make it every page full stop) you need to put at the top of the PHP, before ANY output, the code:

    PHP Code:
    session_start(); 
    Now you've created the cookie and server file about for this user. You can then set information into the session using:
    PHP Code:
    $_SESSION['bitofinfo']=valueofinfo
    just like you would with any other array, and retrieve the information in a similar fashion.
    The way I generally implement it is to have $_SESSION['username'] and $_SESSION['logged']. Username obviously holds the username, and logged can be 1 or 0 to reflect logged in state. So now you make a form and login script that update these accordingly.
    Then, on one of your ride pages, you could selectively show the "ridden?" checkbox to only logged in users, by using:
    PHP Code:
    IF ($_SESSION['logged']==1) {
    //echo checkbox

    Then when you want to update, you use the value from $_SESSION['username'], and insert it (or the id derived from it) into a table, along with the ride id.
    As a final note, there are ways to hijack other users sessions, and get the information in them. SEcurity measures you should use (and theres probably more!) are to never store an unencrypted password in a session variable, and to confirm the users password if you need to do something sensitive, such as change password.
    Hope this is what you were asking or I've just wasted 10 minutes!!

    Alex

    PS When I go to Alton Towers I ride everything except the pansy rides!
    "The proper function of man is to live - not to exist."
    Get a Free TomTom


  10. #10
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heya,
    That is exactly what i am after. Thanks so muc for taking the time to esplain it to me, most appreciated. My mate has written his own forum software script and he has sent me the files to have a look at so i am going to be using the same code but slightly edited for my user registration area and then i shall combine that with the info you gave above. I just need to find out how he has set the db table up so i can create a similar structure. The registration script includes many erro checks to see if the password and reentered password are equal, whether all fields have been filled in and it also encrypts the password before entering it into the database.

    Thanks so much for your help and time.

    Neil

  11. #11
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Here is the code that my mate showed me to help for the registration stuff. How could it be modified to work with the sessions stuff above? I have also included the logging in code and want to know the same?

    Thanks

    Neil

    Registering Code:
    PHP Code:
    // Registering Stuff
    if($_GET['act'] == 'register'){
        if(
    $_GET['mode'] == 'new'){
            include 
    "includes/register.php";        
        } else if(
    $_GET['mode'] == 'complete'){
        echo 
    "<div id=padding>";
        echo 
    "<div id=main>";
        echo 
    "<div id=td1>";
            if(!
    $_POST['register']){
                echo 
    "You haven't gone through the registration process, try again.";
            } else {
                
    // Some variables for what the user sends
                
    $username $_POST['user'];
                
    $password $_POST['password'];
                
    $cpassword $_POST['cpassword'];
                
    $email $_POST['email'];
                
    $agree $_POST['agree'];
                
    // If any fields are left out
                
    if($username == NULL || $password == NULL || $cpassword NULL || $email == NULL || $agree == NULL){
                    echo 
    "You missed out a required field";
                } else {
                    
    $password $_POST['password'];
                    
    $cpassword $_POST['cpassword'];
                    
    // If the passwords do not match
                    
    if($password != $cpassword) {
                        echo 
    "Passwords do not match";
                    } else {
                        
    // This encrypts the password
                        
    $password md5($password);
                        
    // Checking if username/email allready exists in the DB
                        
    $checkname mysql_query("SELECT username FROM f_users WHERE username='$username'");
                        
    $checknamemysql_num_rows($checkname);
                        
    $checkemail mysql_query("SELECT email FROM f_users WHERE email='$email'");
                        
    $checkemail mysql_num_rows($checkemail);
                        if (
    $checkemail || $checkname 0) {
                            echo 
    "The username or email is already in use";
                        }  else {
                            
    $username htmlspecialchars($username);
                            
    $password htmlspecialchars($password);
                            
    $email htmlspecialchars($email);
                            
    $add_user mysql_query("INSERT INTO f_users SET id='NULL', username='$username', password='$password', email='$email'");
                            echo 
    "$register[0]";
                        }
                    }
                }
            }
        echo 
    "</div></div></div>";
        }

    Logging In Code:
    PHP Code:
    // The logging in stuff
    if($_GET['act'] == 'login'){
        include 
    "includes/login.php";
        if(
    $_GET['submit'] == 'true'){
        echo 
    "<div id=\"padding\"><div id=\"main\"><div id=\"td1\">";
            if(
    $_POST['login']) {
                
    $username $_POST['username'];
                
    $password md5($_POST['password']);
                
    $info_query mysql_query("SELECT * FROM f_users WHERE username='$username'") or die(mysql_error());
                
    $info_row mysql_fetch_array($info_query);
                if(
    $info_row['password'] != $password) {
                    echo 
    "Incorrect username or password!";
                } else {
                    
    $user_query mysql_query("SELECT * FROM f_users WHERE username='$username'") or die(mysql_error());
                    
    $user_row mysql_fetch_array($user_query);
                    
    setcookie("id"$user_row['id'],time()+(60*60*24*5), "/""");
                    
    setcookie("pass"$user_row['password'],time()+(60*60*24*5), "/""");
                    echo 
    "You're now successfully logged in. Use the links at the top to navigate around";
                }
            }
        echo 
    "</div></div></div>";
        }


  12. #12
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Heya,
    Foget my last post. I have tried it myself and having a few problems but getting there. I will post again soon to let you know how i am getting on

    Thanks

    Neil

  13. #13
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Right, Here goes. So far i have got a few things going and it sort of works and sort of doesn't.

    Let me first show you the code of all the neccessary pages.

    ridetracker.php:
    PHP Code:
    <?php
    include "first.php";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
        <title>::Alton Towers Mania:: - Ride Tracker</title>
        <link rel=stylesheet type="text/css" href="style.css">
        <style type="text/css">
    <!--
    .style1 {
        font-family: Arial, Helvetica, sans-serif;
        color: #000000;
    }
    .style2 {color: #000000}
    .style3 {font-family: Arial, Helvetica, sans-serif}
    -->
        </style>
    </head>

    <body background="img/background.jpg" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">

    <center><table width="765" height="100%" cellpadding="0" cellspacing="0" border="0" background="img/mainbackground.jpg"><tr valign="top"><td><table width="764" height="42" border="0" cellpadding="0" cellspacing="0" background="img/left1bg.jpg">
        <tr valign="top">
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><div align="center"><?php
    require "header2.php";
    ?></div></td>
              </tr>
            </table></td>
          </tr>
        
    </table>

    <table width="764" height="506" border="0" cellpadding="0" cellspacing="0">
        <tr valign="top">

          <td width="150" height="324"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><?php
    require "nav.php";
    ?></td>
            </tr>
          </table>
            <!-- menu below, copy and paste the menudivider.jpg code as necessary -->
              <!-- the &nbsp; is code for a one letter space -->
            <!-- end menu --></td>
          <td width="9">&nbsp;</td>
    <td width="596">

      <p align="justify">
        <!-- add your content below -->
        <span class="style2"><BR>
          <span class="style3">Welcome to the Alton Towers Mania Ride Tracker. Using this you can keep track of which rides you have been on at the park and which ones you haven't. Please <a href="login.php">log in</a> or <a href="register.php">register</a> if you haven't done so already.</span></span></p>
     
      <p align="justify">
      <!--###############################################################-->
      <?php
      
    IF ($_SESSION['logged']=="1") { 
      echo 
    $_SESSION['username'];

    echo 
    "<br />";

    // The logging out stuff
    IF ($_SESSION['logged']=="1") {
    echo 
    "<a href=\"ridetracker.php?act=logout\">Log Out</a>";
    }

    if(
    $_GET['act'] == 'logout'){
        
    //$_SESSION['username']="";
        //$_SESSION['logged']="0";
        
    unset($_SESSION['username']);
        unset(
    $_SESSION['logged']); 


        echo 
    "<center><p>You are now logged out from the ride tracker.</p></center>";
    }    
    ?>
      
      <!--###############################################################-->
      </p>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center">
          <?php
    require "footer.php";
    ?>
        </div></td>
      </tr>
    </table></td>
    <td width="8">&nbsp;</td>
        </tr>
    </table>
    </td></tr></table></center>
    </body>
    </html>
    register.php:
    PHP Code:
    <?php
    include "first.php";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
    <link rel="shortcut icon" href="http://www.atmania.com/atm.ico">
        <title>::Alton Towers Mania:: - Oblivion Simulator</title>
        <link rel=stylesheet type="text/css" href="style.css">
    </head>

    <body background="img/background.jpg" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">

    <center><table width="765" height="100%" cellpadding="0" cellspacing="0" border="0" background="img/mainbackground.jpg"><tr valign="top"><td><table width="764" height="42" border="0" cellpadding="0" cellspacing="0" background="img/left1bg.jpg">
        <tr valign="top">
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><div align="center"><?php
    require "header2.php";
    require 
    "db.php";
    ?></div></td>
              </tr>
            </table></td>
          </tr>
        
    </table>

    <table width="764" height="506" border="0" cellpadding="0" cellspacing="0">
        <tr valign="top">

          <td width="150" height="324"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><?php
    require "nav.php";
    ?></td>
            </tr>
          </table>
            <!-- menu below, copy and paste the menudivider.jpg code as necessary -->
              <!-- the &nbsp; is code for a one letter space -->
            <!-- end menu --></td>
          <td width="9">&nbsp;</td>
    <td width="596">

      <p>
        <!-- add your content below -->
        <BR>
          <BR>
          <!--########################################-->
          <?php  
      
    // Registering Stuff
            
    require "registerform.php";
            if(
    $_GET['act'] == 'registerdone'){
            if(!
    $_POST['register']){
                echo 
    "<center><p>You haven't gone through the registration process, try again.</p></center>";
            } else {
                
    // Some variables for what the user sends
                
    $username $_POST['user'];
                
    $password $_POST['password'];
                
    $cpassword $_POST['cpassword'];
                
    $email $_POST['email'];
                
    $agree $_POST['agree'];
                
    // If any fields are left out
                
    if($username == NULL || $password == NULL || $cpassword NULL || $email == NULL || $agree == NULL){
                    echo 
    "<center><p>You missed out a required field</p></center>";
                } else {
                    
    $password $_POST['password'];
                    
    $cpassword $_POST['cpassword'];
                    
    // If the passwords do not match
                    
    if($password != $cpassword) {
                        echo 
    "<center><p>Passwords do not match</p></center>";
                    } else {
                        
    // This encrypts the password
                        
    $password md5($password);
                        
    // Checking if username/email allready exists in the DB
                        
    $checkname mysql_query("SELECT username FROM atm_users WHERE username='$username'");
                        
    $checknamemysql_num_rows($checkname);
                        
    $checkemail mysql_query("SELECT email FROM atm_users WHERE email='$email'");
                        
    $checkemail mysql_num_rows($checkemail);
                        if (
    $checkemail || $checkname 0) {
                            echo 
    "<center><p>The username or email is already in use</p></center>";
                        }  else {
                            
    $username htmlspecialchars($username);
                            
    $password htmlspecialchars($password);
                            
    $email htmlspecialchars($email);
                            
    $add_user mysql_query("INSERT INTO atm_users SET id='NULL', username='$username', password='$password', email='$email'");
                            echo 
    "$register[0]";
                        }
                    }
                }
            }
        }    
        echo 
    "</div></div></div>";
        

    ?>
    <!--########################################-->
      </p>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center">
          <?php
    require "footer.php";
    ?>
        </div></td>
      </tr>
    </table>
    </td>
    <td width="8">&nbsp;</td>
        </tr>
    </table>
    </td></tr></table></center>
    </body>
    </html>
    registerform.php - include file:
    PHP Code:
    <form action="register.php?act=registerdone" name="register" method="post">

    <
    table width="65%" border="0" cellspacing="0" cellpadding="0" align="center">
      <
    tr>
        <
    th colspan="2"><div id="th1">
          <
    div align="left">
            <
    p>Asterisk(*) Indicates required field. </p>
          </
    div>
        </
    div></th>
      </
    tr>
      <
    tr>
        <
    td width="50%" height="20" valign="middle"><div id="register_td1">Username*:</div></td>
        <
    td width="50%" height="20" valign="middle"><div id="register_td2">
          <
    input name="user" type="text" id="user" value="" size="30" />
        </
    div></td>
      </
    tr>
      <
    tr>
        <
    td width="50%" height="20" valign="middle"><div id="register_td1">Password*:</div></td>
        <
    td width="50%" height="20" valign="middle"><div id="register_td2"><input name="password" type="password" id="password" size="30" maxlength="100">
        </
    div></td>
      </
    tr>
      <
    tr>
        <
    td width="50%" valign="middle"><div id="register_td1">Password
          Again
    *:</div></td>
        <
    td width="50%" height="20" valign="middle"><div id="register_td2"><input name="cpassword" type="password" id="cpassword" size="30" maxlength="100">
        </
    div></td>
      </
    tr>
      <
    tr>
        <
    td width="50%" valign="middle"><div id="register_td1">Email*:</div></td>
        <
    td width="50%" height="20" valign="middle"><div id="register_td2">
          <
    input name="email" type="text" size="40" maxlength="100">
        </
    div></td>
      </
    tr>
        <
    tr>
        <
    td colspan="2" valign="middle"><fieldset>
        <
    legend>Accept Agreement</legend>
        
    Before clicking submitmake sure you have read the ride tracker <a href="index.php?act=toc">terms
        
    and conditions</a>, and then check the box to accept<br>
        <
    input name="agree" type="checkbox" value="check">
        
    I Agree To <a href="index.php?act=toc">Terms And Conditions</a> *

            </
    fieldset></td>
      </
    tr>
      <
    tr>
        <
    td colspan="2" valign="middle"><input name="register" type="submit" value="Register Now!"><input name="reset" type="reset" value="Reset Form"></td>
      </
    tr>
    </
    table>

    </
    form
    login.php:

    PHP Code:
    <?php
    include "first.php";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
        <title>::Alton Towers Mania:: - Ride Tracker</title>
        <link rel=stylesheet type="text/css" href="style.css">
        <style type="text/css">
    <!--
    .style1 {
        font-family: Arial, Helvetica, sans-serif;
        color: #000000;
    }
    .style2 {color: #000000}
    .style3 {font-family: Arial, Helvetica, sans-serif}
    -->
        </style>
    </head>

    <body background="img/background.jpg" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">

    <center><table width="765" height="100%" cellpadding="0" cellspacing="0" border="0" background="img/mainbackground.jpg"><tr valign="top"><td><table width="764" height="42" border="0" cellpadding="0" cellspacing="0" background="img/left1bg.jpg">
        <tr valign="top">
          <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><div align="center"><?php
    require "header2.php";
    ?></div></td>
              </tr>
            </table></td>
          </tr>
        
    </table>

    <table width="764" height="506" border="0" cellpadding="0" cellspacing="0">
        <tr valign="top">

          <td width="150" height="324"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><?php
    require "nav.php";
    ?></td>
            </tr>
          </table>
            <!-- menu below, copy and paste the menudivider.jpg code as necessary -->
              <!-- the &nbsp; is code for a one letter space -->
            <!-- end menu --></td>
          <td width="9">&nbsp;</td>
    <td width="596"><p>&nbsp;</p>
      <p align="justify">
      <!--###############################################################-->
    <?php  
      
    // The logging in stuff
        
    include "loginform.php";
        if(
    $_GET['submit'] == 'true'){
            if(
    $_POST['login']) {
                
    $username $_POST['username'];
                
    $password md5($_POST['password']);
                
    $info_query mysql_query("SELECT * FROM atm_users WHERE username='$username'") or die(mysql_error());
                
    $info_row mysql_fetch_array($info_query);
                if(
    $info_row['password'] != $password) {
                    echo 
    "<center><p>Incorrect username or password!</p></center>";
                } else {
                    
    $user_query mysql_query("SELECT * FROM atm_users WHERE username='$username'") or die(mysql_error());
                    
    $user_row mysql_fetch_array($user_query);
                    
                    
    $_SESSION['username']=$user_row['username'];
                    
    $_SESSION['logged']=1

                    
                    
    //setcookie("id", $user_row['id'],time()+(60*60*24*5), "/", "");
                    //setcookie("pass", $user_row['password'],time()+(60*60*24*5), "/", "");
                    
    echo "<center><p>You're now successfully logged in. Click <a href=\"ridetracker.php\">HERE</a> to go to your Ride Tracker homepage.</p></center>";
                }
            }
        echo 
    "</div></div></div>";
        }

    ?>  
      <!--###############################################################-->
      </p>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center">
          <?php
    require "footer.php";
    ?>
        </div></td>
      </tr>
    </table></td>
    <td width="8">&nbsp;</td>
        </tr>
    </table>
    </td></tr></table></center>
    </body>
    </html>
    loginform.php - include file:
    PHP Code:
    <div id="padding">
    <div id="main">
    <?php
    if (!$logged['username']){
    if (!
    $_POST['login']){
    ?>
    <form method="post" action="login.php?act=login&submit=true" title="login">
      <table width="65%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <th colspan="2" scope="col"><div id="th1"></div></th>
          </tr>
        <tr>
          <td width="50%"><div id="login_td1">Username:</div></td>
          <td width="50%"><div id="login_td2">
            <input name="username" type="text" size="30" maxlength="100">
          </div></td>
        </tr>
        <tr>
          <td width="50%"><div id="login_td1">Password:</div></td>
          <td width="50%"><div id="login_td2">
          <input name="password" type="password" size="30" maxlength="100">
          </div></td>
        </tr>
        <tr>
          <td colspan="2"><div align="left" style="padding: 2px;">
            <div align="center">
              <input name="login" type="submit" value="Log In">
              <input name="reset" type="reset" value="Reset">
            </div>
          </div></td>
          </tr>
        <tr>
          <td colspan="2"><fieldset><legend>Extra Information</legend><div align="center" style="padding: 2px;"><a href="register.php">Register Here, its free!</a><br>
            Forgotten your password? - Please send an email to us <a href="mailto:rctneil@aol.com">here</a> and we'll sort it out. </div>
          </fieldset></td>
          </tr>
      </table>
    </form>
    <?
    }
    } else {
    echo 
    "You have already logged in";
    }
    ?> 
    </form>
    </div>
    </div>
    Right, a few things, The start session code is in the first.php include file which is incuded at the top of every page. A user can register perfectly but when they click the submit button the page refreshes and then shows a message underneath but only the first letter of the message is displayed. And also for some reason i cannot even find out where the message whcih is meant to be displayed is in the actual code! The message should also be shown on a blank page with no form just like how the login successful message shows on a page on it's own without the login box above when you log in. The log in part works great and so do the sessions. The other problem is that if you try to log in and then immediately try to log out the page refreshes and you are still logged in and have to press logout again for a second time for it to actually work. Currently, you only know when your logged in as your username should appear on the ridetracker page along with the link to log out.

    Please try to help me with these two issues.

    Thanks

    Neil
    Last edited by rctneil; Jun 28, 2006 at 00:57.

  14. #14
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please someone try and help

    Thanks

    Neil

  15. #15
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also i need to know why the id is being set as null?

    Thanks

    Neil

  16. #16
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Forget my last messages as i have changed it all again.

    Thanks

    Neil


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •