├── module ├── for non php programmers │ ├── hi.md │ └── simple websites │ │ ├── tools │ │ ├── .htaccess │ │ └── viewsource_clean.php │ │ ├── README.md │ │ ├── view │ │ ├── clean.html │ │ ├── home.html │ │ └── about.html │ │ └── index.php └── readme.md ├── changelog.md ├── LICENSE ├── depreciated ├── viewsource_protect.php └── viewsource_noparam.php ├── README.md ├── viewsource_switch.php └── code draft └── unstable.php /module/for non php programmers/hi.md: -------------------------------------------------------------------------------- 1 | hi.. 2 | -------------------------------------------------------------------------------- /module/readme.md: -------------------------------------------------------------------------------- 1 | jika ada yang mau berkontribusi di module dipersilahkan~ 2 | -------------------------------------------------------------------------------- /module/for non php programmers/simple websites/tools/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all 2 | -------------------------------------------------------------------------------- /module/for non php programmers/simple websites/README.md: -------------------------------------------------------------------------------- 1 | # website contoh 2 | 3 |
4 | ini adalah website contoh yang menggunakan VSP versi 2.0.3 draft 4 5 | -------------------------------------------------------------------------------- /module/for non php programmers/simple websites/view/clean.html: -------------------------------------------------------------------------------- 1 |

2 | this is clean 3 |

4 |
5 | download source code on github
6 | Home, Sample Clean Viewsource 7 |
8 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 |

Changelog

2 | Version Official Release 2.0.0 . 3 | . 4 | . 5 | 6 | + removing Class 7 | + reason : PHP behave very weirdly on firefox so i wont use class anymore. 8 | + adding new features using cookies! 9 | + changing function name to vsp_start(),vsp_inspect() 10 | + old version still available if you want to do experiment with it 11 | -------------------------------------------------------------------------------- /module/for non php programmers/simple websites/view/home.html: -------------------------------------------------------------------------------- 1 |

2 | v 2.0.3 3 |

4 |
5 | download source code on github
6 | Sample Code, Sample Clean Viewsource 7 |
8 |
 9 | 
10 | # tested
11 | 
12 | Chrome, IE, Opera, Firefox, Edge, most of modern browser
13 | viewsource clean.
14 | 15 | 16 | # DEVS 17 | 18 | Agung ND 19 |
20 | 21 | -------------------------------------------------------------------------------- /module/for non php programmers/simple websites/index.php: -------------------------------------------------------------------------------- 1 | 2 | v 2.0.3 About 3 | 4 |
5 | download source code on github
6 | Home, Sample Clean Viewsource 7 |
8 | 9 |
10 | 
11 | 
12 | # tested
13 | 
14 | Chrome, IE, Opera, Firefox, Edge, most of modern browser
15 | viewsource clean.
16 | 17 | 18 | # fitur 19 | 20 | vsp_inspect(true/false)
21 | jika true maka F12 dan klik kanan akan ter-disable.
22 |

23 | vsp_start($param,false/$dir,false/$loader);
24 | $param = contoh domain.com/?PARAM misal diisi about
25 | false/$dir = jika false maka kode yang berada dibawah vsp_start akan berjalan
26 | jika mengisi &dir maka path yang ditentukan tersbut yang akan muncul.
27 | false/$loader = jika false maka view loader kalian tidak akan berjalan
28 | jika mengisi &loader maka loader yang ditentukan tersbut yang akan muncul.
29 | 30 | 31 | # contoh kode 1 (naked) 32 | 33 |
34 | require "/viewsource_switch.php";
35 | $param = 'about';
36 | vsp_kill();
37 | vsp_inspect(true);
38 | vsp_start($param,false,\_\_DIR\_\_."/loader.php");
39 | vsp_init($param);
40 | /\*kode berjalan dibawah vsp_start\*/
41 | echo 'maka kode ini akan berjalan, dan memiliki loader, kalau gakmau tinggal diganti ke false';
42 | vsp_kill();

