Php 更改放置在DIV中的recaptcha表单的背景颜色
所以我在一个DIV中有一个recaptcha表单。目前DIV的背景颜色是白色,而我的网页的其余部分是灰色的 如果recaptcha表单为白色,则不显示白色背景,而是显示灰色 我拥有的recaptcha代码位于DIV中:Php 更改放置在DIV中的recaptcha表单的背景颜色,php,css,html,colors,recaptcha,Php,Css,Html,Colors,Recaptcha,所以我在一个DIV中有一个recaptcha表单。目前DIV的背景颜色是白色,而我的网页的其余部分是灰色的 如果recaptcha表单为白色,则不显示白色背景,而是显示灰色 我拥有的recaptcha代码位于DIV中: <div id="register"> <form action='register.php' method='post'> <h1>Register Here:</h1> <h1><?php echo $mes
<div id="register">
<form action='register.php' method='post'>
<h1>Register Here:</h1>
<h1><?php echo $message; ?></h1>
Username:<input type='text' name='username'
value='<?php echo $username; ?>'><br />
Password:<input type='password' name='password'><br />
Repeat Password:<input type='password' name = 'repeatpassword' >
<?php echo $recaptcha_form; ?>
<input type='submit' name='submit' value='Register'>
<input name ='reset' type='reset' value='Reset'>
</form>
<h1>Once you have registered, log in <a href='login.php'>here!</a></h1>
</div>
以下是recaptcha代码的更多内容:
require_once('recaptcha/recaptchalib.php');
$publickey = "6Lem4-gSAAAAAMHLAVbieIknMtUZo71ZKzzCkoFN";
$privatekey = "6Lem4-gSAAAAADsaa9KXlzSAhLs8Ztp83Lt-x1kn";
$resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
$recaptcha_form = recaptcha_get_html($publickey);
//grab the form data
$submit = trim($_POST['submit']);
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$repeatpassword = trim($_POST['repeatpassword']);
$message ='';
$s_usename ='';
//start to use PHP session
//determine whether user is logged in - test for vlaue in $_SESSION
if (isset($_SESSION['logged'])){
$s_username =$_SESSION['username'];
$message = "You are already logged in as $s_username.<br />
Please <a href='logout.php'>logout</a> before trying to register.";
}else{
//next block of code
if ($submit=='Register'){
//process submission
if (!$resp->is_valid) {
//what happens when the capture was entered incorrectly
$errMessage =$resp->error;
$message = "<strong>The recaptcha wasn't entered
correctly. Please try again.</strong> <br />" .
"(recaptcha said: $errMessage)<br />";
}else{
//process valid submission data here
if ($username&&$password&&$repeatpassword){
if ($password==$repeatpassword){
//process username details here
if (strlen($username)>25 ) {
$message= "Username is too long";
}else{
if (strlen($password)>25||strlen($password)<6) {
$message = "Password must be between 6-25 characters long";
}else{
//process details here
require_once("db_connect.php"); //include file to do db connect
if($db_server){
//clean the input not that we have a db connection
$username = clean_string($db_server, $username);
$password = clean_string($db_server, $password);
$repeatpassword = clean_string($db_server, $repeatpassword);
mysqli_select_db($db_server, $db_database);
//cheach whther username exsists
$query="SELECT username FROM register WHERE username='$username'";
$result=mysqli_query($db_server, $query);
if($row = mysqli_fetch_array($result)){
$message = "Username already exists. Please try again.";
}else{
//process further here
//Encrypt password
$password = salt($password);
$query = "INSERT INTO register (username, password) VALUES
('$username', '$password')";
mysqli_query($db_server, $query) or
die("Insert failed. ".mysqli_error($db_server));
$message = "<strong>Registration Successful!</strong>";
}
mysqli_free_result($result);
}else{
$message ="error: could not connect to the database.";
}
require_once("db_close.php"); //include file to do db close
}
}
}else{
$message = "Both passwords fields must match";
}
}else{
$message = "Please fill in all fields";
}
}
}
}
?>
require_once('recaptcha/recaptchalib.php');
$publickey=“6Lem4-gSAAAAAMHLAVbieIknMtUZo71ZKzzCkoFN”;
$privatekey=“6Lem4-gSAAAAADsaa9KXlzSAhLs8Ztp83Lt-x1kn”;
$resp=recaptcha\u check\u answer($privatekey,$\u SERVER[“REMOTE\u ADDR”],
$\u POST[“重演挑战场”],
$(POST[“recaptcha_response_field”]);
$recaptcha\u form=recaptcha\u get\u html($publickey);
//获取表单数据
$submit=trim($_POST['submit']);
$username=trim($_POST['username']);
$password=trim($_POST['password']);
$repeatpassword=trim($_POST['repeatpassword']);
$message='';
$s_usename='';
//开始使用PHP会话
//确定用户是否已登录-在$\u会话中测试vlaue
如果(isset($_会话['logged'])){
$s_username=$_会话['username'];
$message=“您已经以$s_用户名登录。
请在尝试注册之前进行操作。“;
}否则{
//下一段代码
如果($submit=='Register'){
//过程提交
如果(!$resp->有效){
//当捕获输入错误时会发生什么
$errMessage=$resp->error;
$message=“未输入recaptcha
正确。请重试。
”。
“(雷帕查说:$errMessage)
”;
}否则{
//在此处理有效的提交数据
如果($username&&$password&&$repeatpassword){
如果($password==$repeatpassword){
//在此处处理用户名详细信息
如果(strlen($username)>25){
$message=“用户名太长”;
}否则{
如果(strlen($password)>25 | | strlen($password)
你知道我能做些什么吗?我能把夺回表格的背景区域涂成白色吗
请记住我需要新的编码
非常感谢如果没有recaptcha代码,您可以使用以下CSS设置样式:
#recaptcha_response_field { background: #fff !important; }
或
您可以使用:
input[type=text] { background-color: #fff !important; }
你能显示
$recaptcha\u表单
的内容吗?如果$recaptcha\u表单
解析为iframe
,你可能无能为力…请发布验证码的结果标记。你应该使用背景色
而不是背景色
。此外,尽可能避免使用!重要的!是的,但是没有看到表单代码,如果背景颜色是在php代码中设置的。那么我只使用了!重要,但你是对的,如果可能,你应该避免使用“!重要”,但我们尝试了这两种方法,没有任何更改。现在有什么想法吗?ice添加了recaptcha代码供你查看?谢谢
input[type=text] { background-color: #fff !important; }