-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjseditor.php
40 lines (40 loc) · 1.6 KB
/
jseditor.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
<?php
require ('core.inc.php');
if (loggedin()) {
include ('headerlogin.php');
}else {
include ('header.php');
echo '<div class="alert alert-danger">
To run your Js code, you need to <a href="login.php">login</a> or <a href="register.php">register</a> .
</div>';
die();
}
$handle = fopen('run.html', 'w');
if(isset($_POST['code'])) {
$code = array(' ', $_POST['code']);
$code1 = implode('<script>', $code);
fwrite($handle, $code1);
$handle2 = fopen('run.html', 'a');
fwrite($handle, ' </script>');
header('Location: run.html');
}
?>
<title>Js environment | The Hub </title>
<div class="text-xs-center" style="margin-top: 5px;">
<div class="text-center" id="intro-section">
<img src="img/thehub.ico.jpg" alt="website logo" width="60" height="60">
<div class="col-md-6 container">
<h2>Welcome to our <strong class="animated fadeIn" style="color: indigo; font-family: monospace;">Javascript environment!</strong></h2>
<p class="animated fadeIn">Test your Js code in real time using this Javascript environment. DO NOT begin your script with tags. Enjoy!</p>
<hr>
<form action="jseditor.php" method="POST" enctype="multipart/form-data">
<div class="input-group md-form">
<textarea class="lg-textarea" name="code" placeholder="Your code here...(Do not include script tags) Stretch the area if you prefer" style="height: 200px; background-color: black; color: white;" required></textarea></div>
<button type="submit" class="btn-indigo btn-block btn" name="submit">run code</button>
</form>
</div>
</div>
</div>
<?php
include 'footer.php';
?>