43 | 44 | # contoh kode 2 (closed naked) 45 |
46 | require "/viewsource_switch.php";
47 | $param = 'about';
48 | vsp_kill();
49 | vsp_inspect(true);
50 | vsp_start($param,__DIR__."/view_about.php",__DIR__."/loader.php");
51 | vsp_init($param);
52 | vsp_kill();
53 | /*kode dibawah ini tidak akan berjalan, dan akan menjalankan kode view_about tersebut*/
54 |
55 | 56 | # contoh kode 3 (builder) 57 | 58 |
59 | require __DIR__."/viewsource_clean.php";
60 | vsp_kill();
61 | vsp_inspect(false);
62 | vsp_loader(__DIR__."/view/loader.html");
63 | vsp_builder('load' ,'home' ,__DIR__."/view/home.html" ,true);
64 | vsp_builder('load' ,'about' ,__DIR__."/view/about.html" ,true);
65 | vsp_builder('load' ,'clean' ,__DIR__."/view/clean.html" ,false);
66 | vsp_builder('redirect' ,'google' ,'https://google.com' ,true);
67 | vsp_default(true ,"redirect" ,"home");
68 | vsp_kill();` 69 |
70 | 71 | -------------------------------------------------------------------------------- /depreciated/viewsource_protect.php: -------------------------------------------------------------------------------- 1 | 10 |    └ require "/viewsource_clean.php";
11 | (can be anywhere in the world lol i mean folder)
12 | ``` 13 | 18 | 19 | # new version released! Ver 2.0.3 D5 , PHP 7.X 20 | __introducing secure page builder (read the docs)
21 | *__sample websites ready to run__*
22 | https://github.com/zonblade/php-view-source-protection/tree/main/module/for%20non%20php%20programmers/simple%20websites

23 | *__Sample Codes__*

24 | https://retas.dev/demo_script/viewsource.php?about=load&samplecodes
25 | *__whats new?__*
26 | + multi param! ?home=show¶m2=x¶m3=x&and_so_on
27 | + safer method 28 | + build in redirect option 29 | + build in anti rightclick, ctrl+u & f12 30 |
31 | 32 | # about this code 33 | this is raw code, edit it as fits your system build with basic logic.
34 | this code was intended to protect HTML files using simple render tools. 35 | which is usefull for UI/UX demo sites.
36 | developer of this code (me), are still active developing this code, feel free to post an issue or request
37 | feel free to modify this code as you need :) 38 | 39 | + why do i even need this if its is cant hide it completely? 40 | you know, view-source is impossible to hide! but now your dream come true! you can hide your viewsource ;) 41 | + for now this script can only do some trick , but i'm sure there's something else we can do with this logic in the future. 42 | 43 | # docs 44 | LANG_ID dokumentasi berbahasa indonesia
45 | https://github.com/zonblade/php-view-source-protection/wiki/(active)-ViewSource-Switch 46 |

47 | LANG_EN documentation
48 | soon 49 |

