<?
    session_start();
    
    if ($_SERVER['REQUEST_METHOD'] == "POST")    
    {
        $_SESSION['uid'] = $_REQUEST['username'];
        $_SESSION['pwd'] = $_REQUEST['password'];
    }

    $uid = $_SESSION['uid'];
    $pwd = $_SESSION['pwd'];

    include('main.php');
    db_connect();        

    $res = mysql_query("SELECT * FROM tbfornecedor WHERE login='$uid' AND password='$pwd' and tipo_empresa = 2");
    $row = mysql_fetch_row($res);

    if(mysql_num_rows($res) == 0) 
    {
        unset($_SESSION['uid']);
        unset($_SESSION['pwd']);
        db_disconnect();
        $_SESSION['no_login'] = 'true';
    }
    else
    {
        unset($_SESSION['no_login']);
        $_SESSION['cod_rentacar']=$row[3];
        db_disconnect();        
    }    
        
    if (isset($_SESSION['no_login']))
        header("location: login.php");
    else
    {
        if (isset($_SESSION['cod_rentacar']))
            header("location: dados_gerais.php");
     }

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>rcar1</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META NAME="Generator" CONTENT="NetObjects Fusion 8 for Windows">
<LINK REL=STYLESHEET TYPE="text/css" HREF="../html/style.css">
<LINK REL=STYLESHEET TYPE="text/css" HREF="../html/site.css">
<STYLE>
</STYLE>
</HEAD>
<BODY NOF="(MB=(brancoMasterBorder, 0, 0, 0, 0), L=(rcar1Layout, 624, 142))" TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
</BODY>
</HTML>
 