mail func added, post route added, more css
This commit is contained in:
		
							
								
								
									
										9
									
								
								libraries/console.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								libraries/console.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
function console_log($data) {
 | 
			
		||||
    $output = $data;
 | 
			
		||||
    if (is_array($output))
 | 
			
		||||
        $output = implode(',', $output);
 | 
			
		||||
 | 
			
		||||
    echo "<script>console.log('Debug Objects: " . $output . "' );</script>";
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								libraries/mail.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								libraries/mail.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
<?php
 | 
			
		||||
class Mail {
 | 
			
		||||
    public $from;
 | 
			
		||||
    public $to;
 | 
			
		||||
    public $subject;
 | 
			
		||||
    public $message;
 | 
			
		||||
    public $headers;
 | 
			
		||||
 | 
			
		||||
    function __construct($from, $to, $subject, $message, $headers=null) {
 | 
			
		||||
        $this->from = $from;
 | 
			
		||||
        $this->to = $to;
 | 
			
		||||
        $this->subject = $subject;
 | 
			
		||||
        $this->headers = $headers;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function send() {
 | 
			
		||||
        // odeslání e-mailu
 | 
			
		||||
        $headers = 'From: noreply@fofrweb.com' . "\r\n" .
 | 
			
		||||
            'Reply-To: support@fofrweb.com' . "\r\n" .
 | 
			
		||||
            'X-Mailer: PHP/' . phpversion();
 | 
			
		||||
        $this->headers = $headers;
 | 
			
		||||
 | 
			
		||||
        if (gettype($this->message) == 'string') {
 | 
			
		||||
            if(mail($this->to, $this->subject, $this->message, $this->headers)) {
 | 
			
		||||
                return 0;
 | 
			
		||||
            } else {
 | 
			
		||||
                return 1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,12 +2,15 @@
 | 
			
		||||
class Router {
 | 
			
		||||
	public $returned = false;
 | 
			
		||||
 | 
			
		||||
	function route($url, $filename) {
 | 
			
		||||
		if($_SERVER['REQUEST_METHOD'] == 'GET') {
 | 
			
		||||
			if ($_SERVER['REQUEST_URI'] == $url) {
 | 
			
		||||
				require_once("./pages/$filename/$filename.php");
 | 
			
		||||
				$this->returned = true;
 | 
			
		||||
				return;
 | 
			
		||||
	function route($method, $url, $filename) {
 | 
			
		||||
		$methods = ['GET', 'POST'];
 | 
			
		||||
		if(in_array($method, $methods)) {
 | 
			
		||||
			if($_SERVER['REQUEST_METHOD'] == $method) {
 | 
			
		||||
				if ($_SERVER['REQUEST_URI'] == $url) {
 | 
			
		||||
					require_once("./pages/$filename/$filename.php");
 | 
			
		||||
					$this->returned = true;
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user