-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.php
More file actions
199 lines (169 loc) · 7.82 KB
/
code.php
File metadata and controls
199 lines (169 loc) · 7.82 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<?php
require 'vendor/autoload.php';
use api\File;
use api\Request;
$user = $_POST['username'];
$monfichier = fopen('snippets/new.txt', 'w+');
$template = file_get_contents("snippets/1.txt");
fputs($monfichier, $template);
$generate = new File($user);
$generate->writeApiUser();
$generate->writeRepos();
$request = new Request($user);
$newuser = $request->usersInfo();
$newrepo = $request->reposInfo();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Righteous|Sahitya" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<link rel="stylesheet" href="function.js">
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
</head>
<section>
<div class="section light-blue lighten-2">
<br><br>
<div class="container ">
<div class="row valign-wrapper ">
<div class="col s9 center-align">
<a href="form.php" class="waves-effect waves-light btn blue-grey darken-3">Go back to the Generator</a>
<br><br><br>
<a class="waves-effect waves-light btn green darken-1" href="download.php">Click to download the Code</a>
</div>
<div class="col s3">
<div class="card center-align blue-grey darken-3">
<div class="card-image">
<img src="<?php echo $newuser->avatar_url;?>">
<span class="card-title"></span>
</div>
<div class="card-content white-text">
<h4><?php echo $newuser->login?></h4>
</div>
<ul>
<li class="white-text">My last repos :</li>
<?php
for($i = 0; $i <= 2; $i++){
echo "<li>" . "<a href=\"";
echo $newrepo[$i]->html_url;
echo "\">";
echo $newrepo[$i]->name . "</a>";
echo "</li>";
}
?>
</ul>
<div class="card-action">
<a href="<?php echo $newuser->html_url;?>" class="white-text">Go in my github</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content blue-grey darken-3">
<span class="card-title white-text">Your code :</span>
<blockquote class="white-text">
<p>
<?php
$texte = '<?php'. PHP_EOL;
echo $texte;
?>
$url = curl_init('https://api.github.com/users/<?php echo $user ?>'); <br>
curl_setopt($url, CURLOPT_RETURNTRANSFER, true); <br>
curl_setopt($url, CURLOPT_HEADER, 0); <br>
curl_setopt($url, CURLOPT_TIMEOUT, 3); <br>
curl_setopt($url, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13');<br>
curl_setopt($url, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Bearer 20d648f938bf5963e996ab2df836f357675a8c67" ));<br>
$data = curl_exec($url);<br>
curl_close($url);<br>
$json = json_decode($data);<br>
$repos = curl_init('https://api.github.com/users/<?php echo $user ?>/repos');<br>
curl_setopt($repos, CURLOPT_RETURNTRANSFER, true);<br>
curl_setopt($repos, CURLOPT_HEADER, 0);<br>
curl_setopt($repos, CURLOPT_TIMEOUT, 3);<br>
curl_setopt($repos, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13');<br>
curl_setopt($repos, CURLOPT_HTTPHEADER, array('Content-Type: application/json', "Authorization: Bearer 20d648f938bf5963e996ab2df836f357675a8c67" ));<br>
$datarepos = curl_exec($repos);<br>
curl_close($repos);<br>
$jsonrepos = json_decode($datarepos);<br>
<?php
$texte = '?>';
echo $texte;
?>
<xmp>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col s3">
<div class="card center-align blue-grey darken-3">
<div class="card-image">
<img src="<?php
$texte = '<?php echo $json->avatar_url;?>';
echo $texte;
?>">
<span class="card-title"></span>
</div>
<div class="card-content white-text">
<h3><?php
$texte = '<?php echo $json->login;?>';
echo $texte;
?></h3>
</div>
<ul>
<li class="white-text">My last repos :</li>
<?php
$texte = '<?php
for($i = 0; $i <= 2; $i++){';
echo $texte;
?>
echo "<li>" . "<a href=\"";
echo $jsonrepos[$i]->html_url;
echo "\">";
echo $jsonrepos[$i]->name . "</a>";
echo "</li>";
}
?>
</ul>
<div class="card-action">
<a href="<?php
$texte = '<?php echo $json->html_url;?>';
echo $texte;
?>">Go in my github</a>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
</body>
</html>
</xmp>
</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</section>