search
Homephp教程PHP源码php常见问题和解决方法二接上

<script>ec(2);</script>

15:什么是UBB代码


UBB代码是HTML的一个变种,是Ultimate Bulletin Board (国外一个BBS程序,国内也有不少地方使用这个程序)采用的一种特殊的TAG.
即使禁止使用 HTML,你也可以用 UBBCode? 来实现.也许你更希望使用 UBBCode? 而不是 HTML, 即使论坛允许使用 HTML, 因为使用起来代码较少也更安全.

Q3boy的UBB里面付有例子,可以直接运行测试


16:我想修改MySQL的用户,密码

首先要声明一点,大部分情况下,修改MySQL是需要有mysql里的root权限的, 
所以一般用户无法更改密码,除非请求管理员.

方法一 
  使用phpmyadmin,这是最简单的了,修改mysql库的user表, 
  不过别忘了使用PASSWORD函数。 

方法二 
  使用mysqladmin,这是前面声明的一个特例。 
  mysqladmin -u root -p password mypasswd 
  输入这个命令后,需要输入root的原密码,然后root的密码将改为mypasswd。 
  把命令里的root改为你的用户名,你就可以改你自己的密码了。 
  当然如果你的mysqladmin连接不上mysql server,或者你没有办法执行mysqladmin, 
  那么这种方法就是无效的。 
  而且mysqladmin无法把密码清空。 

下面的方法都在mysql提示符下使用,且必须有mysql的root权限: 
  方法三 
  mysql> INSERT INTO mysql.user (Host,User,Password) 
  VALUES('%','jeffrey',PASSWORD('biscuit')); 
  mysql> FLUSH PRIVILEGES 
  确切地说这是在增加一个用户,用户名为jeffrey,密码为biscuit。 
  在《mysql中文参考手册》里有这个例子,所以我也就写出来了。 
  注意要使用PASSWORD函数,然后还要使用FLUSH PRIVILEGES。 

方法四 
  和方法三一样,只是使用了REPLACE语句 
  mysql> REPLACE INTO mysql.user (Host,User,Password) 
  VALUES('%','jeffrey',PASSWORD('biscuit')); 
  mysql> FLUSH PRIVILEGES 

方法五 
  使用SET PASSWORD语句, 
  mysql> SET PASSWORD FOR jeffrey@"%" = PASSWORD('biscuit'); 
  你也必须使用PASSWORD()函数, 
  但是不需要使用FLUSH PRIVILEGES。 

方法六 
  使用GRANT ... IDENTIFIED BY语句 
  mysql> GRANT USAGE ON *.* TO jeffrey@"%" IDENTIFIED BY 'biscuit'; 
  这里PASSWORD()函数是不必要的,也不需要使用FLUSH PRIVILEGES。 

注意: PASSWORD() [不是]以在Unix口令加密的同样方法施行口令加密。 


17:我想知道他是通过哪个网站连接到本页



PHP代码:--------------------------------------------------------------------------------

//必须通过超级连接进入才有输出
Echo $_SERVER['HTTP_REFERER'];
?>

--------------------------------------------------------------------------------



18:数据放入数据库和取出来显示在页面需要注意什么

入库时
$str=addslashes($str);
$sql="insert into `tab` (`content`) values('$str')";
出库时
$str=stripslashes($str);
显示时
$str=htmlspecialchars(nl2br($str)) ; 





19:如何读取当前地址栏信息



PHP代码:--------------------------------------------------------------------------------

$s="http://{$_SERVER['HTTP_HOST']}:{$_SERVER["SERVER_PORT"]}{$_SERVER['SCRIPT_NAME']}"; 
$se=''; 
foreach ($_GET as $key => $value) {     
$se.=$key."=".$value."&";     
}   
$se=Preg_Replace("/(.*)&$/","$1",$se); 
$se?$se="?".$se:"";
echo   $s."?$se"; 
?> 
--------------------------------------------------------------------------------




20:我点击后退按钮,为什么之前填写的东西不见

这是因为你使用了session.
解决办法:

PHP代码:--------------------------------------------------------------------------------

session_cache_limiter('private, must-revalidate');
session_start(); 
...........
..........
?>

--------------------------------------------------------------------------------



21:怎么在图片里显示IP地址


PHP代码:--------------------------------------------------------------------------------


  Header("Content-type: image/png");
  $img = ImageCreate(180,50);
  $ip = $_SERVER['REMOTE_ADDR'];
  ImageColorTransparent($img,$bgcolor);
  $bgColor = ImageColorAllocate($img, 0x2c,0x6D,0xAF); // 背景颜色
  $shadow = ImageColorAllocate($img, 250,0,0);    // 阴影颜色
  $textColor = ImageColorAllocate($img, oxff,oxff,oxff);       // 字体颜色
  ImageTTFText($img,10,0,78,30,$shadow,"d:/windows/fonts/Tahoma.ttf",$ip); //显示背景
  ImageTTFText($img,10,0,25,28,$textColor,"d:/windows/fonts/Tahoma.ttf","your ip is".$ip); // 显示IP
  ImagePng($img);
  imagecreatefrompng($img);
  ImageDestroy($img);
?>

Statement
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

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.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment