├── app ├── images │ ├── cpu.png │ ├── sd.png │ ├── swap.png │ ├── bargraph.gif │ ├── memory.png │ ├── reboot.png │ ├── update.png │ └── uptime.png ├── classes │ ├── _logout.php │ ├── _uptime.php │ ├── _runningService.php │ ├── _login.php │ ├── _cpu.php │ ├── _versionCheck.php │ ├── _hdd.php │ └── _ram.php ├── commands │ ├── _reboot.php │ ├── _updatefirmware.php │ ├── _command.php │ └── _updatesources.php ├── includes │ ├── _footer.php │ └── _header.php └── styles │ └── style.css ├── logout.php ├── testcmd.php ├── index.php ├── README ├── instructions └── index.html ├── setup.php └── main.php /app/images/cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/cpu.png -------------------------------------------------------------------------------- /app/images/sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/sd.png -------------------------------------------------------------------------------- /app/images/swap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/swap.png -------------------------------------------------------------------------------- /app/images/bargraph.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/bargraph.gif -------------------------------------------------------------------------------- /app/images/memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/memory.png -------------------------------------------------------------------------------- /app/images/reboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/reboot.png -------------------------------------------------------------------------------- /app/images/update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/update.png -------------------------------------------------------------------------------- /app/images/uptime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weah/Raspcontrol/HEAD/app/images/uptime.png -------------------------------------------------------------------------------- /logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/classes/_logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/commands/_reboot.php: -------------------------------------------------------------------------------- 1 | 9 | 10 |
Your Raspberry Pi is now rebooting!
11 | -------------------------------------------------------------------------------- /testcmd.php: -------------------------------------------------------------------------------- 1 | ".$shell.""; 13 | ?> -------------------------------------------------------------------------------- /app/classes/_uptime.php: -------------------------------------------------------------------------------- 1 | Uptime: $uptime"; 9 | } 10 | } 11 | 12 | ?> 13 | -------------------------------------------------------------------------------- /app/commands/_updatefirmware.php: -------------------------------------------------------------------------------- 1 | '; 9 | 10 | $last_line = system('sudo rpi-update', $retval); 11 | 12 | // Printing additional info 13 | echo ' 14 | '; ?> 15 | Firmware Update Complete!
16 | Return To Previous Page 17 | -------------------------------------------------------------------------------- /app/classes/_runningService.php: -------------------------------------------------------------------------------- 1 | ".ucfirst($shell).""; 16 | 17 | 18 | } 19 | } 20 | ?> 21 | -------------------------------------------------------------------------------- /app/commands/_command.php: -------------------------------------------------------------------------------- 1 | '; 9 | 10 | // Outputs all the result of shellcommand "ls", and returns 11 | // the last output line into $last_line. Stores the return value 12 | // of the shell command in $retval. 13 | 14 | $command = $_POST['command']; 15 | 16 | $last_line = system('sudo '.$command, $retval); 17 | 18 | // Printing additional info 19 | echo ' 20 | '; ?> 21 | -------------------------------------------------------------------------------- /app/commands/_updatesources.php: -------------------------------------------------------------------------------- 1 | '; 9 | 10 | // Outputs all the result of shellcommand "ls", and returns 11 | // the last output line into $last_line. Stores the return value 12 | // of the shell command in $retval. 13 | $last_line = system('sudo apt-get update', $retval); 14 | 15 | // Printing additional info 16 | echo ' 17 | '; ?> 18 | Source Update Complete!
19 | Return To Previous Page 20 | -------------------------------------------------------------------------------- /app/classes/_login.php: -------------------------------------------------------------------------------- 1 | {'user'}; 8 | $password = $db->{'password'}; 9 | 10 | if($_POST['username'] == $username && $_POST['password'] == $password){ 11 | 12 | $_SESSION['username'] = $username; ?> 13 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /app/includes/_footer.php: -------------------------------------------------------------------------------- 1 |
2 |
3 | Powered by Raspcontrol 4 | 5 | Logout · '; 11 | $versionCheck = new versionCheck; $checkVersion = $versionCheck->checkVersion(); 12 | } 13 | ?> 14 | 15 |
16 |
17 | 18 | -------------------------------------------------------------------------------- /app/classes/_cpu.php: -------------------------------------------------------------------------------- 1 | 1) { 11 | $warning = " (Warning)"; 12 | } else { 13 | $warning = " (OK)"; 14 | } 15 | 16 | echo " CPU ".$warning.":

