Home Backend Development PHP Tutorial Xinglin classmates (4)_PHP tutorial

Xinglin classmates (4)_PHP tutorial

Jul 21, 2016 pm 04:03 PM
class session start personal start class manage Address book

个人管理:
   班级通讯录:class/address.php
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "请重新注册
";
exit;
}
?>



班级通讯录




  
  
    

    

  

  
      
          
          
        
      
班级通讯录

    

include "config.php";
$result = mysql_query("SELECT * FROM user",$db);
$row=mysql_num_rows($result);//查看结果有多少行
for ($i=0;$i<=($row-1);$i++) {
$name=mysql_result($result,$i,'name');
$sex=mysql_result($result,$i,'sex');
$birth=mysql_result($result,$i,'birth');
$ph=mysql_result($result,$i,'ph');
$bp=mysql_result($result,$i,'bp');
$email=mysql_result($result,$i,'email');
$oicq=mysql_result($result,$i,'oicq');
$work=mysql_result($result,$i,'work');
$photo=mysql_result($result,$i,'photo');
$ad=mysql_result($result,$i,'ad');
$post=mysql_result($result,$i,'post');
$account=mysql_result($result,$i,'account');
$face=mysql_result($result,$i,'face');
$face='image/face/icon'.$face;
echo "              
      
......................○班级通讯录○....................
    
 姓名:$name性别:$sex 生日:$birth
电话: $ph 传呼:$bp
Email:$emailoicq:$oicq
工作单位:$work 邮编:$post
通讯地址:$ad
个人照片:$photo
个人说明:$account
";
}   
?>  



个人资料修改:class/modify.php
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "
请重新注册
";
exit;
}
?>



个人资料修改


include "config.php";
if ($submit){
if (!$username||!$psw||!$psw2||!$name||!$ad||!$ph||!$email){           //检查是否填写完整
      echo "对不起,您必须填所有带*的项目!
"."
重填";
      exit;
    }
$user=trim($username);
$psw=trim($psw);
$psw2=trim($psw2);
$name=trim($name);
$birth=trim($birth);
$work=trim($work);
$ad=trim($ad);
$post=trim($post);
$ph=trim($ph);
$bp=trim($bp);
$email=trim($email);
$oicq=trim($oicq);
$account=strip_tags(trim($account));//去掉首尾空格及html标记
$signature=strip_tags(trim($signature));
//检查密码重复是否正确
if (!$psw==$psw2){
echo "请确认密码,返回";
exit;
}
//检查email的合法性
if(!ereg('^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+.'.'[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+$',$email)&&$email){
       echo "email不合法!
"."重填
";
       exit;}
//写入数据库
$sql="UPDATE user SET user='$user',psw='$psw',name='$name',sex='$sex',birth='$birth',work='$work',ad='$ad',post='$post',ph='$ph',bp='$bp',email='$email',oicq='$oicq',account='$account',signature='$signature',face='$face' where user='$userregister'";
$result = mysql_query($sql,$db);
mysql_close($db);
//发祝贺邮件
$subject="祝贺你成功修改个人信息".$sitename."!";//主题
$message=$name.",你好:
  祝贺你成功修改个人信息!您的用户名为".$username.",密码为".$psw."
现在登陆$sitename";//信件内容
$headers .= "Content-Type: text/html; charset=gb2312n"; // Mime type
mail($email,$subject,$message,$headers);
echo "恭喜您修改成功!一封欢迎信已发到您的邮箱,请注意查收。";
exit;
}
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);
$psw=mysql_result($result,0,"psw");
$name=mysql_result($result,0,"name");//读取个人注册信息
$sex=mysql_result($result,0,"sex");
$birth=mysql_result($result,0,"birth");
$work=mysql_result($result,0,"work");
$ad=mysql_result($result,0,"ad");
$post=mysql_result($result,0,"post");
$ph=mysql_result($result,0,"ph");
$bp=mysql_result($result,0,"bp");
$email=mysql_result($result,0,"email");
$oicq=mysql_result($result,0,"oicq");
$photo=mysql_result($result,0,"photo");
$account=mysql_result($result,0,"account");
$signature=mysql_result($result,0,"signature");
$face=mysql_result($result,0,"face");
mysql_close($db);
?>

    
    
  
    
                                                          ''>
       
  
      

    
  
      
个人资料修改

        注意不要有空格,带*的项目为必填。

        

                                                                       The length does not exceed 12)

   Password:
   
                                                     put type=' password' name='psw2' size='8' maxlength='8' value="">
                                       ;input type='Text' name='name' size='8' maxlength='8' value="">
*

Gender :Male
>
Female & lt; input type = 'radio' name = 'sex' value = 'female' & lt ;? if ($ sex == 'female') {echo "checked";}?>>
          

          生日:

          工作单位:  
          
          

          通讯地址:  
          
          *

          邮编:  
          
          

          电话:  
          
          *

          传呼:  
          
          

          Email:  
          
          *

          oicq:  
          
          

          个人说明:(在通讯录里显示,不超过125个汉字)

          
          

          个人签名:(在留言簿的自动签名,不超过125个汉字)

              
            
            
          
        


              选择一个自己喜欢的头像:

                     for ($i=1;$i<=64;$i++){
            echo "";  
            echo "            if ($face==$i){
            echo "checked";
            }
echo ">";
            if (($i%4)==0){ //隔4行,换行
             echo "
";
            }
           }
           ?>

            

        

          

          
          
        

      
    
  



上传照片:class/uploadphoto.php
session_start(); // 开始session
if(!session_is_registered("userregister")||($userregister==""))//检查是否注册,如userregister未注册或session为空值,重新注册.
{
echo "请重新注册
";
exit;
}
?>



上传照片


include "../config.php";
if ($upload){
if ($picurl=="none"){
echo "你没有上传任何文件.";
exit;
}
$v=opendir("image");
if ($v==0)
{ mkdir("image"); //若目录不存在,则新建一个
$v=opendir("image"); //取得目录handle
}
$up=copy("$picurl","image/$picurl_name");
if($up==1)
{
//初始化写入内容
$result = mysql_query("SELECT * FROM user where user='$userregister'",$db);//查询以往照片信息
$photo=mysql_result($result,0,'photo');
$photo=str_replace("'","'",$photo);//将'用'代替
$photo=$photo."
看照片|";//加上此次内容
  mysql_query("UPDATE user SET photo='$photo' where user='$userregister'",$db);//写入
  mysql_close($db);
  echo "文件上传成功!
";
  echo "文件名:$picurl_name 文件大小:$picurl_size byte 文件类型:$picurl_type
";
   }  
  else  
  {echo "文件上传失败.";exit;}  
unlink ($picurl); //从临时文件夹中删除档案$picurl
closedir ($v); //关闭目录handle
exit;
}
?>

    
    
    
  
      
上传照片

                                                              < ? echo $PHP_SELF;?>" method="post" enctype="multipart/form-data" name="UL"> Form-Data "', otherwise it will not produce
Passing Move- & GT;
& LT; div align =" center "& gt; upload photos:
& lt; input type =" file "name =" picurl" size="15" accept="image/x-png,image/gif,image/jpeg"> ="Upload">
                                                                                                                                       ;/td>








http://www.bkjia.com/PHPjc/316114.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/316114.html

TechArticlePersonal management: Class address book: class/address.php ? session_start(); // Start session if(! session_is_registered(userregister)||($userregister==))//Check whether it is registered, such as userregist...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use Redis to implement distributed transaction management How to use Redis to implement distributed transaction management Nov 07, 2023 pm 12:07 PM

How to use Redis to implement distributed transaction management Introduction: With the rapid development of the Internet, the use of distributed systems is becoming more and more widespread. In distributed systems, transaction management is an important challenge. Traditional transaction management methods are difficult to implement in distributed systems and are inefficient. Using the characteristics of Redis, we can easily implement distributed transaction management and improve the performance and reliability of the system. 1. Introduction to Redis Redis is a memory-based data storage system with efficient read and write performance and rich data

Introduction to methods for individuals to join corporate WeChat Introduction to methods for individuals to join corporate WeChat Mar 26, 2024 am 10:16 AM

