#!/usr/bin/perl
###########################################################################
#    WWWThreads  - Interactive Discussion Forum
#    Rick Baker scream@screamingweb.com 
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
###########################################################################
  use lib '/home/simplew2/domains/forum.sportruck.com/public_html/cgi-bin';
  use wwwthreads;
  use strict;


# --------------
# Get the cookie
  my %cookie   = wwwthreads::get_cookie();


# --------------------
# Assign the variables
  my $Username = $cookie{'Username'};
  my $Password = $cookie{'Password'};

# ----------------------------------------------------------------
# If we already have a username and password, go to the start page.
  if(($Username) && ($Password)){

    wwwthreads::start_page ($Username, $Password,"","");
    wwwthreads::exit();

  }


# ---------------------------------------------------------
# We didn't get a username and password, so make them login.
  wwwthreads::send_header ("Please login");
  wwwthreads::table_header ("Please login");

  print qq~
    <table cellspacing=0 border=0 width=100% bgcolor=$wwwthreads::config{'tddark'}>
    <tr><td>
    Enter your Username and Password to login.  
    If you do not have a Username you can <a href="$wwwthreads::config{'cgiurl'}/newuser.pl">register one</a>.
     
    <form method=POST action = "$wwwthreads::config{'cgiurl'}/start_page.pl">
    <p>
    </td></tr><tr><td bgcolor=$wwwthreads::config{'tdlight'}>
    Username<br>
    <input type=text name = Username>
    <p> 
    Password<br>
    <input type=password name = Password>
    <p> 
    <input type=submit name=option value=Login>
    <input type=submit name=option value="I forgot my password">
    </form>
    </td></tr></table>
  ~;


# ---------------
# Send the footer
  wwwthreads::send_footer();