"; 17 | echo "Loads: 1 Min: ".$getLoad[0]." · "; 18 | echo "5 Mins: ".$getLoad[1]." · "; 19 | echo "15 Mins: ".$getLoad[2]."

CPU is running at ".$cpuSpeed."MHz"; 20 | 21 | } 22 | } 23 | 24 | ?> 25 | -------------------------------------------------------------------------------- /app/classes/_versionCheck.php: -------------------------------------------------------------------------------- 1 | $version && $read[2] == "1") { $critical = TRUE; } // If its 1, set ciritcal to true 12 | if ($read[0] > $version) { $update = TRUE; } // Anything other than 1 set update to true 13 | if ($critical) { 14 | print 'There is a critical update available (Version: '.$read[0].')!
You can get it at '.$read[3].' (Description: '.$read[1].')

'; 15 | }else if ($update){ 16 | print 'There is a none critical update available (Version: '.$read[0].')!
You can get it at '.$read[3].' (Description: '.$read[1].')

'; 17 | } 18 | 19 | } 20 | } 21 | ?> -------------------------------------------------------------------------------- /app/includes/_header.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | Raspcontrol - The Raspberry Pi Control Centre 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |

Raspcontrol

18 | 19 |

The Raspberry Pi Control Centre

20 |
21 | 22 | 26 | 27 |
28 | Hostname: · Internal IP:
29 | Accessed From: · Port · System:
30 | 31 | 32 |
33 | 34 | 36 | 37 |
38 |
39 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 |
13 |
14 | 15 |
16 |
17 | Please login to Raspcontrol!

18 |
19 | 20 |
21 | 22 | 23 |

24 | 25 | Incorrect Username/Password"; 27 | } 28 | ?> 29 | 30 |
31 |
32 |
33 | 34 |
35 |


36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | How to setup Raspcontrol 2 | Typical Installation Requirements: 3 | 4 | OS: Raspbian/Debian Wheezy 5 | HTTP: Apache 2 (sudo apt-get install apache2) 6 | Language: PHP-5 (sudo apt-get install php5) 7 | 8 | How to setup 9 | 10 | Upload everything within the .ZIP file you have downloaded from GitHub into a folder called raspcontrol within your web accessible directory (Apaches Default is located in /var/www). 11 | 12 | You must add www-data on Apache (or your HTTP user on another HTTP Server) to your sudoers file, which means they can run Superuser Commands, to do this from the shell type 'sudo visudo' scroll to the bottom of the file and on the last line add: 'www-data ALL=(ALL) NOPASSWD: ALL' 13 | 14 | If you're accessing Apaches web directory on your Raspberry Pi (using startx) you can navigate to http://localhost/raspcontrol, if you're accessing it from another computer on your Network you will need to navigate to http://your.iternal.ip/raspcontrol. 15 | 16 | Once you can see a login screen you have successfully uploaded Raspcontrol to your Raspberry Pi, now you need to navigate to raspcontrol/setup.php, this will create the initial user to login to the system, you can then log in with the username "admin" and the password that you chose during setup. 17 | 18 | 19 | Further Information 20 | This is an ongoing development, if you wish you can pull the repo from GitHub and contribute to any part of the code, this manual will be improved or you can improve it yourself! 21 | 22 | Contributors: 23 | 24 | Bioshox (http://www.fusionstrike.com) 25 | VeoPVM (http://rpi-blog.com) 26 | -------------------------------------------------------------------------------- /app/classes/_hdd.php: -------------------------------------------------------------------------------- 1 | '80'){ 26 | echo ' 27 |
SD Card (Warning): 28 |

'.$percentage.'%
   
; '; 29 | }else{ 30 | echo ' 31 |
SD Card (OK): 32 |
'.$percentage.'%
   
