Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql服务器、用户名和密码是否在php网站上公开?(mysql_连接)_Php_Mysql_Passwords - Fatal编程技术网

mysql服务器、用户名和密码是否在php网站上公开?(mysql_连接)

mysql服务器、用户名和密码是否在php网站上公开?(mysql_连接),php,mysql,passwords,Php,Mysql,Passwords,如果我的网站上有一个php脚本,例如: <?php mysql_connect("server","username","password"); mysql_select_db("commentbox"); $name=strip_tags($_POST['name']); $comment=strip_tags($_POST['comment']); $submit=strip_tags($_POST['submit']); ?> “mysql_connect(“服务器”、“

如果我的网站上有一个php脚本,例如:

<?php
mysql_connect("server","username","password");
mysql_select_db("commentbox");
$name=strip_tags($_POST['name']);
$comment=strip_tags($_POST['comment']);
$submit=strip_tags($_POST['submit']);
?>


“mysql_connect(“服务器”、“用户名”、“密码”);”是否对在该网页上查看源代码的所有人公开

如果您的意思是“查看源代码”,请使用浏览器的“查看源代码”功能,则不会。只要您的服务器配置为运行PHP,外部世界就永远看不到代码,只有运行脚本的输出。

如果您的Web服务器配置为解释PHP,并使用相应的扩展名(.PHP)保存文件,您的Web服务器将解析
中包含的所有内容,并且不会向通过您的Web服务器查看文件的用户显示任何内容,除非您使用函数创建输出,如
echo


不过,最好将包含敏感数据的文件放在不受web访问保护的目录中(即使用.htaccess文件)

您是否尝试过查看该网页的源代码?