2011-06-18 40 views
-2
<?php session_start(); ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
<link href="css/css.css" rel="stylesheet" type="text/css" /> 
<style rel="stylesheet" type="text/css"> <---------------------------------8 th line 
input { 
    border-style: solid; 
    border-color: #000000; 
    border-width: 1px; 
    background-color: #ffffff; 
    } 
</style> 
<script src="js/css_browser_selector.js" type="text/javascript"></script> 

</head> 

    <body> 
<?php 

include('includes/topmenu.php');//top menu 

$yourname=''; 
$email=''; 
$email2=''; 
$password=''; 
$password2=''; 
$country=''; 


$error = array(); 

if (isset($_POST['Registerme'])) 
{ 
include('includes/config.php'); 
$yourname=$_POST['yourname']; 
$email=$_POST['email']; 
$email2=$_POST['email2']; 
$password=$_POST['password']; 
$password2=$_POST['password2']; 
$country=$_POST['country']; 

$yourname=stripslashes($yourname); 
$yourname=mysql_real_escape_string($yourname); 
$email = stripslashes($email); 
$password= stripslashes($password); 
$email = mysql_real_escape_string($email); 
$password= mysql_real_escape_string($password); 




if($yourname==''){ 

    $error[0]='<span style=color:#ff0000; >name required</span>'; 

    } 


if($email==''){ 

    $error[1]='<span style=color:#ff0000; >email required</span>'; 

    } 
if($email2==''){ 

    $error[2]='<span style=color:#ff0000; >required field</span>'; 

    } 


if($password==''){ 

    $error[3]='<span style=color:#ff0000; >password required</span>'; 

    } 


    if($password2==''){ 

    $error[4]='<span style=color:#ff0000; >required field</span>'; 

    } 


if($country==''){ 

    $error[5]='<span style=color:#ff0000; >country required</span>'; 

    } 

if ($password !== $password2) { 
    $error[3]='<span style=color:#ff0000; >passwords do not match</span>'; 

     } 

if ($email !== $email2) { 
    $error[1]='<span style=color:#ff0000; >emails do not match</span>'; 

      } 


      if(count($error) > 0) { 


      } else { 
      $password=''; 
       $id33=''; 
     $yourname=$_POST["yourname"]; 
     $email=$_POST["email"]; 
     $password=$_POST["password"]; 
     $ip=$_SERVER['REMOTE_ADDR']; 
     $country=$_POST["country"]; 

     include('includes/config.php'); 

     $result = mysql_query(" 
     INSERT INTO `users` 
     ( 
     `email`, `password`, `yourname`, `country`,`ip`) 
     VALUES ( '$email', '$password', '$yourname', '$country','$ip')") 
      or die (mysql_error()); 

     $id33= mysql_insert_id(); 

    $result3 = mysql_query("INSERT INTO `other_user_text` (`userid`) 
     VALUES ('$id33');") or die (mysql_error()); 

      $_SESSION['show']='1'; 
      mkdir("users/$id33/",0755); 
      mkdir("users/$id33/images",0755); 
      mkdir("users/$id33/thumbs",0755); <-----------------------139th line 
      mkdir("users/$id33/thumbs/small_thumbs",0755); 
      header("Location: login.php"); 
     } 
    } 
?> 

这是我的脚本,当有人在我的网站broswer中注册时,不会指示登录.php。显示此错误警告:无法修改注册论坛中的标题信息

警告:不能更改头信息 - 头已经发出(输出开始/home/cham1992/public_html/register.php:8)在/home/cham1992/public_html/register.php线139

我尝试了一切,但是我找不到这里有什么错误。这个页面有什么问题?

+0

相关的问题看起来像*可能*一个或两个重复... – phihag

回答

1

你的代码工作像每一个页面之前写一点HTML。如果您实现一个重定向,你有两个选择:

  1. 充分利用重定向任何HTML之前
  2. 使用脚本的页面加载(不那么优雅)后重定向

我会建议第1版,因此在PHP块之后放置该HTML块(从doctype到body),因为你的PHP没有任何回声,这不会产生任何错误。

+0

谢谢你现在可以工作 –

1

mkdir在您的脚本中生成警告,因此目录已经存在或您没有创建目录的权限。关于生成标题的警告,因为错误报告试图在报告文本之前发送标题。

我建议您使用set_error_handler进行错误处理。

1

要重定向到其他页面,您通常使用:

标题( “位置:http://www.example.com/”);

但是,在此之前不应该有任何文本或输出发送到浏览器。

查看源代码在其中警告显示页面和警告之前可能会有一些HTML产生应该是问题

相关问题