1. First, open the enterprise WeChat software you downloaded on your mobile phone. When logging in, there are two ways to choose: one is to use WeChat ID, the other is to use mobile phone number. 3. At this time, the enterprise administrator needs to add your mobile phone number in the background, and then Enterprise WeChat will identify the enterprise based on your mobile phone number. Then display your business and click the Enter Business option below. 4. Then you can enter the use of functions in the software. It can be said that the most important thing is that your mobile phone number must be added to the enterprise by the administrator, otherwise it will not be available.

How to implement student performance management function in Java? How to implement student performance management function in Java? Nov 04, 2023 pm 12:00 PM

How to implement student performance management function in Java? In the modern education system, student performance management is a very important task. By managing student performance, schools can better monitor students' learning progress, understand their weaknesses and strengths, and make more targeted teaching plans based on this information. In this article, we will discuss how to use Java programming language to implement student performance management functions. First, we need to determine the data structure of student grades. Typically, student grades can be represented as a

Replace the class name of an element using jQuery Replace the class name of an element using jQuery Feb 24, 2024 pm 11:03 PM

jQuery is a classic JavaScript library that is widely used in web development. It simplifies operations such as handling events, manipulating DOM elements, and performing animations on web pages. When using jQuery, you often encounter situations where you need to replace the class name of an element. This article will introduce some practical methods and specific code examples. 1. Use the removeClass() and addClass() methods jQuery provides the removeClass() method for deletion

What to do if the right-click menu management cannot be opened in Windows 10 What to do if the right-click menu management cannot be opened in Windows 10 Jan 04, 2024 pm 07:07 PM

When we use the win10 system, when we use the mouse to right-click the desktop or the right-click menu, we find that the menu cannot be opened and we cannot use the computer normally. At this time, we need to restore the system to solve the problem. Win10 right-click menu management cannot be opened: 1. First open our control panel, and then click. 2. Then click under Security and Maintenance. 3. Click on the right to restore the system. 4. If it still cannot be used, check whether there is something wrong with the mouse itself. 5. If you are sure there is no problem with the mouse, press + and enter. 6. After the execution is completed, restart the computer.

Detailed explanation of PHP Class usage: Make your code clearer and easier to read Detailed explanation of PHP Class usage: Make your code clearer and easier to read Mar 10, 2024 pm 12:03 PM

When writing PHP code, using classes is a very common practice. By using classes, we can encapsulate related functions and data in a single unit, making the code clearer, easier to read, and easier to maintain. This article will introduce the usage of PHPClass in detail and provide specific code examples to help readers better understand how to apply classes to optimize code in actual projects. 1. Create and use classes In PHP, you can use the keyword class to define a class and define properties and methods in the class.

How to set up address book blacklist on Xiaomi Mi 14? How to set up address book blacklist on Xiaomi Mi 14? Feb 24, 2024 pm 01:25 PM

When it comes to which mobile phone is the most popular recently, many people will probably think of the Xiaomi 14 which was just released. The performance configuration of this mobile phone is very good, and the user experience is also very good. In order to facilitate everyone's daily use, the editor will introduce it to you. Let’s take a look at how to set up the address book blacklist on Xiaomi Mi 14. Let’s take a look at the related content together! How to set up address book blacklist on Xiaomi Mi 14? Open the "Phone" app on the home screen of your phone, then find the "Contacts" option in the bottom navigation bar and click to enter. Browse the contact list, find the contact you want to add to the blacklist, and then press and hold the contact's avatar or name. After a while, a menu will pop up for you to choose an operation. Select "Blacklist this contact" or a similar option in the pop-up menu. The system will display the correct

PHP implements many-to-one address book: simple and practical contact management PHP implements many-to-one address book: simple and practical contact management Mar 15, 2024 pm 12:48 PM

PHP realizes many-to-one address book: simple and practical contact management. With the popularity of social networks, people's social relationships have become more and more complex, and managing contact information has become more and more important. In this context, it becomes particularly important to develop a simple and practical contact management system. This article will introduce how to use PHP to implement a many-to-one address book to add, delete, modify and search contact information. Functional design Before designing the contact management system, we need to determine the functional modules of the system, which mainly include: adding contacts

See all articles