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

php常见问题和解决方法二接上

Jun 08, 2016 pm 05:33 PM
mysql nbsp quot server

<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 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 open phpmyadmin How to open phpmyadmin Apr 10, 2025 pm 10:51 PM

You can open phpMyAdmin through the following steps: 1. Log in to the website control panel; 2. Find and click the phpMyAdmin icon; 3. Enter MySQL credentials; 4. Click "Login".

MySQL: An Introduction to the World's Most Popular Database MySQL: An Introduction to the World's Most Popular Database Apr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

How to use single threaded redis How to use single threaded redis Apr 10, 2025 pm 07:12 PM

Redis uses a single threaded architecture to provide high performance, simplicity, and consistency. It utilizes I/O multiplexing, event loops, non-blocking I/O, and shared memory to improve concurrency, but with limitations of concurrency limitations, single point of failure, and unsuitable for write-intensive workloads.

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Why Use MySQL? Benefits and Advantages Why Use MySQL? Benefits and Advantages Apr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Centos install mysql Centos install mysql Apr 14, 2025 pm 08:09 PM

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

See all articles