帮我看看下面的代码怎么不执行form表单
<?php<br />/*注册文件<br />* $Author: 陈义 <br /> * $Id: regist.php 2013-12-17 21:07 陈义 <br />*/<br />//检查session是否存在。<br />include('check_session.php');<br />include('head.php');<br />if(isset($_SESSION['id']) &&isset($_SESSION['pass'])){<br />// if(isset($_SESSION['id'])==true &&isset($_SESSION['pass'])==true){<br />exit("当前已有一个登陆在线的用户<span class=online_user>".$_SESSION['id']."</span>需要再<a href=regist.php>注册</a>请先<a href=index.php?act=out>退出。</a>否则请<a href=javascript: onclick=history.go(-1);>返回</a>");<br />}<br /><br />define('cy','cychat');<br />include('config.php');<br /><br />$name=isset($_POST['name']) ? $_POST['name']:null;<br />$password=isset($_POST['password']) ? $_POST['password']:null;<br />$addess=isset($_POST['addess']) ? $_POST['addess']:null;<br />$age=isset($_POST['age']) ? $_POST['age']:null;<br />$name_md5=md5($name);//给用户名add 一个 md5值<br /><br />////////////////接收用户上传的头像文件///////////////////////////<br />error_reporting(0);<br />$upfilepath="image/userimage/";<br />$file_houzhui='';<br />if($_FILES["userimage"]["type"] == "image/gif"){<br />$file_houzhui=".gif";<br />}<br /><br />if($_FILES["userimage"]["type"] == "image/jpeg"){<br />$file_houzhui=".jpg";<br />}<br /><br />if($_FILES["userimage"]["type"] == "image/png"){<br />$file_houzhui=".png";<br />}<br /><br />switch ($_FILES["userimage"]["error"])<br />{<br />case 1:<br /> echo "上传的文件超过了 php.ini 中 upload_max_filesize 选项限制的值";<br /> break;<br />case 2:<br /> echo "上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值";<br /> break;<br />case 3:<br /> echo "文件只有部分被上传.";<br /> break;<br />case 4:<br /> echo "你没有上传图像。";<br /> break;<br />case 6:<br /> echo "找不到临时文件夹.";<br /> break;<br />case 7:<br /> echo "文件写入失败.";<br /> break;<br />}<br /><br /> move_uploaded_file($_FILES["userimage"]["tmp_name"],$upfilepath.$_FILES["userimage"]["name"]);//从server 移动用户上传文件到新的路径<br /> rename($upfilepath.$_FILES["userimage"]["name"] ,$upfilepath.'tmp'.$name.$file_houzhui);//将客户上传的文件更名为一个临时的文件<br /><br />$source_filename=$upfilepath.'tmp'.$name.$file_houzhui;<br /><br />///////////////////////调整用户上传的图片大小///////////////<br /><br />$filetype=mime_content_type($source_filename);//获取图片的类型。mime_content_type 函数要在php.ini打开 fileinfo选项<br />//echo 'the file type is'.$filetype;<br />list($width, $height) = getimagesize($source_filename);//获取原图片的大小<br /><br />//如果文件的宽度和高度都小于120就把临时文件改名为正式的文件,<br />if($width <= 120 && $height <= 120){<br /> rename($upfilepath.'tmp'.$name.$file_houzhui,$upfilepath.$name.$file_houzhui);<br />}<br /><br /><br />//判断图片的width and height 大于120 就缩小为 120*120 的新图片<br />if($width > 120 || $heitht > 120){<br /> $new_width = 120;<br /> $new_height = 120;<br /> $image_p = imagecreatetruecolor($new_width, $new_height);// 新建一个真色彩的文件<br /> //// 重新取样,新建一个和用户上传同类型的文件<br /> //判断用户上传的是那种类型图片<br /> if($filetype == "image/gif"){<br /> $image = imagecreatefromgif($source_filename);<br /> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);//copy 源图像到新建的真色彩文件。<br /> imagegif($image_p,$upfilepath.$name.$file_houzhui);//保存图片到新地址,并且重新更名<br /> }<br /> //判断用户上传的是那种类型图片<br /> if($filetype == "image/jpeg"){<br /> $image = imagecreatefromjpeg($source_filename);<br /> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);//copy 源图像到新建的真色彩文件。<br /> imagejpeg($image_p,$upfilepath.$name.$file_houzhui, 80);//保存图片到新地址,并且重新更名<br /> }<br /> //判断用户上传的是那种类型图片<br /> if($filetype == "image/png"){<br /> $image = imagecreatefrompng($source_filename);<br /> imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);//copy 源图像到新建的真色彩文件。<br /> imagepng($image_p,$upfilepath.$name.$file_houzhui);//保存图片到新地址,并且重新更名<br /> }<br /><br /> imagedestroy ($image);//销毁图片占用的内存<br /> imagedestroy ($image_p);//销毁图片占用的内存<br /> unlink($source_filename);//del 用户上传的原图片,这行很重要!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br />}<br />//*//////////////////////////////////////$\<br />$useruploadimageaddess="";//用于插入数据库的变量<br /><br />//如果上传的不是图像文件或者没有上传文件<br />if($filetype != "image/png" && $filetype != "image/gif" && $filetype != "image/jpeg"){<br />$useruploadimageaddess='noaddess';<br />}else{<br />$useruploadimageaddess=$upfilepath.$name.$file_houzhui;//用于插入数据库的变量<br />}<br />///////////////////////////////////////////////////////<br />$sql = "INSERT INTO user( `user`,user_md5, `password`, `addess`, `age`,`userImage`,`regist_date`) VALUES ('$name','$name_md5','$password','$addess',$age,'$useruploadimageaddess',now())";<br /><br /><br />/////////////////////////////<br />/////////////////////////////<br /> //检查是否有用户已经注册<br />$inquiry_username = mysql_query("SELECT user FROM user WHERE user='$name'");<br />if(mysql_num_rows($inquiry_username)>=1){ <br /> exit(' 对不起!!!<strong style=color:red>'.$name.'</strong>用户已经有人注册。');<br />}<br />//<br />if($name!=null && $password!=null && $addess!=null && $age!=null){<br /> if(mysql_query($sql,$linkdatabase)){<br /> exit("<p style=color:red><b>您已成功注册。请记住您的用户名和密码!用户名是$name 密码是$password 请<a href=\"login.php\">登录</a></p>");//如果注册成功就不输出下面的表单。<br /> }else{<br /> echo '注册失败,请重新注册';<br /> }<br />}<br /><br />echo '<div class="regist"><br /><form method="post" enctype="multipart/form-data" action="regist.php"><br /> <label for="name">用户名:</label><br /> <input class="regist_username" type="text" name="name" /> *<br/><br /> <label for="password">密 码:</label><br /> <input class="regist_password" type="password" name="password"/> *<br/><br /> <label for="addess">地 址:</label><br /> <input class="regist_addess"type="text" name="addess"/> *<br/><br /> <label for="age">年 龄:</label><br /> <input class="regist_age" type="text" name="age"/> *<br/><br /> <label for="userimage">头 像:</label><br /> <input type="file" name="userimage" value="userimage"><br/><br /> <input class="regist_regist" type="submit" value="注册"><br/><br /> <label for="info">带'*'号的必须要填写信息 </label><br /></form><br /></div>';<br /><br /><br />include "footpage.php";//页脚<br />?><br />
------解决思路----------------------
把* 的单引去掉

PHPsessionstrackuserdataacrossmultiplepagerequestsusingauniqueIDstoredinacookie.Here'showtomanagethemeffectively:1)Startasessionwithsession_start()andstoredatain$_SESSION.2)RegeneratethesessionIDafterloginwithsession_regenerate_id(true)topreventsessi

In PHP, iterating through session data can be achieved through the following steps: 1. Start the session using session_start(). 2. Iterate through foreach loop through all key-value pairs in the $_SESSION array. 3. When processing complex data structures, use is_array() or is_object() functions and use print_r() to output detailed information. 4. When optimizing traversal, paging can be used to avoid processing large amounts of data at one time. This will help you manage and use PHP session data more efficiently in your actual project.

The session realizes user authentication through the server-side state management mechanism. 1) Session creation and generation of unique IDs, 2) IDs are passed through cookies, 3) Server stores and accesses session data through IDs, 4) User authentication and status management are realized, improving application security and user experience.

Tostoreauser'snameinaPHPsession,startthesessionwithsession_start(),thenassignthenameto$_SESSION['username'].1)Usesession_start()toinitializethesession.2)Assigntheuser'snameto$_SESSION['username'].Thisallowsyoutoaccessthenameacrossmultiplepages,enhanc

Reasons for PHPSession failure include configuration errors, cookie issues, and session expiration. 1. Configuration error: Check and set the correct session.save_path. 2.Cookie problem: Make sure the cookie is set correctly. 3.Session expires: Adjust session.gc_maxlifetime value to extend session time.

Methods to debug session problems in PHP include: 1. Check whether the session is started correctly; 2. Verify the delivery of the session ID; 3. Check the storage and reading of session data; 4. Check the server configuration. By outputting session ID and data, viewing session file content, etc., you can effectively diagnose and solve session-related problems.

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

Configuring the session lifecycle in PHP can be achieved by setting session.gc_maxlifetime and session.cookie_lifetime. 1) session.gc_maxlifetime controls the survival time of server-side session data, 2) session.cookie_lifetime controls the life cycle of client cookies. When set to 0, the cookie expires when the browser is closed.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver CS6
Visual web development tools