50 | live DEMO:
51 | https://retas.dev/demo_script/viewsource.php (no longger available)
52 | latest version (ready to use) check here :
53 | https://github.com/zonblade/php-view-source-protection/releases
54 | 55 | # tested browser 56 | + all modern browsers 57 | 58 | # License 59 | under MIT license 60 | + you can help me improve this code 61 | 62 | ## Created by 63 | obviously its me lol,
64 | instagram.com/zonblade 65 | 66 | ## changelog 67 | + parameter management (multi parameter); 68 | + *updated Documentation ID* 69 | + obliterate viewsource mode added 70 | + changing the code entirely 71 | + ADD PARAMETER MANAGEMENT 72 | + viewsource_protect.php (depreciated, but still exist, please use NOPARAM instead of this) 73 | + removing only LOAD parameter 74 | + Adding Load Render fixing Firefox bug. 75 | + Adding Firefox compability 76 | + Fixing Firefox compability 77 | -------------------------------------------------------------------------------- /depreciated/viewsource_noparam.php: -------------------------------------------------------------------------------- 1 | loader = $dir; 10 | $this->loader_time = $time; 11 | }else{ 12 | $this->loader_time = 0; 13 | } 14 | } 15 | function inspect($var){ 16 | /* 17 | kode javascript didapatkan dari stackoverflow 18 | https://stackoverflow.com/a/53511363 19 | thanks to PK-1825 20 | */ 21 | $this->inspect = ' 22 | 62 | '; 63 | if($var == true){ 64 | echo $this->inspect; 65 | } 66 | } 67 | function render_opt($render,$path,$key){ 68 | $this->render = $render; 69 | $this->path = $path; 70 | $this->keys = $key; 71 | } 72 | function render_load(){ 73 | if(isset($_POST['flock_load'])){ 74 | if($_POST['flock_load'] == $this->keys){ 75 | include $this->path; 76 | die(); 77 | }; 78 | }; 79 | } 80 | function start(){ 81 | session_start(); 82 | if($_GET['load'] == 'on'){ 83 | if(isset($this->loader)){ 84 | include $this->loader; 85 | $time = $this->loader_time; 86 | }else{ 87 | $time = 0; 88 | } 89 | $_SESSION["protect"] = true; 90 | $link_situs = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 91 | $link_situs = preg_replace('/(&|\?)'.preg_quote('load').'=[^&]*$/', '', $link_situs); 92 | $link_situs = preg_replace('/(&|\?)'.preg_quote('load').'=[^&]*&/', '$1', $link_situs); 93 | header("Refresh:$time;url=$link_situs"); 94 | die(); 95 | }else{ 96 | switch($_SESSION['protect']){ 97 | case false: 98 | header("location: ?load=on"); 99 | die(); 100 | break; 101 | default : 102 | $_SESSION['protect'] = false; 103 | if($this->render == true){ 104 | echo ' 105 | '; 106 | include $this->loader; 107 | echo ' 108 | 109 | 112 | '; 113 | die(); 114 | }else{ 115 | include $this->path; 116 | die(); 117 | } 118 | } 119 | } 120 | } 121 | function stop(){ 122 | session_start(); 123 | $_SESSION['protect'] = false; 124 | } 125 | function param_load($strict_param,$strict_value,$file_dir){ 126 | $this->StrictCase = $strict_param; 127 | $this->StrictDir = $file_dir; 128 | $this->StrictVal = $strict_value; 129 | } 130 | function param_start(){ 131 | switch($_GET[$this->StrictCase]){ 132 | case "$this->StrictVal": 133 | session_start(); 134 | if($_SESSION['strict'] != true){ 135 | header("location: ?$this->StrictCase=load"); 136 | die(); 137 | }else{ 138 | require_once $this->StrictDir; 139 | $_SESSION['strict'] = false; 140 | die(); 141 | } 142 | break; 143 | default: 144 | session_start(); 145 | $_SESSION['strict'] = true; 146 | include $this->loader; 147 | header("Refresh:$this->loader_time; url=?$this->StrictCase=$this->StrictVal",true,301); 148 | die(); 149 | } 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /viewsource_switch.php: -------------------------------------------------------------------------------- 1 | 15 | document.addEventListener("contextmenu", event => event.preventDefault()); 16 | window.onload = function () { 17 | document.addEventListener("contextmenu", function (e) { 18 | e.preventDefault(); 19 | }, false); 20 | document.addEventListener("keydown", function (e) { 21 | //document.onkeydown = function(e) { 22 | // "I" key 23 | if (e.ctrlKey && e.shiftKey && e.keyCode == 73) { 24 | disabledEvent(e); 25 | } 26 | // "J" key 27 | if (e.ctrlKey && e.shiftKey && e.keyCode == 74) { 28 | disabledEvent(e); 29 | } 30 | // "S" key + macOS 31 | if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { 32 | disabledEvent(e); 33 | } 34 | // "U" key 35 | if (e.ctrlKey && e.keyCode == 85) { 36 | disabledEvent(e); 37 | } 38 | // "F12" key 39 | if (event.keyCode == 123) { 40 | disabledEvent(e); 41 | } 42 | }, false); 43 | function disabledEvent(e) { 44 | if (e.stopPropagation) { 45 | e.stopPropagation(); 46 | } else if (window.event) { 47 | window.event.cancelBubble = true; 48 | } 49 | e.preventDefault(); 50 | return false; 51 | } 52 | } 53 | 54 | '; 55 | if($var == true){ 56 | echo $inspect; 57 | } 58 | }; 59 | function vsp_start($param,$dir,$load_dir) 60 | { 61 | session_start(); 62 | /* 63 | getting other params to save while loading 64 | */ 65 | $uri_current = $_SERVER['REQUEST_URI']; 66 | $uri_confirm = substr($uri_current, strpos($uri_current, "&") + 1); 67 | if(strpos($uri_current, '&') !== false){ 68 | $back_param = "&".$uri_confirm; 69 | }else{ 70 | $back_param = ''; 71 | } 72 | /* 73 | filter for not looping if got same param as main parameter! 74 | contohnya 75 | ?home=show&home=blabla > akan redirect ke ?home=load 76 | ?invalid=show&about= > akan redirect ke ?about=load 77 | */ 78 | if(strpos($back_param, $param) !== false) 79 | { 80 | /* 81 | fungsi clear cookies & redirect 82 | */ 83 | setcookie("vsp", "", time() - 3600); 84 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 85 | header("Refresh:0;url=?$param=load",true,301); 86 | die(); 87 | } 88 | /* 89 | checking up if everything exist 90 | */ 91 | if(isset($_GET) && !isset($_GET[$param]) && empty($_GET)) 92 | { 93 | /* 94 | fungsi clear cookies & redirect 95 | */ 96 | setcookie("vsp", "", time() - 3600); 97 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 98 | header("Refresh:0;url=?$param=load$back_param",true,301); 99 | die(); 100 | } 101 | /* 102 | getting the real deal 103 | */ 104 | switch($_GET[$param]){ 105 | case "show": 106 | if(empty($_COOKIE['vsp'])) 107 | { 108 | /* 109 | fungsi clear cookies & redirect 110 | */ 111 | setcookie("vsp", "", time() - 3600); 112 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 113 | header("Refresh:0;url=?$param=load$back_param",true,301); 114 | die(); 115 | }else{ 116 | if($dir == false) 117 | { 118 | setcookie("vsp", "", time() - 3600); 119 | } 120 | else 121 | { 122 | setcookie("vsp", "", time() - 3600); 123 | include $dir; 124 | die(); 125 | } 126 | } 127 | break; 128 | case 'load': 129 | /* 130 | fungsi load, disinilah kuncinya 131 | */ 132 | setcookie("vsp", "", time() - 3600); 133 | setcookie("vsp", "true"); 134 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 135 | header("Refresh:0;url=?$param=show$back_param",true,301); 136 | die(); 137 | default: 138 | if(empty($_COOKIE['vsp'])) 139 | { 140 | /* 141 | fungsi clear cookies & redirect 142 | */ 143 | setcookie("vsp", "", time() - 3600); 144 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 145 | header("Refresh:0;url=?$param=load$back_param",true,301); 146 | die(); 147 | } 148 | else 149 | { 150 | if($dir == false) 151 | { 152 | setcookie("vsp", "", time() - 3600); 153 | } 154 | else 155 | { 156 | setcookie("vsp", "", time() - 3600); 157 | include $dir; 158 | die(); 159 | } 160 | } 161 | } 162 | }; 163 | function vsp_init($param,$load_dir) 164 | { 165 | if(empty($_COOKIE['vsp'])){ 166 | /* 167 | fungsi clear cookies & redirect 168 | */ 169 | setcookie("vsp", "", time() - 3600); 170 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 171 | header("Refresh:0;url=?$param=load",true,301); 172 | die(); 173 | } 174 | }; 175 | function vsp_builder($type,$param,$dir,$load_dir) 176 | { 177 | if($type == 'load') 178 | { 179 | if(isset($_GET[$param]) && $dir != 'redirect') 180 | { 181 | vsp_start( $param,$dir,$load_dir); 182 | vsp_init( $param,$load_dir); 183 | die(); 184 | } 185 | } 186 | 187 | if($type == 'redirect') 188 | { 189 | if(isset($_GET[$param]) && $load_dir == true) 190 | { 191 | header("location: $dir"); 192 | die(); 193 | } 194 | elseif(isset($_GET[$param]) && $load_dir == false) 195 | { 196 | header("location: ?"); 197 | die(); 198 | } 199 | } 200 | }; 201 | function vsp_default($var,$dir,$redir_url) 202 | { 203 | if($dir != 'redirect' && $redir_url == false) 204 | { 205 | if($var == true){ 206 | include $dir; 207 | } 208 | } 209 | elseif($dir == 'redirect' && $redir_url != false) 210 | { 211 | header("location: ?$redir_url="); 212 | die(); 213 | } 214 | }; 215 | function vsp_kill() 216 | { 217 | session_start(); 218 | setcookie("vsp", "", time() - 3600); 219 | }; 220 | -------------------------------------------------------------------------------- /module/for non php programmers/simple websites/tools/viewsource_clean.php: -------------------------------------------------------------------------------- 1 | 15 | document.addEventListener("contextmenu", event => event.preventDefault()); 16 | window.onload = function () { 17 | document.addEventListener("contextmenu", function (e) { 18 | e.preventDefault(); 19 | }, false); 20 | document.addEventListener("keydown", function (e) { 21 | //document.onkeydown = function(e) { 22 | // "I" key 23 | if (e.ctrlKey && e.shiftKey && e.keyCode == 73) { 24 | disabledEvent(e); 25 | } 26 | // "J" key 27 | if (e.ctrlKey && e.shiftKey && e.keyCode == 74) { 28 | disabledEvent(e); 29 | } 30 | // "S" key + macOS 31 | if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { 32 | disabledEvent(e); 33 | } 34 | // "U" key 35 | if (e.ctrlKey && e.keyCode == 85) { 36 | disabledEvent(e); 37 | } 38 | // "F12" key 39 | if (event.keyCode == 123) { 40 | disabledEvent(e); 41 | } 42 | }, false); 43 | function disabledEvent(e) { 44 | if (e.stopPropagation) { 45 | e.stopPropagation(); 46 | } else if (window.event) { 47 | window.event.cancelBubble = true; 48 | } 49 | e.preventDefault(); 50 | return false; 51 | } 52 | } 53 | 54 | '; 55 | if($var == true){ 56 | echo $inspect; 57 | } 58 | }; 59 | function vsp_start($param,$dir,$load_dir) 60 | { 61 | session_start(); 62 | /* 63 | getting other params to save while loading 64 | */ 65 | $uri_current = $_SERVER['REQUEST_URI']; 66 | $uri_confirm = substr($uri_current, strpos($uri_current, "&") + 1); 67 | if(strpos($uri_current, '&') !== false){ 68 | $back_param = "&".$uri_confirm; 69 | }else{ 70 | $back_param = ''; 71 | } 72 | /* 73 | filter for not looping if got same param as main parameter! 74 | contohnya 75 | ?home=show&home=blabla > akan redirect ke ?home=load 76 | ?invalid=show&about= > akan redirect ke ?about=load 77 | */ 78 | if(strpos($back_param, $param) !== false) 79 | { 80 | /* 81 | fungsi clear cookies & redirect 82 | */ 83 | setcookie("vsp", "", time() - 3600); 84 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 85 | header("Refresh:0;url=?$param=load",true,301); 86 | die(); 87 | } 88 | /* 89 | checking up if everything exist 90 | */ 91 | if(isset($_GET) && !isset($_GET[$param]) && empty($_GET)) 92 | { 93 | /* 94 | fungsi clear cookies & redirect 95 | */ 96 | setcookie("vsp", "", time() - 3600); 97 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 98 | header("Refresh:0;url=?$param=load$back_param",true,301); 99 | die(); 100 | } 101 | /* 102 | getting the real deal 103 | */ 104 | switch($_GET[$param]){ 105 | case "show": 106 | if(empty($_COOKIE['vsp'])) 107 | { 108 | /* 109 | fungsi clear cookies & redirect 110 | */ 111 | setcookie("vsp", "", time() - 3600); 112 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 113 | header("Refresh:0;url=?$param=load$back_param",true,301); 114 | die(); 115 | }else{ 116 | if($dir == false) 117 | { 118 | setcookie("vsp", "", time() - 3600); 119 | } 120 | else 121 | { 122 | setcookie("vsp", "", time() - 3600); 123 | include $dir; 124 | die(); 125 | } 126 | } 127 | break; 128 | case 'load': 129 | /* 130 | fungsi load, disinilah kuncinya 131 | */ 132 | setcookie("vsp", "", time() - 3600); 133 | setcookie("vsp", "true"); 134 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 135 | header("Refresh:0;url=?$param=show$back_param",true,301); 136 | die(); 137 | default: 138 | if(empty($_COOKIE['vsp'])) 139 | { 140 | /* 141 | fungsi clear cookies & redirect 142 | */ 143 | setcookie("vsp", "", time() - 3600); 144 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 145 | header("Refresh:0;url=?$param=load$back_param",true,301); 146 | die(); 147 | } 148 | else 149 | { 150 | if($dir == false) 151 | { 152 | setcookie("vsp", "", time() - 3600); 153 | } 154 | else 155 | { 156 | setcookie("vsp", "", time() - 3600); 157 | include $dir; 158 | die(); 159 | } 160 | } 161 | } 162 | }; 163 | function vsp_init($param,$load_dir) 164 | { 165 | if(empty($_COOKIE['vsp'])){ 166 | /* 167 | fungsi clear cookies & redirect 168 | */ 169 | setcookie("vsp", "", time() - 3600); 170 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 171 | header("Refresh:0;url=?$param=load",true,301); 172 | die(); 173 | } 174 | }; 175 | function vsp_builder($type,$param,$dir,$load_dir) 176 | { 177 | if($type == 'load') 178 | { 179 | if(isset($_GET[$param]) && $dir != 'redirect') 180 | { 181 | vsp_start( $param,$dir,$load_dir); 182 | vsp_init( $param,$load_dir); 183 | die(); 184 | } 185 | } 186 | 187 | if($type == 'redirect') 188 | { 189 | if(isset($_GET[$param]) && $load_dir == true) 190 | { 191 | header("location: $dir"); 192 | die(); 193 | } 194 | elseif(isset($_GET[$param]) && $load_dir == false) 195 | { 196 | header("location: ?"); 197 | die(); 198 | } 199 | } 200 | }; 201 | function vsp_default($var,$dir,$redir_url) 202 | { 203 | if($dir != 'redirect' && $redir_url == false) 204 | { 205 | if($var == true){ 206 | include $dir; 207 | } 208 | } 209 | elseif($dir == 'redirect' && $redir_url != false) 210 | { 211 | header("location: ?$redir_url="); 212 | die(); 213 | } 214 | }; 215 | function vsp_kill() 216 | { 217 | session_start(); 218 | setcookie("vsp", "", time() - 3600); 219 | }; 220 | -------------------------------------------------------------------------------- /code draft/unstable.php: -------------------------------------------------------------------------------- 1 | 15 | document.addEventListener("contextmenu", event => event.preventDefault()); 16 | window.onload = function () { 17 | document.addEventListener("contextmenu", function (e) { 18 | e.preventDefault(); 19 | }, false); 20 | document.addEventListener("keydown", function (e) { 21 | //document.onkeydown = function(e) { 22 | // "I" key 23 | if (e.ctrlKey && e.shiftKey && e.keyCode == 73) { 24 | disabledEvent(e); 25 | } 26 | // "J" key 27 | if (e.ctrlKey && e.shiftKey && e.keyCode == 74) { 28 | disabledEvent(e); 29 | } 30 | // "S" key + macOS 31 | if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { 32 | disabledEvent(e); 33 | } 34 | // "U" key 35 | if (e.ctrlKey && e.keyCode == 85) { 36 | disabledEvent(e); 37 | } 38 | // "F12" key 39 | if (event.keyCode == 123) { 40 | disabledEvent(e); 41 | } 42 | }, false); 43 | function disabledEvent(e) { 44 | if (e.stopPropagation) { 45 | e.stopPropagation(); 46 | } else if (window.event) { 47 | window.event.cancelBubble = true; 48 | } 49 | e.preventDefault(); 50 | return false; 51 | } 52 | } 53 | 54 | '; 55 | if($var == true){ 56 | echo $inspect; 57 | } 58 | }; 59 | function vsp_start($param,$dir,$load_dir) 60 | { 61 | session_start(); 62 | /* 63 | getting other params to save while loading 64 | */ 65 | $uri_current = $_SERVER['REQUEST_URI']; 66 | $uri_confirm = substr($uri_current, strpos($uri_current, "&") + 1); 67 | if(strpos($uri_current, '&') !== false){ 68 | $back_param = "&".$uri_confirm; 69 | }else{ 70 | $back_param = ''; 71 | } 72 | /* 73 | filter for not looping if got same param as main parameter! 74 | contohnya 75 | ?home=show&home=blabla > akan redirect ke ?home=load 76 | ?invalid=show&about= > akan redirect ke ?about=load 77 | */ 78 | if(strpos($back_param, $param) !== false) 79 | { 80 | /* 81 | fungsi clear cookies & redirect 82 | */ 83 | $_SESSION['vsp'] = ''; 84 | setcookie("vsp", "", time() - 3600); 85 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 86 | header("Refresh:0;url=?$param=load",true,301); 87 | die(); 88 | } 89 | /* 90 | checking up if everything exist 91 | */ 92 | if(isset($_GET) && !isset($_GET[$param]) && empty($_GET)) 93 | { 94 | /* 95 | fungsi clear cookies & redirect 96 | */ 97 | $_SESSION['vsp'] = ''; 98 | setcookie("vsp", "", time() - 3600); 99 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 100 | header("Refresh:0;url=?$param=load$back_param",true,301); 101 | die(); 102 | } 103 | /* 104 | getting the real deal 105 | */ 106 | switch($_GET[$param]){ 107 | case "show": 108 | if(empty($_COOKIE['vsp']) && empty($_SESSION['vsp'])) 109 | { 110 | /* 111 | fungsi clear cookies & redirect 112 | */ 113 | $_SESSION['vsp'] = ''; 114 | setcookie("vsp", "", time() - 3600); 115 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 116 | header("Refresh:0;url=?$param=load$back_param",true,301); 117 | die(); 118 | }else{ 119 | if($dir == false) 120 | { 121 | $_SESSION['vsp'] = ''; 122 | setcookie("vsp", "", time() - 3600); 123 | } 124 | else 125 | { 126 | $_SESSION['vsp'] = ''; 127 | setcookie("vsp", "", time() - 3600); 128 | include $dir; 129 | die(); 130 | } 131 | } 132 | break; 133 | case 'load': 134 | /* 135 | fungsi load, disinilah kuncinya 136 | */ 137 | $_SESSION['vsp'] = ''; 138 | setcookie("vsp", "", time() - 3600); 139 | $_SESSION['vsp'] = true; 140 | setcookie("vsp", "true"); 141 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 142 | header("Refresh:0;url=?$param=show$back_param",true,301); 143 | die(); 144 | default: 145 | if(empty($_COOKIE['vsp']) && empty($_SESSION['vsp'])) 146 | { 147 | /* 148 | fungsi clear cookies & redirect 149 | */ 150 | $_SESSION['vsp'] = ''; 151 | setcookie("vsp", "", time() - 3600); 152 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 153 | header("Refresh:0;url=?$param=load$back_param",true,301); 154 | die(); 155 | } 156 | else 157 | { 158 | if($dir == false) 159 | { 160 | $_SESSION['vsp'] = ''; 161 | setcookie("vsp", "", time() - 3600); 162 | } 163 | else 164 | { 165 | $_SESSION['vsp'] = ''; 166 | setcookie("vsp", "", time() - 3600); 167 | include $dir; 168 | die(); 169 | } 170 | } 171 | } 172 | }; 173 | function vsp_init($param,$load_dir) 174 | { 175 | if(empty($_COOKIE['vsp'])){ 176 | /* 177 | fungsi clear cookies & redirect 178 | */ 179 | session_start(); 180 | $_SESSION['vsp'] = ''; 181 | setcookie("vsp", "", time() - 3600); 182 | if($load_dir == true){include VSP_LOADER;}else{echo '';}; 183 | header("Refresh:0;url=?$param=load",true,301); 184 | die(); 185 | } 186 | }; 187 | function vsp_builder($type,$param,$dir,$load_dir) 188 | { 189 | if($type == 'load') 190 | { 191 | if(isset($_GET[$param]) && $dir != 'redirect') 192 | { 193 | vsp_start( $param,$dir,$load_dir); 194 | vsp_init( $param,$load_dir); 195 | die(); 196 | } 197 | } 198 | 199 | if($type == 'redirect') 200 | { 201 | if(isset($_GET[$param]) && $load_dir == true) 202 | { 203 | header("location: $dir"); 204 | die(); 205 | } 206 | elseif(isset($_GET[$param]) && $load_dir == false) 207 | { 208 | header("location: ?"); 209 | die(); 210 | } 211 | } 212 | }; 213 | function vsp_default($var,$dir,$redir_url) 214 | { 215 | if($dir != 'redirect' && $redir_url == false) 216 | { 217 | if($var == true){ 218 | include $dir; 219 | } 220 | } 221 | elseif($dir == 'redirect' && $redir_url != false) 222 | { 223 | header("location: ?$redir_url="); 224 | die(); 225 | } 226 | }; 227 | function vsp_kill() 228 | { 229 | session_start(); 230 | $_SESSION['vsp'] = ''; 231 | setcookie("vsp", "", time() - 3600); 232 | }; 233 | --------------------------------------------------------------------------------