diff --git a/count.html.php b/count.html.php new file mode 100644 index 0000000..ab4ce83 --- /dev/null +++ b/count.html.php @@ -0,0 +1,12 @@ + + +
+ ++ +
+ + \ No newline at end of file diff --git a/public/count.php b/public/count.php new file mode 100644 index 0000000..ca6f38c --- /dev/null +++ b/public/count.php @@ -0,0 +1,7 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +} +catch (PDOException $e) { + echo '' . $e . '
'; + die; +} + + +try { + //sample user might not exist so the query may throw an exception, that's fine, ignore it. + try { + //Drop the user, there's a chance the password has been changed + $pdo->query('DROP USER \'ijdb_sample\'@\'localhost\''); + } + catch (PDOException $e) {} + + //Create the user for the sample code to use + $pdo->query('CREATE USER \'ijdb_sample\'@\'localhost\' IDENTIFIED BY \'mypassword\''); + + //Drop the database, only one sample should be used at once. + + $pdo->query('DROP DATABASE IF EXISTS ijdb_sample'); + + + $pdo->query('CREATE DATABASE ijdb_sample'); + $pdo->query('GRANT ALL PRIVILEGES ON ijdb_sample.* To \'ijdb_sample\'@\'localhost\''); + $pdo->query('FLUSH PRIVILEGES'); + $pdo->query('USE ijdb_sample'); + + if (file_exists('../../database.sql')) { + $pdo->exec(file_get_contents('../../database.sql')); + } + +} +catch (PDOException $e) { + echo 'Could not create sample database/user'; + echo $e->getMessage(); +} + + +exec('git status', $output); +$branchName = str_replace('On branch ', '', $output[0]); + +if (isset($_GET['branch'])) { + exec('git status', $status); + $status = implode("\n", $status); + if (strpos($status, 'nothing to commit') == false) { + + + + $parts = explode('_Modified', $branchName); + $newBranchName = $parts[0] . '_Modified-' . date('Y-m-d-H.i.s'); + + + exec('git checkout -b ' . $newBranchName . ' 2>&1', $z); + + exec('git add -A 2>&1', $x); + exec('git commit -m "user modified sample" 2>&1', $y); + + var_dump($z); + var_dump($y); + var_dump($x); + } + exec('git checkout "' . $_GET['branch'] . '"', $n); + $branchName = $_GET['branch']; +} + +if (!isset($branchName)) { + exec('git status', $output); + $branchName = str_replace('On branch ', '', $output[0]); +} + + +?> + + +Click on a file to view in your browser
+ +