<?php
	//session_start();
	include("config.php");
	
	 $cart=$_REQUEST['cart'];
	 
	$myusername=$_POST['uname']; 
         $mypassword=$_POST['pword']; 

     // To protect MySQL injection (more detail about MySQL injection)
      
       
         $myusername = mysql_real_escape_string($myusername);
       $mypassword = mysql_real_escape_string($mypassword);
       $sql="SELECT * FROM  user_account WHERE username='$myusername' and password='$mypassword' and code='1'";
        $result=mysql_query($sql);

// Mysql_num_row is counting table row
      $count=mysql_num_rows($result);
	   if ($count== 1 && $cart!=0)
		{
			// Set username session variable
			 $_SESSION['username'] = $_POST['uname'];
			 header("location:ship_address.php");		
		}
	    else if($count== 1 && $cart==0)
	    {
			$_SESSION['username'] = $_POST['uname'];
		     header("location:index.php");
	    }
	else 
		{
                    header("location:login.php?add=err");
		}
?>