mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 12:36:03 +00:00
path problem resolved on windows
This commit is contained in:
parent
49003c236a
commit
ef04c83592
89
_pdo.php
89
_pdo.php
@ -1,89 +0,0 @@
|
|||||||
<?php
|
|
||||||
// PDO helper functions.
|
|
||||||
// Copyright (c) 2012-2014 The PHP Desktop authors. All rights reserved.
|
|
||||||
// License: New BSD License.
|
|
||||||
// Website: http://code.google.com/p/phpdesktop/
|
|
||||||
|
|
||||||
function PDO_Connect($dsn, $user="", $password="")
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
$PDO = new PDO($dsn, $user, $password);
|
|
||||||
$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
|
|
||||||
}
|
|
||||||
function PDO_FetchOne($query, $params=null)
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
if (isset($params)) {
|
|
||||||
$stmt = $PDO->prepare($query);
|
|
||||||
$stmt->execute($params);
|
|
||||||
} else {
|
|
||||||
$stmt = $PDO->query($query);
|
|
||||||
}
|
|
||||||
$row = $stmt->fetch(PDO::FETCH_NUM);
|
|
||||||
if ($row) {
|
|
||||||
return $row[0];
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function PDO_FetchRow($query, $params=null)
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
if (isset($params)) {
|
|
||||||
$stmt = $PDO->prepare($query);
|
|
||||||
$stmt->execute($params);
|
|
||||||
} else {
|
|
||||||
$stmt = $PDO->query($query);
|
|
||||||
}
|
|
||||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
}
|
|
||||||
function PDO_FetchAll($query, $params=null)
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
if (isset($params)) {
|
|
||||||
$stmt = $PDO->prepare($query);
|
|
||||||
$stmt->execute($params);
|
|
||||||
} else {
|
|
||||||
$stmt = $PDO->query($query);
|
|
||||||
}
|
|
||||||
return $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
}
|
|
||||||
function PDO_FetchAssoc($query, $params=null)
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
if (isset($params)) {
|
|
||||||
$stmt = $PDO->prepare($query);
|
|
||||||
$stmt->execute($params);
|
|
||||||
} else {
|
|
||||||
$stmt = $PDO->query($query);
|
|
||||||
}
|
|
||||||
$rows = $stmt->fetchAll(PDO::FETCH_NUM);
|
|
||||||
$assoc = array();
|
|
||||||
foreach ($rows as $row) {
|
|
||||||
$assoc[$row[0]] = $row[1];
|
|
||||||
}
|
|
||||||
return $assoc;
|
|
||||||
}
|
|
||||||
function PDO_Execute($query, $params=null)
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
if (isset($params)) {
|
|
||||||
$stmt = $PDO->prepare($query);
|
|
||||||
$stmt->execute($params);
|
|
||||||
return $stmt;
|
|
||||||
} else {
|
|
||||||
return $PDO->query($query);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function PDO_LastInsertId()
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
return $PDO->lastInsertId();
|
|
||||||
}
|
|
||||||
function PDO_ErrorInfo()
|
|
||||||
{
|
|
||||||
global $PDO;
|
|
||||||
return $PDO->errorInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
define("BLENC_ENCRYPTION_KEY", "ChangeThisToSomethingElse");
|
|
||||||
error_reporting(-1);
|
|
||||||
print('<style type="text/css">@import url("style.css");</style>');
|
|
||||||
print("<a href='javascript:history.go(-1)'>Go back</a><br>");
|
|
||||||
if (!extension_loaded("blenc")) {
|
|
||||||
$link = "https://github.com/cztomczak/phpdesktop/wiki/" .
|
|
||||||
"Source-code-protection#blenc-encoder";
|
|
||||||
printf("ERROR: blenc extension not loaded.<br><br>
|
|
||||||
BLENC encoder is a PECL extension that permits to protect
|
|
||||||
PHP source scripts.
|
|
||||||
This extension is not distributed by default with
|
|
||||||
phpdesktop binaries.
|
|
||||||
See instructions on how to use BLENC encoder with
|
|
||||||
phpdesktop on the SourceCodeProtection wiki page:<br>
|
|
||||||
<a href='%s'>%s</a>", $link, $link);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$source_code = file_get_contents("blenc_myscript.php");
|
|
||||||
// The encoded source passed to blenc_encrypt() cannot contain
|
|
||||||
// any php tags. We are removing php tags at the beginning and
|
|
||||||
// end of file. Also checking that there are no other php tag
|
|
||||||
// openings/closings.
|
|
||||||
$source_code = preg_replace('#^<'.'\?php\s+#', '', $source_code);
|
|
||||||
$source_code = preg_replace('#\s+\?'.'>\s*$#', '', $source_code);
|
|
||||||
if (preg_match('#<'.'\?#', $source_code)
|
|
||||||
|| preg_match('#\?'.'>#', $source_code)) {
|
|
||||||
print("Script to be encoded can only contain PHP code.");
|
|
||||||
print(" Only a single php opening tag at the beginning of file");
|
|
||||||
print(" and a single php closing tag at the end of file are allowed.");
|
|
||||||
print(" This is a limitation as of BENC encoder 1.1.4b.");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$redist_key = blenc_encrypt($source_code, "blenc_myscript_encoded.php",
|
|
||||||
BLENC_ENCRYPTION_KEY);
|
|
||||||
$key_file = ini_get('blenc.key_file');
|
|
||||||
file_put_contents($key_file, $redist_key);
|
|
||||||
print("DONE. See");
|
|
||||||
print(" <a href='blenc_myscript_encoded.php'>blenc_myscript_encoded.php</a>");
|
|
||||||
?>
|
|
@ -1,5 +0,0 @@
|
|||||||
<?php
|
|
||||||
print('<style type="text/css">@import url("style.css");</style>');
|
|
||||||
print("<a href='javascript:history.go(-1)'>Go back</a><br>");
|
|
||||||
print("Printing a secret string: XuXuXaaa");
|
|
||||||
?>
|
|
24
cookies.php
24
cookies.php
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
error_reporting(-1);
|
|
||||||
if (isset($_GET["create"]) && $_GET["create"]) {
|
|
||||||
$rand = rand(1, 1000);
|
|
||||||
setcookie("test-".$rand, "1", time()+3600*24);
|
|
||||||
header("Location: cookies.php");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Cookies</h1>
|
|
||||||
|
|
||||||
<p><a href="cookies.php?create=1">Create a random cookie</a></p>
|
|
||||||
|
|
||||||
<p>Total cookies: <b><?php echo count($_COOKIE); ?></b></p>
|
|
||||||
|
|
||||||
<pre><?php print_r($_COOKIE); ?></pre>
|
|
27
download.php
27
download.php
@ -1,27 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
error_reporting(-1);
|
|
||||||
|
|
||||||
if (isset($_GET["getit"])) {
|
|
||||||
header('Content-type: text/plain');
|
|
||||||
header('Content-Disposition: attachment; filename="phpdesktop.txt"');
|
|
||||||
print("This file was downloaded using the PHP Desktop browser!");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Download</h1>
|
|
||||||
|
|
||||||
<p>You can disable ability to download files by setting
|
|
||||||
the "enable_downloads" option to false in settings.json.</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Download file:
|
|
||||||
<a href="download.php?getit=1">phpdesktop.txt</a>
|
|
||||||
</p>
|
|
@ -1,10 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Environment variables</title>
|
|
||||||
<h1>Environment variables</h1>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
<?php print_r($_ENV); ?>
|
|
||||||
</pre>
|
|
@ -1,20 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Error 404</title>
|
|
||||||
<h1>Error 404</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Cick the non-existing url below. If ["web_server"]["404_handler"]
|
|
||||||
is set in settings.json file then clicking the link below
|
|
||||||
will forward you to "/pretty-urls.php/foo.html". You can then
|
|
||||||
access the "/foo.html" url using $_SERVER["PATH_INFO"] or
|
|
||||||
$_SERVER["REQUEST_URI"].
|
|
||||||
</p>
|
|
||||||
<p>Try it:
|
|
||||||
<ul>
|
|
||||||
<li><a href="/company.html">/company.html</a>
|
|
||||||
<li><a href="/company.html?xyz=1">/company.html?xyz=1</a>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', false, 500);
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Error 500</title>
|
|
||||||
<h1>Error 500</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Sent header: 500 Internal Server Error.<br>
|
|
||||||
If you're seeing this then all is OK.
|
|
||||||
</p>
|
|
@ -1,42 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
|
|
||||||
<title>Execute command</title>
|
|
||||||
<h1>Execute command</h1>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
// Execution of commands may hang on Windows XP for some programs,
|
|
||||||
// wmic.exe is one of them. The solution is to use a command like
|
|
||||||
// this "echo | command...". See Issue 124:
|
|
||||||
// https://code.google.com/p/phpdesktop/issues/detail?id=124
|
|
||||||
|
|
||||||
$output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
|
|
||||||
|
|
||||||
if ($output) {
|
|
||||||
echo "Command executed successfully.<br>";
|
|
||||||
echo "Output: $output";
|
|
||||||
} else {
|
|
||||||
echo "Command failed.";
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Execution of commands may hang on Windows XP for some programs,
|
|
||||||
// wmic.exe is one of them. The solution is to use a command like
|
|
||||||
// this "echo | command...". See Issue 124:
|
|
||||||
// https://code.google.com/p/phpdesktop/issues/detail?id=124
|
|
||||||
|
|
||||||
$output = shell_exec("echo | {$_ENV['SYSTEMROOT']}\System32\wbem\wmic.exe path win32_computersystemproduct get uuid");
|
|
||||||
|
|
||||||
if ($output) {
|
|
||||||
echo "Command executed successfully.<br>";
|
|
||||||
echo "Output: $output";
|
|
||||||
} else {
|
|
||||||
echo "Command failed.";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
26
forms.php
26
forms.php
@ -1,26 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Forms</title>
|
|
||||||
<h1>Forms</h1>
|
|
||||||
|
|
||||||
<h2>Input</h2>
|
|
||||||
|
|
||||||
type=text: <input type=text><br>
|
|
||||||
type=(empty) <input><br>
|
|
||||||
type=password: <input type=password><br>
|
|
||||||
type=checkbox: <input type=checkbox><br>
|
|
||||||
type=submit: <input type=submit><br>
|
|
||||||
type=button: <input type=button value=button><br>
|
|
||||||
|
|
||||||
<h3>Textarea</h3>
|
|
||||||
|
|
||||||
<textarea cols=60 rows=6></textarea>
|
|
||||||
|
|
||||||
<h3>Select</h3>
|
|
||||||
|
|
||||||
<select>
|
|
||||||
<option>option 1</option>
|
|
||||||
<option>option 2</option>
|
|
||||||
</select>
|
|
@ -1,8 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Google</title>
|
|
||||||
<h1>Google</h1>
|
|
||||||
|
|
||||||
<a href="https://www.google.com/">https://www.google.com/</a>
|
|
@ -1,18 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>HTML 5 Video and accelerated content</title>
|
|
||||||
<h1>HTML 5 Video and accelerated content</h1>
|
|
||||||
|
|
||||||
<p>Use the "Back" option in the right mouse context menu
|
|
||||||
to go back to this page, after clicking on the links below.</p>
|
|
||||||
|
|
||||||
<a href="http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True">
|
|
||||||
HTML 5 video</a><br>
|
|
||||||
|
|
||||||
<a href="http://mudcu.be/labs/JS1k/BreathingGalaxies.html">
|
|
||||||
Accelerated canvas</a><br>
|
|
||||||
|
|
||||||
<a href="http://www.webkit.org/blog-files/3d-transforms/poster-circle.html">
|
|
||||||
Accelerated layers</a><br>
|
|
11
iframe.php
11
iframe.php
@ -1,11 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<h1>IFrame</h1>
|
|
||||||
|
|
||||||
<p>To test whether a new option "Open frame in external browser"
|
|
||||||
appears when showing the mouse context menu.</p>
|
|
||||||
|
|
||||||
<iframe src="/index.php"
|
|
||||||
style="width: 400px; height: 300px;"></iframe>
|
|
@ -1,24 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<h1>Javascript API</h1>
|
|
||||||
|
|
||||||
<p>PHP Desktop exposes its API through the javascript "phpdesktop"
|
|
||||||
object that is binded to the window object.</p>
|
|
||||||
|
|
||||||
<a href="javascript:alert(phpdesktop.GetVersion())">
|
|
||||||
phpdesktop.GetVersion()</a>
|
|
||||||
|
|
||||||
<p>Get the PHP Desktop version. This value is taken from the version
|
|
||||||
info embedded in the phpdesktop executable.</p>
|
|
||||||
|
|
||||||
<a href="javascript:phpdesktop.ToggleFullscreen()">
|
|
||||||
phpdesktop.ToggleFullscreen()</a>
|
|
||||||
|
|
||||||
<p>To go into fullscreen mode or exit fullscreen mode.</p>
|
|
||||||
|
|
||||||
<a href="javascript:alert(phpdesktop.IsFullscreen())">
|
|
||||||
phpdesktop.IsFullscreen()</a>
|
|
||||||
|
|
||||||
<p>Whether in fullscreen mode.</p>
|
|
@ -1,19 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Loading error</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Try loading a non-existent url. This is an http protocol
|
|
||||||
so it will be handled by the web server:
|
|
||||||
<a href="/non-existent.html">non-existent.html</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
A custom scheme loading error will be handled by Chrome:
|
|
||||||
<a href="asd://non-existent.html">asd://non-existent.html</a><br>
|
|
||||||
In a popup window:
|
|
||||||
<a target="_blank" href="asd://non-existent.html">asd://non-existent.html</a>
|
|
||||||
</p>
|
|
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
sleep(5);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<h1>Mouse cursor loading</h1>
|
|
||||||
|
|
||||||
Testing mouse cursor indicator during long loading of a page.
|
|
35
no-cache.php
35
no-cache.php
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
error_reporting(-1);
|
|
||||||
|
|
||||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
|
||||||
header("Cache-Control: no-cache, no-store, must-revalidate");
|
|
||||||
header("Pragma: no-cache");
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>No cache</title>
|
|
||||||
<h1>No cache</h1>
|
|
||||||
|
|
||||||
<p>This example uses PHP header() calls to set cache control.</p>
|
|
||||||
|
|
||||||
Some random number:
|
|
||||||
<?php echo rand(1, 1000); ?>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Go back and forward using mouse context menu to see if this number changed,
|
|
||||||
if so the cache was disabled successfully.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
To avoid caching of static resources put some random query string
|
|
||||||
when including js/css files, see for example:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
<link href="css/style.css?r=<?php echo time(); ?>" rel="stylesheet" type="text/css" />
|
|
||||||
</pre>
|
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$explorer = $_ENV["SYSTEMROOT"] . '\\explorer.exe';
|
|
||||||
$folder_to_open = "C:\\Windows";
|
|
||||||
// Using "system" function would cause a false/positive
|
|
||||||
// by Bkav antivirus on virustotal.com. Using shell_exec
|
|
||||||
// instead solves the issue.
|
|
||||||
shell_exec("$explorer /n,/e,$folder_to_open");
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Open folder in Explorer</title>
|
|
||||||
<h1>Open folder in Explorer</h1>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
$explorer = $_ENV["SYSTEMROOT"] . '\\explorer.exe';
|
|
||||||
$folder_to_open = "C:\\Windows";
|
|
||||||
// Using "system" function would cause a false/positive
|
|
||||||
// by Bkav antivirus on virustotal.com. Using shell_exec
|
|
||||||
// instead solves the issue.
|
|
||||||
shell_exec("$explorer /n,/e,$folder_to_open");
|
|
||||||
</pre>
|
|
@ -1,16 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>PHP error</title>
|
|
||||||
<h1>PHP error</h1>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
<?php
|
|
||||||
echo $some;
|
|
||||||
?>
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
echo $some;
|
|
||||||
?>
|
|
@ -1,6 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<?php phpinfo(); ?>
|
|
24
popup.php
24
popup.php
@ -1,24 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<!-- If "fixed_title" option under "popup_window" section (settings.json)
|
|
||||||
is empty, then title for the popup window will be set using meta title -->
|
|
||||||
<title>Popup</title>
|
|
||||||
<h1>Popup</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
When creating a window, the ["application"]["dpi_aware"] setting is taken
|
|
||||||
into account. If it's set to true, then application window will be resized
|
|
||||||
automatically using the current OS DPI settings.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="javascript:window.open('index.php', '', 'width=800,height=600')">
|
|
||||||
window.open('index.php', '', 'width=800,height=600')
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="index.php" target="_blank">target="_blank"</a>
|
|
||||||
</p>
|
|
@ -1,96 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="/index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Pretty urls</title>
|
|
||||||
<h1>Pretty urls</h1>
|
|
||||||
|
|
||||||
<h2>$_SERVER</h2>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
function print_url_variables()
|
|
||||||
{
|
|
||||||
$url_vars = [];
|
|
||||||
foreach ($_SERVER as $k => $v) {
|
|
||||||
if (is_array($v)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (strpos($v, "pretty-urls.php") !== false
|
|
||||||
|| strpos($v, "company") !== false
|
|
||||||
|| strpos($v, "xyz") !== false
|
|
||||||
|| strpos($v, "foo") !== false
|
|
||||||
|| strpos($v, "bar") !== false
|
|
||||||
|| $k == "REQUEST_METHOD"
|
|
||||||
|| $k == "REQUEST_URI") {
|
|
||||||
$url_vars[$k] = $v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "<pre>";
|
|
||||||
print_r($url_vars);
|
|
||||||
print "</pre>";
|
|
||||||
}
|
|
||||||
print_url_variables();
|
|
||||||
?>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Pretty urls can be handled by setting ["web_server"]["404_handler"]
|
|
||||||
option in settings.json file. This is how it works:
|
|
||||||
<ul>
|
|
||||||
<li>Set 404_handler to "/pretty-urls.php"
|
|
||||||
<li>Load url like "/company/5"
|
|
||||||
<li>Mongoose web server does not find such file "/company/5",
|
|
||||||
and instead makes a request to "/pretty-urls.php/company/5".
|
|
||||||
<li>To know the pretty url that was accessed check
|
|
||||||
the PATH_INFO or REQUEST_URI environment variables.
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Test pretty urls:
|
|
||||||
<ul>
|
|
||||||
<li><a href="/company/5">/company/5</a>
|
|
||||||
<li><a href="/company/5?xyz=1">/company/5?xyz=1</a>
|
|
||||||
<li><a href="/company-5.html">/company-5.html</a>
|
|
||||||
<li><a href="/company_5.html">/company_5.html</a>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Test POST request to
|
|
||||||
<select onchange="document.getElementById('myform').action=this.value;">
|
|
||||||
<option value="/company/5">/company/5</option>
|
|
||||||
<option value="/company.html">/company.html</option>
|
|
||||||
<option value="/pretty-urls.php/company/5">
|
|
||||||
/pretty-urls.php/company/5
|
|
||||||
</option>
|
|
||||||
<option value="/pretty-urls.php/company/5.html">
|
|
||||||
/pretty-urls.php/company/5.html
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<form action="/company/5" method=POST id="myform">
|
|
||||||
<input type=text name=foo value="abc">
|
|
||||||
<input type=submit>
|
|
||||||
</form>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<?php if ($_SERVER["REQUEST_METHOD"] == "POST"): ?>
|
|
||||||
<h2>POST data</h2>
|
|
||||||
<pre>
|
|
||||||
<?php print_r($_POST); ?>
|
|
||||||
</pre>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Other tests (these urls do not require 404_handler to be set):
|
|
||||||
<ul>
|
|
||||||
<li><a href="/pretty-urls.php/company/5">
|
|
||||||
/pretty-urls.php/company/5</a>
|
|
||||||
<li><a href="/pretty-urls.php/company/5?xyz=1">
|
|
||||||
/pretty-urls.php/company/5?xyz=1</a>
|
|
||||||
<li><a href="/pretty-urls.php/company\5">
|
|
||||||
/pretty-urls.php/company\5</a>
|
|
||||||
<li><a href="/pretty-urls.php?xyz=1">
|
|
||||||
/pretty-urls.php?xyz=1</a>
|
|
||||||
</ul>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Request quota</title>
|
|
||||||
<h1>Request quota</h1>
|
|
||||||
|
|
||||||
<p>Request quota for HTML 5 persistent storage.</p>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function DoRequestQuota() {
|
|
||||||
// Request Quota (only for File System API)
|
|
||||||
try {
|
|
||||||
navigator.webkitPersistentStorage.requestQuota(PERSISTENT, 1024*1024,
|
|
||||||
function(bytes){ window.alert("Granted bytes: "+bytes);},
|
|
||||||
function(error){ window.alert(error); });
|
|
||||||
} catch(e) {
|
|
||||||
navigator.webkitPersistentStorage.requestQuota(1024*1024,
|
|
||||||
function(bytes){ window.alert("Granted bytes: "+bytes);},
|
|
||||||
function(error){ window.alert(error); });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<a href="javascript:DoRequestQuota()">
|
|
||||||
DoRequestQuota()</a>
|
|
34
session.php
34
session.php
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(-1);
|
|
||||||
session_start();
|
|
||||||
if (!isset($_SESSION['count'])) {
|
|
||||||
$_SESSION['count'] = 1;
|
|
||||||
} else {
|
|
||||||
$_SESSION['count']++;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Session</title>
|
|
||||||
<h1>Session</h1>
|
|
||||||
|
|
||||||
<p>Temp directory: <?php echo sys_get_temp_dir(); ?></p>
|
|
||||||
|
|
||||||
<h2>The code</h2>
|
|
||||||
<pre>
|
|
||||||
session_start();
|
|
||||||
if (!isset($_SESSION['count'])) {
|
|
||||||
$_SESSION['count'] = 1;
|
|
||||||
} else {
|
|
||||||
$_SESSION['count']++;
|
|
||||||
}
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h2>$_SESSION</h2>
|
|
||||||
Refresh the page to see if counter increases.
|
|
||||||
<pre>
|
|
||||||
<?php print_r($_SESSION); ?>
|
|
||||||
</pre>
|
|
@ -1,20 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>Speech recognition</h1>
|
|
||||||
|
|
||||||
You need to set the "enable-speech-input" flag in settings.json
|
|
||||||
for the speech recognition to work:
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
"command_line_switches": {
|
|
||||||
"enable-speech-input": ""
|
|
||||||
},
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>After you've done that, restart application and visit this url:</p>
|
|
||||||
|
|
||||||
<a href="http://slides.html5rocks.com/#speech-input">
|
|
||||||
http://slides.html5rocks.com/#speech-input</a>
|
|
45
sqlite.php
45
sqlite.php
@ -1,45 +0,0 @@
|
|||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<h1>SQLite</h1>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
error_reporting(-1);
|
|
||||||
include "./_pdo.php";
|
|
||||||
$db_file = "./sqlite-database.db";
|
|
||||||
PDO_Connect("sqlite:$db_file");
|
|
||||||
print("PDO_Connect(): successsfully connected<br>");
|
|
||||||
print("The database file: <b>$db_file</b><br>");
|
|
||||||
|
|
||||||
$queries = <<< HTML
|
|
||||||
CREATE TABLE test (id int PRIMARY KEY, name varchar(50));
|
|
||||||
INSERT INTO test VALUES (1, "Amelia");
|
|
||||||
INSERT INTO test VALUES (2, "Beatrice");
|
|
||||||
HTML;
|
|
||||||
|
|
||||||
print("<h2>Create table and insert exampe data</h2>");
|
|
||||||
print("<pre>");
|
|
||||||
$queries = explode(";", $queries);
|
|
||||||
foreach ($queries as $query) {
|
|
||||||
$query = trim($query);
|
|
||||||
if (!$query) continue;
|
|
||||||
$stmt = @PDO_Execute($query);
|
|
||||||
if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
|
|
||||||
$error = PDO_ErrorInfo();
|
|
||||||
print_r($error[2]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
print($query."\n");
|
|
||||||
}
|
|
||||||
print("</pre>");
|
|
||||||
|
|
||||||
print("<h2>Fetch data</h2>");
|
|
||||||
print("PDO_FetchAll('SELECT * FROM test')");
|
|
||||||
print("<pre>");
|
|
||||||
$data = PDO_FetchAll("SELECT * FROM test");
|
|
||||||
print_r($data);
|
|
||||||
print("</pre>");
|
|
||||||
|
|
||||||
?>
|
|
@ -3,8 +3,9 @@ if (!empty($_POST)) {
|
|||||||
|
|
||||||
// write the d2um.conf file and replace \ with \\
|
// write the d2um.conf file and replace \ with \\
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$path = str_replace('\\', '\\', $_POST['path']);
|
$path = rtrim($_POST['path'], "\\");
|
||||||
$path .= '\\data\\global\\excel\\';
|
$path = str_replace("\\", "\\\\", $path);
|
||||||
|
$path .= '\\\\data\\\\global\\\\excel\\\\';
|
||||||
file_put_contents("../d2um.conf", $path);
|
file_put_contents("../d2um.conf", $path);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ if (!empty($_POST)) {
|
|||||||
<p style="font-family: lato">Input path to D2 Mod Directory.</p>
|
<p style="font-family: lato">Input path to D2 Mod Directory.</p>
|
||||||
|
|
||||||
<div style="margin-top: 20px;">
|
<div style="margin-top: 20px;">
|
||||||
<form enctype="multipart/form-data" style="font-family: Lato; font-size: 11px;" action="" method="post">
|
<form enctype="multipart/form-data" style="font-family: Lato; font-size: 14pt;" action="" method="post">
|
||||||
<label for="path">Choose PATH</label>
|
<label for="path">Choose PATH</label>
|
||||||
<input id="path" style="width: 420px;" required="required" name="path" type="text">
|
<input id="path" style="width: 420px;" required="required" name="path" type="text">
|
||||||
<input type="submit" value="Write Config" name="submit">
|
<input type="submit" value="Write Config" name="submit">
|
||||||
|
29
temp-dir.php
29
temp-dir.php
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$temp = __DIR__."/temp";
|
|
||||||
putenv("TMP=$temp");
|
|
||||||
putenv("TEMP=$temp");
|
|
||||||
putenv("TMPDIR=$temp");
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
|
|
||||||
<h1>TMP directory</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
A few calls to putenv() overwrite the default directory,
|
|
||||||
call sys_get_temp_dir() to see it if was set successfully.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>You can also set the temp directory using the "cgi_temp_dir"
|
|
||||||
option in the settings.json file.</p>
|
|
||||||
|
|
||||||
<h2>sys_get_temp_dir()</h2>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
<?php echo sys_get_temp_dir(); ?>
|
|
||||||
</pre>
|
|
58
upload.php
58
upload.php
@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
error_reporting(-1);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<style type="text/css">@import url("style.css");</style>
|
|
||||||
<a href="index.php">Go back to index</a>
|
|
||||||
| <a href="<?php echo $_SERVER["REQUEST_URI"];?>">Refresh</a>
|
|
||||||
|
|
||||||
<title>Upload</title>
|
|
||||||
<h1>Upload</h1>
|
|
||||||
|
|
||||||
<p>Temp directory: <?php echo sys_get_temp_dir(); ?></p>
|
|
||||||
|
|
||||||
<form enctype="multipart/form-data" action="upload.php" method="POST">
|
|
||||||
Max file size is set in php.ini<br>
|
|
||||||
Send this file: <input name="myfile" type="file" />
|
|
||||||
<input type="submit" value="Send File" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<h2>$_FILES</h2>
|
|
||||||
<pre>
|
|
||||||
<?php print_r($_FILES); ?>
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<?php if (count($_FILES)): ?>
|
|
||||||
|
|
||||||
<?php $myfile = $_FILES["myfile"]["tmp_name"]; ?>
|
|
||||||
|
|
||||||
<h2>Check the uploaded file</h2>
|
|
||||||
<pre>
|
|
||||||
is_file() = <?php echo is_file($myfile); ?>
|
|
||||||
|
|
||||||
is_readable() = <?php echo is_readable($myfile); ?>
|
|
||||||
|
|
||||||
is_writable() = <?php echo is_writable($myfile); ?>
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h2>Move the uploaded file</h2>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$success = move_uploaded_file($myfile,
|
|
||||||
__DIR__."/".basename($_FILES["myfile"]["name"]));
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if ($success): ?>
|
|
||||||
<p>
|
|
||||||
The uploaded file (<?php echo $_FILES["myfile"]["name"]; ?>) was moved to
|
|
||||||
the www/ directory using the <b>move_uploaded_file()</b> function.
|
|
||||||
See the listing of files by going to <a href="index.php">index.php</a>
|
|
||||||
</p>
|
|
||||||
<?php else: ?>
|
|
||||||
<p style="color: red;">
|
|
||||||
move_uploaded_file() failed.
|
|
||||||
</p>
|
|
||||||
<?php endif; // $success ?>
|
|
||||||
|
|
||||||
<?php endif; // count($_FILES) ?>
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user