added ability to select different computers and communicate using nCard0
This commit is contained in:
59
index.php
59
index.php
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
$IIDX_Location = "192.168.1.80";
|
||||
$IIDX_Port = 4500;
|
||||
$SDVX_Location = "192.168.1.81";
|
||||
$SDVX_Port = 4500;
|
||||
|
||||
if (!file_exists('cards.json')) { fopen('cards.json','w'); }
|
||||
// if cards.json does not exist, we create it
|
||||
|
||||
@@ -77,6 +82,7 @@ foreach (glob('import/*.txt') as $file) {
|
||||
// assuming the file content = the card ID and the file name = account name
|
||||
// you can change those informations later.
|
||||
$content = file_get_contents($file);
|
||||
$content = trim($content);
|
||||
$filename = basename($file,'.txt');
|
||||
if (!preg_match('#"id":"'.$content.'"#',$json) && $content != '') {
|
||||
array_push(
|
||||
@@ -416,6 +422,59 @@ if (isset($_POST['trigger']) && ($_POST['trigger'] == 'edit' || $_POST['trigger'
|
||||
$slot = preg_replace('#^rcard-#','',$_POST['trigger']);
|
||||
$rcard = preg_replace('#^\w*#',$settings['regex'],$slot);
|
||||
file_put_contents($rcard,$_POST['id']);
|
||||
|
||||
// dt edit
|
||||
if($slot == 'IIDX_P1') // edit p1
|
||||
{
|
||||
$fp = fsockopen($IIDX_Location, $IIDX_Port, $errno, $errstr, 5);
|
||||
if (!$fp)
|
||||
{
|
||||
echo "$errstr ($errno)<br />\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($fp, "1:" . $_POST['id']);
|
||||
while (!feof($fp))
|
||||
{
|
||||
echo fgets($fp, 128);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
elseif($slot == 'IIDX_P2') // edit p1
|
||||
{
|
||||
$fp = fsockopen($IIDX_Location, $IIDX_Port, $errno, $errstr, 5);
|
||||
if (!$fp)
|
||||
{
|
||||
echo "$errstr ($errno)<br />\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($fp, "2:" . $_POST['id']);
|
||||
while (!feof($fp))
|
||||
{
|
||||
echo fgets($fp, 128);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
if($slot == 'SDVX') // edit p1
|
||||
{
|
||||
$fp = fsockopen($SDVX_Location, $SDVX_Port, $errno, $errstr, 5);
|
||||
if (!$fp)
|
||||
{
|
||||
echo "$errstr ($errno)<br />\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite($fp, "1:" . $_POST['id']);
|
||||
while (!feof($fp))
|
||||
{
|
||||
echo fgets($fp, 128);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<form id="cards" method="post" action="">
|
||||
|
1
settings.json
Normal file
1
settings.json
Normal file
@@ -0,0 +1 @@
|
||||
{"rcard":["IIDX_P1","IIDX_P2","SDVX"],"card":{"background":"backgrounds\/programmedsun.png","subtitle":"","icon":"","width":"400","height":"260"},"sort-key":"name","sort-order":"asc","animations":"on","regex":"cards\/monopole-$0.txt"}
|
Reference in New Issue
Block a user