我无法将背景图像应用于div类

时间:2014-11-04 06:53:52

标签: php html5 css3

我无法将div类的背景图像放回去,甚至无法缩小登录和行之间的差距。我已将所有这些设置为0px(边框,填充边距)。我找不到解决方案是否有任何编辑器显示CSS错误?

<?php
 //   session_start();
function redirect_to($new_location){
    header("Location: " . $new_location);
}
$email="";
$password="";
$passwd_err=array();
$email_err=array();
$passwd_err[0]=$email_err[0]="";
session_start();
$_SESSION['custno']="";
function db_connect(){
    $dbhost='localhost';
    $dbuser='manoj';
    $dbpass='harsha';
    $dbname='vintage';
    $connection=mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
    if(mysqli_connect_errno()){
        die("connection failed");
        echo "<br/>";
    }
    else{
        return $connection;
    }
}

    function password_check($password, $existing_hash) {
        // existing hash contains format and salt at start
      $hash = crypt($password, $existing_hash);
      if ($hash === $existing_hash) {
        return true;
      } else {
        return false;
      }
    }
function email_validation($emai)
{
    if (filter_var($emai, FILTER_VALIDATE_EMAIL)) {
        return true;
    }
    else{
        $email_err[0]="INVALID EMAIL";
        return false;
    }

}
function password_validations($passwd)
{
    $regex="$\S*(?=\S{8,30})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$";
    if(preg_match_all($regex,$passwd))
    {
       $passwd_err[0]="";
      return true;
    }
    else{
            $passwd_err[0]="Invalid Password";
      return false;
    }
      /*
    Explaining $\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$
    $ = beginning of string
    \S* = any set of characters
    (?=\S{8,}) = of at least length 8
    (?=\S*[a-z]) = containing at least one lowercase letter
    (?=\S*[A-Z]) = and at least one uppercase letter
    (?=\S*[\d]) = and at least one number
    (?=\S*[\W]) = and at least a special character (non-word characters)
    $ = end of the string

 */


}

    if(isset($_POST["Dive_In"]))
    {
        $connect=db_connect();
            if($_POST["password"]==""){
                $passwd_err[0]="Cannot be left blank";
            }
            if(($_POST["username"]==""))
            {
                $email_err[0]="cannot be left blank";
            }
            if( ($_POST["password"]!="") &&($_POST["username"]!="") )
            {
                $email=$_POST["username"];
                $password=$_POST["password"];
                if(email_validation($email)){
                    $email_sql="select CustNo from Customer where email='{$email}' ";
                    $query=mysqli_query($connect,$email_sql);
                    if(mysqli_num_rows($query)==1)
                    {
                        $result=mysqli_fetch_row($query);
                        $CustNo=$result[0];
                        if(password_validations($password))
                        {
                            $password_sql="select password from passwd s where s.em_id = $CustNo ";
                            $passwd_sql=mysqli_query($connect,$password_sql);
                            $pass_sql=mysqli_fetch_row($passwd_sql);
                            if(password_check($password,$pass_sql[0]))
                            {
                              $_SESSION['custno']=$CustNo;
                              mysqli_close($connect);
                              redirect_to("login.php");
                            }
                            else{

                                $passwd_err[0]="Wrong Password";
                                mysqli_close($connect);
                            }
                        }
                        else{
                            $passwd_err[0]="Invalid Password";
                            mysqli_close($connect);
                        }


                    }
                    else{
                        $email_err[0]="User does not exist";
                    }
                }
                else{
                        $email_err[0]="Invalid email";
                        mysqli_close($connect);
                    }
               /*if(password_validations($password))
                {
                    echo "true";
                }
                else{
                 echo "false";
                }*/

            }
    }
    else{
         $email="";
        $password="";
    }

?>

<!DOCTYPE html>

<html>
<head>
    <title>Home</title>
    <style>
    p,div,h1,h2,h3,ul,li,form,span{

        margin: 0px;
        padding:0px;
        border: 0px;
    }
    .back{
        background-size:cover;
        background-image:url("/img/angry.jpg");
        width:100%;
        height:100%;
    }
    .header{
        background-color: #F3F5F6;
        width:100%;
        height:100px;
        margin:0px;
        padding:0px;
        border: 0px;

    }
    div.signin{
        background-color:rgba(1,1,1,0.62);
            border:1px solid silver;
            width:350px;
            height:361px;
            border-radius:4px;
        margin-top:50px;
        margin-right:20px;
        float: right;
    }
    .text{
        width: 275px;
        height: 30px;
        border-radius:6px;
        margin-bottom:18px;
        box-shadow:1px 1px 1px;
    }
        .bod{
    padding: 0px;
    margin: 0px;
    border: 0px;
    font-family: "Open Sans, Helvetica, Arial, sans-serif";
    font-size: 20px;

        }
    .box{
        margin-top:80px;
        margin-left:30px;
       }
       ul{
    margin-top: 70px;
    margin-left:35px;
    padding:0px;
    white-space:nowrap; <!-- ensures that text stays on one line.-->
    list-style: none;
    padding:0px;
    float: right;
       }
       ul li{
    margin-left: 20px;
    margin-right: 30px;
    margin-top: 5px;
    padding: 0px;
    display: inline-block;
    font-family: "Open Sans, Helvetica, Arial, sans-serif";
    font-size: 16px;

       }
       li a{
    color:#0084CB;
    text-decoration: none;
    font-size: 20px;
       }


    </style>
</head>

<body class="bod">
    <div class="header">
    <img style="margin-left:15px;margin-right: 5px;margin-top: 10px; position:absolute;" src="/img/download.jpeg" height='50' width='50'align="center" >
    <p style="color:#0084CB;font-size: 30px; float:left; position:relative; margin-top: 17px; margin-left: 70px;">
         Vintage Bank
    </p>
    <ul >
    <li>
      <a href="index.php"><p>HOME</p></a>
    </li>
    <li  >
    <a href="admins/Employee/em_admin.php">EMPLOY</a>
    </li>
    <li >
    <a href="admins/Manager/admin_mgr.php">MANAGER</a>
    </li>
    </ul>

    </div>

    <div class="back">
    <div class="signin">
    <div style="color:white;font-family: 'Arial';margin-top:22px;margin-left: 15px; font-size: 25px;">LOGIN</div>
    <div style="margin-top:2px;margin-left:10px;color: white;">____________________________</div>
        <form name="login" action="index.php" method="post" class="box">
            <input type="text" class="text" name="username" placeholder="Username" autocomplete="on" size="40px;" value="" ><?php echo $email_err[0]; ?></br>
            <input type="password" class="text" name="password" placeholder="Password" size="40px;" value="" ><?php echo $passwd_err[0]; ?></br>
            <input type="submit" name="Dive_In"  va_delue="Dive In">
        </form>

    </div>
    </div>



</body>
</html>

2 个答案:

答案 0 :(得分:0)

请尝试以下代码:

    <?php
 //   session_start();
function redirect_to($new_location){
    header("Location: " . $new_location);
}
$email="";
$password="";
$passwd_err=array();
$email_err=array();
$passwd_err[0]=$email_err[0]="";
session_start();
$_SESSION['custno']="";
function db_connect(){
    $dbhost='localhost';
    $dbuser='manoj';
    $dbpass='harsha';
    $dbname='vintage';
    $connection=mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
    if(mysqli_connect_errno()){
        die("connection failed");
        echo "<br/>";
    }
    else{
        return $connection;
    }
}

    function password_check($password, $existing_hash) {
        // existing hash contains format and salt at start
      $hash = crypt($password, $existing_hash);
      if ($hash === $existing_hash) {
        return true;
      } else {
        return false;
      }
    }
function email_validation($emai)
{
    if (filter_var($emai, FILTER_VALIDATE_EMAIL)) {
        return true;
    }
    else{
        $email_err[0]="INVALID EMAIL";
        return false;
    }

}
function password_validations($passwd)
{
    $regex="$\S*(?=\S{8,30})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$";
    if(preg_match_all($regex,$passwd))
    {
       $passwd_err[0]="";
      return true;
    }
    else{
            $passwd_err[0]="Invalid Password";
      return false;
    }
      /*
    Explaining $\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$
    $ = beginning of string
    \S* = any set of characters
    (?=\S{8,}) = of at least length 8
    (?=\S*[a-z]) = containing at least one lowercase letter
    (?=\S*[A-Z]) = and at least one uppercase letter
    (?=\S*[\d]) = and at least one number
    (?=\S*[\W]) = and at least a special character (non-word characters)
    $ = end of the string

 */


}

    if(isset($_POST["Dive_In"]))
    {
        $connect=db_connect();
            if($_POST["password"]==""){
                $passwd_err[0]="Cannot be left blank";
            }
            if(($_POST["username"]==""))
            {
                $email_err[0]="cannot be left blank";
            }
            if( ($_POST["password"]!="") &&($_POST["username"]!="") )
            {
                $email=$_POST["username"];
                $password=$_POST["password"];
                if(email_validation($email)){
                    $email_sql="select CustNo from Customer where email='{$email}' ";
                    $query=mysqli_query($connect,$email_sql);
                    if(mysqli_num_rows($query)==1)
                    {
                        $result=mysqli_fetch_row($query);
                        $CustNo=$result[0];
                        if(password_validations($password))
                        {
                            $password_sql="select password from passwd s where s.em_id = $CustNo ";
                            $passwd_sql=mysqli_query($connect,$password_sql);
                            $pass_sql=mysqli_fetch_row($passwd_sql);
                            if(password_check($password,$pass_sql[0]))
                            {
                              $_SESSION['custno']=$CustNo;
                              mysqli_close($connect);
                              redirect_to("login.php");
                            }
                            else{

                                $passwd_err[0]="Wrong Password";
                                mysqli_close($connect);
                            }
                        }
                        else{
                            $passwd_err[0]="Invalid Password";
                            mysqli_close($connect);
                        }


                    }
                    else{
                        $email_err[0]="User does not exist";
                    }
                }
                else{
                        $email_err[0]="Invalid email";
                        mysqli_close($connect);
                    }
               /*if(password_validations($password))
                {
                    echo "true";
                }
                else{
                 echo "false";
                }*/

            }
    }
    else{
         $email="";
        $password="";
    }

?>

<!DOCTYPE html>

<html>
<head>
    <title>Home</title>
    <style>
    p,div,h1,h2,h3,ul,li,form,span{

        margin: 0px;
        padding:0px;
        border: 0px;
    }
    .back{
        background-size:cover;
        background-image:url("/img/angry.jpg");
        width:100%;
        height:100%;
    }
    .header{
        background-color: #F3F5F6;
        width:100%;
        height:100px;
        margin:0px;
        padding:0px;
        border: 0px;

    }
    div.signin{
        background-color:rgba(1,1,1,0.62);
            border:1px solid silver;
            width:350px;
            height:361px;
            border-radius:4px;
        margin-top:50px;
        margin-right:20px;
        float: right;
    }
    .text{
        width: 275px;
        height: 30px;
        border-radius:6px;
        margin-bottom:18px;
        box-shadow:1px 1px 1px;
    }
        .bod{
    padding: 0px;
    margin: 0px;
    border: 0px;
    font-family: "Open Sans, Helvetica, Arial, sans-serif";
    font-size: 20px;

        }
    .box{
        margin-top:80px;
        margin-left:30px;
       }
       ul{
    margin-top: 70px;
    margin-left:35px;
    padding:0px;
    white-space:nowrap; <!-- ensures that text stays on one line.-->
    list-style: none;
    padding:0px;
    float: right;
       }
       ul li{
    margin-left: 20px;
    margin-right: 30px;
    margin-top: 5px;
    padding: 0px;
    display: inline-block;
    font-family: "Open Sans, Helvetica, Arial, sans-serif";
    font-size: 16px;

       }
       li a{
    color:#0084CB;
    text-decoration: none;
    font-size: 20px;
       }


    </style>
</head>

<body class="bod">
    <div class="header">
    <img style="margin-left:15px;margin-right: 5px;margin-top: 10px; position:absolute;" src="/img/download.jpeg" height='50' width='50'align="center" >
    <p style="color:#0084CB;font-size: 30px; float:left; position:relative; margin-top: 17px; margin-left: 70px;">
         Vintage Bank
    </p>
    <ul >
    <li>
      <a href="index.php"><p>HOME</p></a>
    </li>
    <li  >
    <a href="admins/Employee/em_admin.php">EMPLOY</a>
    </li>
    <li >
    <a href="admins/Manager/admin_mgr.php">MANAGER</a>
    </li>
    </ul>

    </div>

    <div class="back">
    <div class="signin">
    <div style="color:white;font-family: 'Arial';margin-top:22px;margin-left: 15px; font-size: 25px;border-bottom: 1px solid #FFF;">LOGIN</div>
        <form name="login" action="index.php" method="post" class="box">
            <input type="text" class="text" name="username" placeholder="Username" autocomplete="on" size="40px;" value="" ><?php echo $email_err[0]; ?></br>
            <input type="password" class="text" name="password" placeholder="Password" size="40px;" value="" ><?php echo $passwd_err[0]; ?></br>
            <input type="submit" name="Dive_In"  va_delue="Dive In">
        </form>

    </div>
    </div>



</body>
</html>

答案 1 :(得分:0)

试试这个     。背部     {         背景尺寸:盖;

    background:url("/img/angry.jpg");
    width:361PX;
    height:350PX;

 }
.header{
    background-color: #F3F5F6;
    width:100%;
    height:100px;
    margin:0px;
    padding:0px;
    border: 0px;

}
div.signin{
    background-color:rgba(1,1,1,0.62);
        border:1px solid silver;
        width:350px;
        height:361px;
        border-radius:4px;
    margin-top:0px;
    margin-right:0px;
    float: right;
}
.text{
    width: 275px;
    height: 30px;
    border-radius:6px;
    margin-bottom:18px;
    box-shadow:1px 1px 1px;
}
    .bod{
padding: 0px;
margin: 0px;
border: 0px;
font-family: "Open Sans, Helvetica, Arial, sans-serif";
font-size: 20px;

    }
.box{
    margin-top:20px;
    margin-left:30px;
   }
   ul{
margin-top: 70px;
margin-left:35px;
padding:0px;
white-space:nowrap; <!-- ensures that text stays on one line.-->
list-style: none;
padding:0px;
float: right;
   }
   ul li{
margin-left: 20px;
margin-right: 30px;
margin-top: 5px;
padding: 0px;
display: inline-block;
font-family: "Open Sans, Helvetica, Arial, sans-serif";
font-size: 16px;

   }
   li a{
color:#0084CB;
text-decoration: none;
font-size: 20px;
   }


</style>