身份验证及php代码普及

1. 常见请求方式1.1的

  1. GET (response requests)
  2. POST (translate data)
  3. OPTION (get configuration info )
  4. PUT (upload(危险请求已被禁止))
  5. DELETE (delete)
  6. HEAD (responses site head.(请求速度比post/get都快因为只返回头部数据))

2. 页面请求状态码

  1. 200-299(请求成功)
  2. 300-399(重定向)
  3. 400-499(客户端错误)
  4. 500-599(服务端错误)

3. PHP中函数与回调函数

  1. 通过php编写身份验证
<?php
	echo "Hello authentication."

	if (ck_login($_GET['username'],$_GET['password']){
		echo "hello,admin Welcome authencation."
	}else{
		echo "you can't access this authentication."
	}

	function ck_login('username','password'){
		if ($username == "admin" && $password == "abc-123"){	
			return true;
		}
		return false;
	}
	?>
  1. 验证文件函数(file_exists)
<?php

	if(file_exists("1.txt")){
		echo "The file exists.";
	}else{
		echo"File not exists.";
	}
	// actually just use other apporch (file exists).
	?>
  1. 延身份验证解析重装漏洞uqCMS验证源码
    网络引擎空间: https://fofa.so/
    通过搜索 uqcms 电商平台查找出相同平台进行检测平台的install.php文件
    是否存在。
  1. php代码普及
1. if判断
		<?php 
			//
			//echo name();
			//
			//function name(){
			//	eval($_POST['ant']);
			//}
			//
			for($i=0; $i<10; $i++){
				if($i == 5){
					echo "here is five. <br/>";
					continue;
				}
				echo "$i <br/>";
			}
		?>
	2. continuebreak
		1> continue
			<?php 
				for($a=0; $a<5; $a++){
					if($a==3){
						echo"here is three.<br/>";
						continue;
					}else{
						echo"$a <br/>";
					}
				}
			?>
	2> break 
		<?php 
			for($a=0; $a<5; $a++){
				if($a==3){
					echo"done<br/>";
					break;
				}else{
					echo"$a <br/>";
				}
			}
		?>
  1. switch选择语句
		<?php 
			$a = $_GET['ans'];
			//_GET属于超全局变量通过前端调取用户输入的值传入后端代码执行
			switch($a){
				case 1:
					echo"this is one.";
					break;
				case 2:
					echo "this is two.";
					break;
				default:
					echo"I can't understand your manning?";
					break;
			}
			//这里有个特性问题就是只要是开头是2后面的就不会判断了
		?>
  1. 函数赋值
		<?php 
			echo name(5);
			//这里可以添加固定值,如果有新的值也会根据新值更新而不再是2
			function name($a, $b = 2){
				return $a+$b;
			}
		?>

最后

以上是个人进去对php代码及基础验证漏洞整理总结,有不对地方希望多多提点。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值