├── .gitattributes ├── LICENSE ├── example ├── index.php └── style.css ├── HTMLhider.class.php ├── README.md └── hjs.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Ayoob Ali 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /example/index.php: -------------------------------------------------------------------------------- 1 | hide($FullHTMLpage); 16 | * $hider->activateJS(); 17 | * echo $hider->getHiddenPage(); 18 | * 19 | */ 20 | 21 | include ( "../HTMLhider.class.php" ); 22 | 23 | $hider = new \HTMLhider\hider(); 24 | $hider->setJSpath('../hjs.php'); 25 | 26 | $tempPage = <<< EOF 27 | 28 | 29 | 30 | HTML Hider 31 | 32 | 33 | 34 |
35 |
36 |
HTML Hider
37 |
38 | This tool will hide the HTML source code of your page from the normal 'view source' option.
39 | Get a copy from GitHub. 40 |
41 |
Copyright (c) 2015 AyoobAli.com
42 |
43 |
44 | 45 | 46 | EOF; 47 | 48 | $hider->hide( $tempPage ); 49 | 50 | echo $hider->getHiddenPage( true ); 51 | 52 | ?> -------------------------------------------------------------------------------- /example/style.css: -------------------------------------------------------------------------------- 1 | 2 | * { 3 | -webkit-font-smoothing: antialiased !important; 4 | text-shadow: 1px 1px 1px rgba(0,0,0,0.004); 5 | } 6 | html, body { 7 | font-family: monospace; 8 | font-size: 14px; 9 | background-color: #f3f3f3; 10 | margin: 0px; 11 | padding: 0px; 12 | color: #191919; 13 | width: 100%; 14 | height: 100%; 15 | display: table; 16 | } 17 | a:link {color: #496283; text-decoration: none;} 18 | a:visited {color: #496283; text-decoration: none;} 19 | a:hover {color: #758da8; text-decoration: none;} 20 | a:active {color: #758da8; text-decoration: none;} 21 | div.container { 22 | height: 98%; 23 | display: table-cell; 24 | vertical-align: middle; 25 | text-align: center; 26 | } 27 | div.section { 28 | width: 988px; 29 | background-color: #FFFFFF; 30 | border: 1px solid #e3e3e3; 31 | display: inline-block; 32 | text-align: left; 33 | } 34 | div.sectitle { 35 | background-color: #EDEDED; 36 | font-family: "Open Sans"; 37 | font-size: 36px; 38 | border-color: #e3e3e3; 39 | padding: 0 20px; 40 | } 41 | div.secfooter { 42 | color: #808080; 43 | text-align: center; 44 | background-color: #EDEDED; 45 | font-size: 12px; 46 | border-color: #e3e3e3; 47 | padding: 0 20px; 48 | height: 40px; 49 | line-height: 40px; 50 | vertical-align: middle; 51 | } 52 | div.seccontent { margin: 50px 5px; } 53 | .btl { border-top-left-radius: 5px; } 54 | .btr { border-top-right-radius: 5px; } 55 | .bbl { border-bottom-left-radius: 5px; } 56 | .bbr { border-bottom-right-radius: 5px; } 57 | .bl { border-left-width: 1px; border-left-style: solid; } 58 | .br { border-right-width: 1px; border-right-style: solid; } 59 | .bt { border-top-width: 1px; border-top-style: solid; } 60 | .bb { border-bottom-width: 1px; border-bottom-style: solid; } 61 | .ba { border-width: 1px; border-style: solid; } 62 | .tal { text-align: left; } 63 | .tar { text-align: right; } 64 | .tac { text-align: center; } 65 | .taj { text-align: justify; } -------------------------------------------------------------------------------- /HTMLhider.class.php: -------------------------------------------------------------------------------- 1 | hide($FullHTMLpage); 16 | * $hider->activateJS(); 17 | * echo $hider->getHiddenPage(); 18 | * 19 | */ 20 | 21 | namespace HTMLhider; 22 | 23 | class hider 24 | { 25 | private $hiddenData = ""; 26 | private $showErrors = false; 27 | private $lastError = ""; 28 | private $javascriptPath = "/hjs.php"; 29 | 30 | public function __construct( $session = true ) 31 | { 32 | if ( $session == true ) { 33 | session_start(); 34 | } 35 | } 36 | 37 | // Hide Data 38 | public function hide( $string = "" ) 39 | { 40 | if ( $string == "" ) { 41 | $this->ErrorMSG( "String can't be empty." ); 42 | return false; 43 | } else { 44 | $arr = str_split( $string ); 45 | $data = ""; 46 | foreach ( $arr as $key => $value ) { 47 | $data .= sprintf( "%08d", decbin( ord( $value ) ) ); 48 | } 49 | $data = str_replace( "1", chr( 9 ), $data ); 50 | $data = str_replace( "0", chr( 32 ), $data ); 51 | $this->hiddenData .= $data; 52 | return $data; 53 | } 54 | } 55 | 56 | // Change JavaScript file Path 57 | public function setJSpath( $path = "" ) 58 | { 59 | if ( trim( $path ) == "" ) { 60 | $this->ErrorMSG( "path can't be empty" ); 61 | return false; 62 | } else { 63 | $this->javascriptPath = trim( $path ); 64 | return $this->javascriptPath; 65 | } 66 | } 67 | 68 | // Clear Hidden Data 69 | public function clearHiddenData() 70 | { 71 | $this->hiddenData = ""; 72 | return $this->hiddenData; 73 | } 74 | 75 | // Activate javascript 76 | public function activateJS() 77 | { 78 | if ( session_id() === '' ) { 79 | $this->ErrorMSG( "Session is not active." ); 80 | return false; 81 | } else { 82 | $_SESSION['HTMLhider'] = true; 83 | return true; 84 | } 85 | } 86 | 87 | // Get hidden HTML page 88 | public function getHiddenPage( $activateJS = false ) 89 | { 90 | $hiddenPage = '' . "\n"; 93 | $hiddenPage .= $this->hiddenData; 94 | $hiddenPage .= "\n"; 95 | if ( $activateJS === true ) { 96 | $this->activateJS(); 97 | } 98 | return $hiddenPage; 99 | } 100 | 101 | // Get Hidden Data 102 | public function getHiddenData() 103 | { 104 | return $this->hiddenData; 105 | } 106 | 107 | // Get JavaScript file Path 108 | public function getJSpath() 109 | { 110 | return $this->javascriptPath; 111 | } 112 | 113 | // Set Show Errors 114 | public function setShowErrors( $trueOrFalse = true ) 115 | { 116 | if ( $trueOrFalse == false ) { 117 | $this->showErrors = false; 118 | } else { 119 | $this->showErrors = true; 120 | } 121 | return $this->showErrors; 122 | } 123 | 124 | // Get Show Errors 125 | public function getShowErrors() 126 | { 127 | return $this->showErrors; 128 | } 129 | 130 | // Get Last Error 131 | public function getLastError() 132 | { 133 | return $this->lastError; 134 | } 135 | 136 | // Show error messages 137 | private function ErrorMSG( $string = "" ) 138 | { 139 | $this->lastError = "Error: " . $string . "."; 140 | if ( $this->showErrors === true ) { 141 | echo $this->lastError . "\n
"; 142 | } 143 | return $this->lastError; 144 | } 145 | 146 | } 147 | 148 | ?> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HTML Hider 2 | This tool will hide the HTML source code of your page from the normal 'view source' option. 3 | 4 | 5 | Use:- 6 | ```php 7 | hide($FullHTMLpage); 11 | $hider->activateJS(); 12 | echo $hider->getHiddenPage(); 13 | ?> 14 | ``` 15 | 16 | It will change this page:- 17 | ```html 18 | 19 | 20 | 21 | HTML Hider 22 | 23 | 24 | 25 |
26 |
27 |
HTML Hider
28 |
29 | This tool will hide the HTML source code of your page from the normal 'view source' option.
30 | Get a copy from GitHub. 31 |
32 |
Copyright (c) 2015 AyoobAli.com
33 |
34 |
35 | 36 | 37 | ``` 38 | 39 | To this:- 40 | ```html 41 | 42 | 43 | 44 | 45 | ``` 46 | 47 | Website: [www.AyoobAli.com](http://www.AyoobAli.com) 48 | -------------------------------------------------------------------------------- /hjs.php: -------------------------------------------------------------------------------- 1 | --------------------------------------------------------------------------------