diff --git a/index.php.old b/index.php.old new file mode 100644 index 0000000..0a2731f --- /dev/null +++ b/index.php.old @@ -0,0 +1,353 @@ + + + + + + + + + + + Collab.Center - Online, Collaborative Coding in Real-Time! + + + +
+ + + +      + + + +      + + + + + +
+ + + + +
+
+

Help us keep Collab.Center ad-free! :)

+
+ + + +
+ + + + + + +
+ Fork me on GitHub
+ +

Welcome to Collab.Center!Beta

+

+

Collab.center is an easy way to share collaborative coding docs or even plain text online! Just select a language and your ready to go!

+
+ + '); + + //redirect to the new document + echo ''; + + } else { + $temp = $_POST['template']; + + $my_dir = ""; + $my_file = ""; + $randString = generateRandomString(); + + if (isset($_COOKIE["email"])) { + //Check if the user's email dir exists, if not create one + if (!file_exists("docs/".$_COOKIE["email"])) { + mkdir("docs/".$_COOKIE["email"]); + } + + $my_dir = "docs/".$_COOKIE["email"]."/".$randString; + $my_file = $my_dir."/index.php"; + + } else { + //User is not signed in, create a new directory + $my_dir = "docs/dev/".$randString; + $my_file = $my_dir."/index.php"; + } + + //Create the file + directory if it doesn't exist + if (!file_exists($my_file)) { + mkdir($my_dir); + $handle = fopen($my_file, 'w'); + } + + //Write to the index (.php) + $data = file_get_contents('./docs/tools/index.html', true); + fwrite($handle, $data); + + //Create the id.js file + $user_id_file = $my_dir."/id.js"; + $handle_user_id = fopen($user_id_file, 'w'); + fwrite($handle_user_id, "var padId = '".$randString."';"); + + //Create the name.php file + $user_name_file = $my_dir."/name.php"; + $handle_user_name = fopen($user_name_file, 'w'); + fwrite($handle_user_name, ''); + + + $handle = opendir('docs/' . $_COOKIE['email'] . '/'); + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + INCLUDE 'docs/' . $_COOKIE['email'] . "/$entry/name.php"; + + if (!empty($template) && !empty($padName) && $template == true && str_replace('˙', '.', $padName) == $temp) { + INCLUDE 'docs/' . $_COOKIE['email'] . "/$entry/name.php"; + //redirect to the new document, with a ?txt query string + echo ''; + } + } + } + closedir($handle); + //redirect to the new document, with a ?txt query string + //echo ''; + + } + } + ?> +

+ +

+ +
+

So far, Collab.Center has created docs for people like you!

+
+ + + + + + + + +