-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgittyup.php
52 lines (42 loc) · 972 Bytes
/
gittyup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?PHP
include_once( 'config.php' );
class GittyUp{
public function get_form( $message ){
$out[] = '<form method="post">';
$out[] = '<label>Password</label>';
$out[] = '<input type="password" name="gitpass"/>';
$out[] = '<button type="submit">Pull Git Repo</button>';
$out[] = '</form>';
$out[] = '<p>'.$message.'</p>';
return implode( "\n", $out );
}
public function set_form( $values ){
$password = $values['gitpass'];
if( $password == PULL_PASSWORD ){
chdir( WEB_ROOT );
$command = 'git pull https://github.com/codeforabq/circles.git master';
$stuff = exec( $command );
return $stuff;
}else{
return 'NO';
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Gitty Up</title>
</head>
<body>
<?PHP
include("header.php");
$g = new GittyUp;
$message = '';
if( $_SERVER['REQUEST_METHOD'] == 'POST' ){
$message = $g->set_form( $_POST );
}
echo $g->get_form( $message );
?>
</body>
</html>