Re: Login page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi;
PHP Code Here..
<?php
session_start();
if(isset($_SESSION["USERTYPE"]))
{
 if($_SESSION["USERTYPE"]=='a')
 {
 header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/admin_panel.php?");
 }
 else if($_SESSION["USERTYPE"]=='u')
  {
    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/user.php?");
   }
   else if($_SESSION["USERTYPE"]=='sa')
 {header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/superadmin.php?");}
  else if($_SESSION["USERTYPE"]=='in')
 {header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/gust.php?");}
  else if($_SESSION["USERTYPE"]=='g')
 {header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/main.php?");}
}


if (isset($_POST["txtPass"]))
        {
          require './classes/user.class.php';
          $obj=new admin;

  $result=$obj->checkLogin($_POST['txtUser'],$_POST['txtPass']);



 //print_r($result);
 if($result==null)
 {
 $error="<b>Login failure</b>";

 }
 else
 {
                    $_SESSION["USERTYPE"]=$result['usr_privilege'];
                     $smarty->assign("type",$_SESSION["USERTYPE"]);
                    $_SESSION["USERID"]=$result["usr_id"];
                    $_SESSION["USERNAME"]=$result["usr_name"];
                    $_SESSION["ISLOGIN"]=true;
                    $insertlogin="UPDATE users SET login = '1' WHERE usr_id
='".$result["usr_id"]."'";
                    mysql_query($insertlogin);
                                        $_SESSION["LOGIN"]='1';

                    if($result['usr_privilege']=="a")
                    {
                    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/admin_panel.php?");
                    exit;
                    }
                    else if($result['usr_privilege']=="sa")
                    {
                    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/superadmin.php?");
                    exit;
                    }
                    else if($result['usr_privilege']=="u")
                    {
                    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/user.php?");
                    exit;
                    }
                    else if($result['usr_privilege']=="su")
                    {
                    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/SuperUsers.php?");
                    exit;


            }
            else if($result['usr_privilege']=="in")
                    {
                    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/gust.php?");
                    exit;


            }
            else if($result['usr_privilege']=="g")
                    {
                    header("Location: http://
".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/main.php?");
                    exit;


            }
}
         }
         else
         {

         }

?>
Design HTML Code Here :
<table width="306" height="153" border="0" cellpadding="1" cellspacing="1">
          <tr>
            <td width="30" height="38"></td>
            <td colspan="2" align="center" valign="bottom"><span
class="style25">Users' Login </span></td>
            <td width="30"></td>
          </tr>
          <tr>
          <td colspan="4" align="center" class="error"> {$error  } </td>
        </tr>
          <tr>
            <td height="43">&nbsp;</td>
            <td width="70" align="left" valign="bottom"><span
class="style26">User ID</span> </td>
            <td width="176" align="left" valign="bottom"><input
name="txtUser" type="text" class="textfield_width" /></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="23">&nbsp;</td>
            <td align="left" valign="bottom"><span
class="style26">Password</span></td>
            <td align="left" valign="bottom"><input name="txtPass"
type="password" class="textfield_width" /></td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="33">&nbsp;</td>
            <td valign="top">&nbsp;</td>
            <td align="right" valign="bottom"><a href="#"
onclick="javascript:form1.submit();"><img  src="img/go_btn.gif" width="30"
height="31" border="0" /></a>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="30">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
SQL Query:
-- phpMyAdmin SQL Dump
-- version 2.10.1
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Sep 16, 2008 at 11:13 AM
-- Server version: 5.0.37
-- PHP Version: 5.2.2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

-- 
-- Database: `aka`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `users`
-- 

CREATE TABLE `users` (
  `usr_id` int(11) NOT NULL auto_increment,
  `usr_name` varchar(30) NOT NULL default '',
  `usr_email` varchar(40) NOT NULL default '',
  `usr_phone` int(10) NOT NULL default '0',
  `usr_address` varchar(100) NOT NULL default '',
  `usr_pwd` varchar(10) NOT NULL default '',
  `usr_privilege` enum('a','sa','u','in','g') NOT NULL default 'u',
  `usr_date` date NOT NULL default '0000-00-00',
  `usr_company` varchar(80) NOT NULL default '',
  `usr_chat_id` varchar(60) NOT NULL default '',
  `status` char(3) NOT NULL default 'no',
  `verify_code` varchar(10) NOT NULL default '',
  `login` tinyint(4) NOT NULL default '0',
  PRIMARY KEY  (`usr_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

-- 
-- Dumping data for table `users`
-- 

INSERT INTO `users` (`usr_id`, `usr_name`, `usr_email`, `usr_phone`,
`usr_address`, `usr_pwd`, `usr_privilege`, `usr_date`, `usr_company`,
`usr_chat_id`, `status`, `verify_code`, `login`) VALUES
(1, 'super', 'super@xxxxxxxxx', 2234324, 'super', 'super', 'sa',
'0000-00-00', 'super', '2345', 'no', '4656', 0),
(2, 'aa', 'aa@xxxxxxxxx', 34534, 'tret', 'aa', 'a', '2008-03-28', 'tert',
'', '', '', 1),
(3, 'bb', 'bb@xxxxxxxxx', 5454, 'rtr', 'bb', 'u', '2008-03-28', 'fgh', '',
'no', '62446', 0),
(4, 'cc', 'cc@xxxxxxxxx', 34534, 'cc', 'cc', 'u', '2008-03-28', 'sfsf', '',
'no', '74929', 0),
(5, 'dd', 'dd@xxxxxxxxx', 54645, 'ryrt', 'dd', 'u', '2008-03-28', 'hgfh',
'', 'no', '26334', 0);

On Tue, Sep 16, 2008 at 4:13 PM, Atkinson, Robert
<ratkinson@xxxxxxxxxxxxx>wrote:

>   Guess that should be http_redirect -
> http://uk2.php.net/manual/en/function.http-redirect.php
>
> -----Original Message-----
> From: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com> [mailto:
> php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com>] On
> Behalf Of jan
> Sent: 16 September 2008 11:46
> To: php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com>
> Subject: Re:  Login page
>
> wtf is "redirect"?
>
>
> ***********************************************************************************
> Any opinions expressed in email are those of the individual and not
> necessarily those of the company. This email and any files transmitted with
> it are confidential and solely for the use of the intended recipient
> or entity to whom they are addressed. It may contain material protected by
> attorney-client privilege. If you are not the intended recipient, or a
> person responsible for delivering to the intended recipient, be advised that
> you have received this email in error and that any use is strictly
> prohibited.
>
> Random House Group + 44 (0) 20 7840 8400
> http://www.randomhouse.co.uk
> http://www.booksattransworld.co.uk
> http://www.kidsatrandomhouse.co.uk
> Generic email address - enquiries@xxxxxxxxxxxxxxxxx<enquiries%40randomhouse.co.uk>
>
> Name & Registered Office:
> THE RANDOM HOUSE GROUP LIMITED
> 20 VAUXHALL BRIDGE ROAD
> LONDON
> SW1V 2SA
> Random House Group Ltd is registered in the United Kingdom with company No.
> 00954009, VAT number 102838980
>
> ***********************************************************************************
>
>  
>



-- 
Thanking You.
With Warm Regards.
Rajesh Gupta,
Software Developer,
SRM Techsol Pvt. Ltd.,
Lucknow-226024 (U.P.), INDIA
Mob.+91-9792681468
Web: http://www.stpl.biz


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux