gpt4 book ai didi

php - 大奖网站空白

转载 作者:行者123 更新时间:2023-11-28 11:29:48 25 4
gpt4 key购买 nike

我有 2 个 .php 文件,我将它们与我的数据库同步。我试图为我的头奖“结果”页面添加背景。但是我对底部的空白空间有疑问。

这是我的 result.php 代码:

<html>
<head>
<title>RESULT</title>
<style type="text/css">
body {
text-align: center;
background-image:url(../images/background/background5.jpg);
background-repeat:no-repeat;
background-position:50% 50%;
color: white;
}
#true {color:green; font-style:underline}
#close {color:blue;}
#false {color:red;}
a {font-size:35; color: yellow;}
</style>
</head>
<body>
<?php
$date = new DateTime();
define('DB_NAME', 'test');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link)
{
die('Could not connect: '. mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$db_selected)
{
die('Can\'t use '.DB_NAME.': '.mysql_error());
}
$data = mysql_query("SELECT * FROM config") or die(mysql_error());
$a = mysql_real_escape_string($_POST['number1']);
$b = mysql_real_escape_string($_POST['number2']);
$c = mysql_real_escape_string($_POST['number3']);
$username = mysql_real_escape_string($_POST['user_name']);
$d = "$a$b$c";
echo 'Guessed code:'.$d.'<br>';
while($info = mysql_fetch_array( $data ))
{
if($info['jackpot_code'] == $d)
{
mysql_query("UPDATE `config` SET `jackpot_code`= ".rand(000,999)." WHERE `id`=1");
echo '<a href="././jackpot.php"><img src="../images/img/jackpot1.gif" height="100px" width="200"/><br><div id="true">CORRECT!</div></a>';
}
else if( $d + 30 > $info['jackpot_code'] && $info['jackpot_code'] > $d - 30){
echo '<a href="././jackpot.php">Try again!</a><br>';
die('<div id="close">The code u guessed is at the range of +/- 30 to jackpot.</div>');
} else
{
echo '<a href="././jackpot.php">Try again!</a><br>';
die('<div id="false">CODE FALSE!</div>');
}
}
$sql = "INSERT INTO jackpot_log (username, code, time) VALUES ('".$username."','".$d."','".$date->getTimestamp()."')";

if (!mysql_query($sql))
{
die('Error: '. mysqli_error($con));
}
?>
</body>

以及页面result.php的图片:RESULT PAGE IMAGE

如果您需要:jackpotpage.php

<html>
<head>
<title>RESULT</title>
<style type="text/css">
body {
text-align: center;
background-image:url(../images/background/background5.jpg);
background-repeat:no-repeat;
background-position:50% 50%;
color: white;
}
img {
margin-top:25px;
}
</style>
</head>
<body>
<form action="result.php" method="POST"/>
<img src="../images/img/jackpot2.jpg" height="150px" width="300"/><br></br>
<h1>Name:</h1>
<input type="text" name="user_name">
<br><br>
<table cellpadding="5px"cellspacing="5px">
<tr>
<select name="number1">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</tr>
<tr>
<select name="number2">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</tr>
<tr>
<select name="number3">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</tr>
</table><br>
<input type="submit" value="TRY!">
</form>
</body>

BACKGROUND IMAGE

JACKPOT PAGE IMAGE

最佳答案

试试这个

html { 
background: url(cm3v.jpg) no-repeat center center fixed; //replace cm3v.jpg with your image path
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

工作于:

Safari 3+ Chrome 随便+浏览器 9+Opera 10+(Opera 9.5 支持背景大小但不支持关键字)Firefox 3.6+(Firefox 4 支持无厂商前缀版本)

来源:http://css-tricks.com/perfect-full-page-background-image/

关于php - 大奖网站空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21208741/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com