'; 33 | } 34 | 35 | 36 | echo "
Total: ".$total." GB · "; 37 | echo "Free: ".$free." GB"; 38 | echo "
"; 39 | 40 | 41 | } 42 | } 43 | ?> 44 | -------------------------------------------------------------------------------- /instructions/index.html: -------------------------------------------------------------------------------- 1 |

How to setup Raspcontrol

2 |

Typical Installation Requirements:

3 | 4 |

5 |

10 |

11 | 12 |

How to setup

13 | 23 | 24 |

Further Information

25 |

This is an ongoing development, if you wish you can pull the repo from GitHub and contribute to any part of the code, this manual will be improved or you can improve it yoursefl!

26 |
27 | Fusion Strike · Raspcontrol on GitHub -------------------------------------------------------------------------------- /setup.php: -------------------------------------------------------------------------------- 1 | $output"; 10 | $myFile = "/etc/raspcontrol/database.aptmnt"; 11 | $fh = fopen($myFile, 'w') or die("can't open file"); 12 | $stringData = '{ 13 | "user": "' . $_POST['username'] .'", 14 | "password": "' . $_POST['password'] .'" 15 | }'; 16 | fwrite($fh, $stringData); 17 | header('location: index.php'); 18 | } else { 19 | 20 | ?> 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | Raspcontrol Installation 29 |

30 |
Please choose a username and password to login with

31 |
32 | 33 |
34 | 35 | 36 | 37 |
38 |



39 | 40 |
41 |
42 | 43 | -------------------------------------------------------------------------------- /main.php: -------------------------------------------------------------------------------- 1 | 9 | 10 | 17 | 18 |
19 |
20 | 21 | getSystemUptime();?> 22 | 23 |
24 | 25 |

26 | 27 | getCpuLoad();?> 28 | 29 |
30 | 31 |

32 | 33 | freeMemory(); $percentage = $ram->freeSwap();?> 34 | 35 |
36 | 37 |

38 | 39 | freeStorage();?> 40 | 41 |
42 | 43 |

44 | 45 | 46 |
47 | Mission Control:

48 | 49 | 50 | "; 53 | } 54 | ?> 55 | 56 |
57 | 58 |
59 |

60 |
61 | 62 | 63 | 64 | 78 | -------------------------------------------------------------------------------- /app/classes/_ram.php: -------------------------------------------------------------------------------- 1 | '80'){ 11 | echo ' 12 |
Memory (Warning): 13 |
'.$percentage.'%
   
'; 14 | }else{ 15 | echo ' 16 |
Memory (OK): 17 |
'.$percentage.'%
   
'; 18 | } 19 | 20 | echo "
Free: ". ($free + $buffers + $cached) ." MB Used: " . ($used - $buffers - $cached) . " MB · Total: " . $total." MB
"; 21 | 22 | } 23 | 24 | function freeSwap(){ 25 | exec('free -mo', $out); 26 | preg_match_all('/\s+([0-9]+)/', $out[2], $matches); 27 | list($total, $used, $free) = $matches[1]; 28 | 29 | $percentage = round($used / $total * 100); 30 | 31 | if($percentage > '80'){ 32 | echo ' 33 |
Swap (Warning): 34 |
'.$percentage.'%
   
'; 35 | }else{ 36 | echo ' 37 |
Swap (OK): 38 |
'.$percentage.'%
   
'; 39 | } 40 | 41 | echo "
Free: ". ($free + $buffers + $cached) ." MB Used: " . ($used - $buffers - $cached) . " MB · Total: " . $total." MB
"; 42 | } 43 | } 44 | 45 | ?> 46 | -------------------------------------------------------------------------------- /app/styles/style.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, applet, object, iframe, 2 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 3 | a, abbr, acronym, address, big, cite, code, 4 | del, dfn, em, img, ins, kbd, q, s, samp, 5 | small, strike, sub, sup, tt, var, 6 | b, u, i, center, 7 | dl, dt, dd, ol, ul, li, 8 | fieldset, form, label, legend, 9 | table, caption, tbody, tfoot, thead, tr, th, td, 10 | article, aside, canvas, details, embed, 11 | figure, figcaption, footer, header, hgroup, 12 | menu, nav, output, ruby, section, summary, 13 | time, mark, audio, video { 14 | margin: 0; 15 | padding: 0; 16 | border: 0; 17 | font-size: 100%; 18 | font: inherit; 19 | vertical-align: baseline; 20 | } 21 | /* HTML5 display-role reset for older browsers */ 22 | article, aside, details, figcaption, figure, 23 | footer, header, hgroup, menu, nav, section { 24 | display: block; 25 | } 26 | body { 27 | line-height: 1; 28 | } 29 | ol, ul { 30 | list-style: none; 31 | } 32 | blockquote, q { 33 | quotes: none; 34 | } 35 | blockquote:before, blockquote:after, 36 | q:before, q:after { 37 | content: ''; 38 | content: none; 39 | } 40 | table { 41 | border-collapse: collapse; 42 | border-spacing: 0; 43 | } 44 | 45 | body{ 46 | background: #f5f5f5 47 | } 48 | 49 | 50 | 51 | h1{ 52 | color: #eeeeee; 53 | font-size: 20px; 54 | font-family: Arial; 55 | } 56 | 57 | h2{ 58 | padding-top: 1px; 59 | color: #c0c0c0; 60 | font-size: 12px; 61 | font-family: Arial; 62 | } 63 | 64 | #topContainer{ 65 | background-color: #3f3f3f; 66 | border-bottom: 1px solid #000000; 67 | height: 100px; 68 | } 69 | 70 | .topWrapper{ 71 | margin: auto; 72 | width: 900px; 73 | padding-top: 35px; 74 | } 75 | 76 | #firstBlockContainer{ 77 | background: #c6c6c6; 78 | font-size: 14px; 79 | font-family: Arial; 80 | } 81 | 82 | .firstBlockWrapper{ 83 | margin: auto; 84 | width: 900px; 85 | padding-top: 35px; 86 | } 87 | 88 | #footerContainer{ 89 | height: 50px; 90 | font-size: 12px; 91 | font-family: Arial; 92 | } 93 | 94 | .footerWrapper{ 95 | margin: auto; 96 | text-align: center; 97 | width: 900px; 98 | padding-top: 15px; 99 | } 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | .loginForm{ 110 | background: #e3e3e3; 111 | border: 1px solid #bbb; 112 | color: #333; 113 | font: bold 12px "helvetica neue", helvetica, arial, sans-serif; 114 | line-height: 1; 115 | text-align: center; 116 | text-shadow: 0 1px 0 #fff; 117 | width: 220px; 118 | height: 30px; 119 | margin-bottom: 10px; 120 | } 121 | 122 | 123 | 124 | .minimal { 125 | background: #e3e3e3; 126 | border: 1px solid #bbb; 127 | -webkit-border-radius: 3px; 128 | -moz-border-radius: 3px; 129 | border-radius: 3px; 130 | -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; 131 | -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; 132 | box-shadow: inset 0 0 1px 1px #f6f6f6; 133 | color: #333; 134 | font: bold 12px "helvetica neue", helvetica, arial, sans-serif; 135 | line-height: 1; 136 | padding: 8px 0 9px; 137 | text-align: center; 138 | text-shadow: 0 1px 0 #fff; 139 | width: 444px; 140 | margin-left: 1px; } 141 | .minimal:hover { 142 | background: #d9d9d9; 143 | -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; 144 | -moz-box-shadow: inset 0 0 1px 1px #eaeaea; 145 | box-shadow: inset 0 0 1px 1px #eaeaea; 146 | color: #222; 147 | cursor: pointer; } 148 | .minimal:active { 149 | background: #d0d0d0; 150 | -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3; 151 | -moz-box-shadow: inset 0 0 1px 1px #e3e3e3; 152 | box-shadow: inset 0 0 1px 1px #e3e3e3; 153 | color: #000; } 154 | 155 | 156 | button.minimal { 157 | background: #e3e3e3; 158 | border: 1px solid #bbb; 159 | -webkit-border-radius: 3px; 160 | -moz-border-radius: 3px; 161 | border-radius: 3px; 162 | -webkit-box-shadow: inset 0 0 1px 1px #f6f6f6; 163 | -moz-box-shadow: inset 0 0 1px 1px #f6f6f6; 164 | box-shadow: inset 0 0 1px 1px #f6f6f6; 165 | color: #333; 166 | font: bold 12px "helvetica neue", helvetica, arial, sans-serif; 167 | line-height: 1; 168 | padding: 8px 0 9px; 169 | text-align: center; 170 | text-shadow: 0 1px 0 #fff; 171 | width: 150px; } 172 | button.minimal:hover { 173 | background: #d9d9d9; 174 | -webkit-box-shadow: inset 0 0 1px 1px #eaeaea; 175 | -moz-box-shadow: inset 0 0 1px 1px #eaeaea; 176 | box-shadow: inset 0 0 1px 1px #eaeaea; 177 | color: #222; 178 | cursor: pointer; } 179 | button.minimal:active { 180 | background: #d0d0d0; 181 | -webkit-box-shadow: inset 0 0 1px 1px #e3e3e3; 182 | -moz-box-shadow: inset 0 0 1px 1px #e3e3e3; 183 | box-shadow: inset 0 0 1px 1px #e3e3e3; 184 | color: #000; } 185 | 186 | .clear{ 187 | clear:both;} 188 | 189 | .graphcont { 190 | padding-top:10px; 191 | color:#000; 192 | font-weight:700; 193 | float:left 194 | } 195 | 196 | .graph { 197 | float:left; 198 | margin-top:10px; 199 | background-color:#cecece; 200 | position:relative; 201 | width:280px; 202 | padding:0 203 | } 204 | 205 | .graph .barGreen { 206 | display:block; 207 | position:relative; 208 | border-right:#538e02 1px solid; 209 | text-align:center; 210 | color:#fff; 211 | height:25px; 212 | font-family:Arial, Helvetica, sans-serif; 213 | font-size:12px; 214 | line-height:1.9em; 215 | background-image: linear-gradient(bottom, rgb(137,212,23) 8%, rgb(118,189,11) 69%); 216 | background-image: -o-linear-gradient(bottom, rgb(137,212,23) 8%, rgb(118,189,11) 69%); 217 | background-image: -moz-linear-gradient(bottom, rgb(137,212,23) 8%, rgb(118,189,11) 69%); 218 | background-image: -webkit-linear-gradient(bottom, rgb(137,212,23) 8%, rgb(118,189,11) 69%); 219 | background-image: -ms-linear-gradient(bottom, rgb(137,212,23) 8%, rgb(118,189,11) 69%); 220 | 221 | background-image: -webkit-gradient( 222 | linear, 223 | left bottom, 224 | left top, 225 | color-stop(0.08, rgb(137,212,23)), 226 | color-stop(0.69, rgb(118,189,11)) 227 | ); 228 | } 229 | 230 | 231 | 232 | .graph .barAmber { 233 | display:block; 234 | position:relative; 235 | border-right:#538e02 1px solid; 236 | text-align:center; 237 | color:#fff; 238 | height:25px; 239 | font-family:Arial, Helvetica, sans-serif; 240 | font-size:12px; 241 | line-height:1.9em; 242 | background-image: linear-gradient(bottom, rgb(212,159,23) 8%, rgb(235,129,0) 69%); 243 | background-image: -o-linear-gradient(bottom, rgb(212,159,23) 8%, rgb(235,129,0) 69%); 244 | background-image: -moz-linear-gradient(bottom, rgb(212,159,23) 8%, rgb(235,129,0) 69%); 245 | background-image: -webkit-linear-gradient(bottom, rgb(212,159,23) 8%, rgb(235,129,0) 69%); 246 | background-image: -ms-linear-gradient(bottom, rgb(212,159,23) 8%, rgb(235,129,0) 69%); 247 | 248 | background-image: -webkit-gradient( 249 | linear, 250 | left bottom, 251 | left top, 252 | color-stop(0.08, rgb(212,159,23)), 253 | color-stop(0.69, rgb(235,129,0)) 254 | ); 255 | } 256 | 257 | 258 | 259 | .graph .bar span { 260 | position:absolute; 261 | left:1em 262 | } 263 | 264 | --------------------------------------------------------------------------------