mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	feature: added epay & mGate payment
This commit is contained in:
		
							
								
								
									
										42
									
								
								library/Epay.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								library/Epay.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Library; | ||||
|  | ||||
| class Epay | ||||
| { | ||||
|     private $pid; | ||||
|     private $key; | ||||
|     private $url; | ||||
|  | ||||
|     public function __construct($url, $pid, $key) | ||||
|     { | ||||
|         $this->pid = $pid; | ||||
|         $this->key = $key; | ||||
|         $this->url = $url; | ||||
|     } | ||||
|  | ||||
|     public function pay($params) | ||||
|     { | ||||
|         $params['pid'] = $this->pid; | ||||
|         ksort($params); | ||||
|         reset($params); | ||||
|         $str = stripslashes(urldecode(http_build_query($params))) . $this->key; | ||||
|         $params['sign'] = md5($str); | ||||
|         $params['sign_type'] = 'MD5'; | ||||
|         return $this->url . '/submit.php?' . http_build_query($params); | ||||
|     } | ||||
|  | ||||
|     public function verify($params) | ||||
|     { | ||||
|         $sign = $params['sign']; | ||||
|         unset($params['sign']); | ||||
|         unset($params['sign_type']); | ||||
|         ksort($params); | ||||
|         reset($params); | ||||
|         $str = stripslashes(urldecode(http_build_query($params))) . $this->key; | ||||
|         if ($sign !== md5($str)) { | ||||
|             return false; | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user