Exemple #1
0
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include_once '../includes/includes.php';
if (isset($_GET['data']) && !empty($_GET['data'])) {
    foreach ($_GET['data'] as $value) {
        //url format: myhost.com/postTest?data=["devName","devPsw",devData1,devData2,...]
        $data = myDecode($value);
        $devName = $data[0];
        $devPwd = $data[1];
        for ($i = 2; $i < sizeof($data); $i++) {
            $devData[$i - 2] = $data[$i];
        }
        $result = dbInsertDevData($devName, $devPwd, $devData);
        echo $result;
    }
    exit;
}
echo "check parameters<br>";
echo "data: " . $_GET['PostData'];
exit;
function myDecode($string)
{
/*
 * Fill a tab with a mutlidimensionnal Array we put in $tpl
 */
$elemArr = array();
for ($i = 0; $report =& $DBRESULT->fetchRow(); $i++) {
    $moptions = "";
    $selectedElements =& $form->addElement('checkbox', "select[" . $report['report_id'] . "]");
    $moptions .= "<a href='main.php?p=" . $p . "&report_id=" . $report['report_id'] . "&o=rn'><img src='img/icones/16x16/gears_run.gif' border='0' alt='" . _("Run now") . "'></a>&nbsp;&nbsp;";
    if ($report["activate"]) {
        $moptions .= "<a href='main.php?p=" . $p . "&report_id=" . $report['report_id'] . "&o=u&limit=" . $limit . "&num=" . $num . "&search=" . $search . "'><img src='img/icones/16x16/element_previous.gif' border='0' alt='" . _("Disabled") . "'></a>&nbsp;&nbsp;";
    } else {
        $moptions .= "<a href='main.php?p=" . $p . "&report_id=" . $report['report_id'] . "&o=s&limit=" . $limit . "&num=" . $num . "&search=" . $search . "'><img src='img/icones/16x16/element_next.gif' border='0' alt='" . _("Enabled") . "'></a>&nbsp;&nbsp;";
    }
    $moptions .= "&nbsp;&nbsp;&nbsp;";
    $moptions .= "<input onKeypress=\"if(event.keyCode > 31 && (event.keyCode < 45 || event.keyCode > 57)) event.returnValue = false; if(event.which > 31 && (event.which < 45 || event.which > 57)) return false;\" maxlength=\"3\" size=\"3\" value='1' style=\"margin-bottom:0px;\" name='dupNbr[" . $report['report_id'] . "]'></input>";
    $elemArr[$i] = array("MenuClass" => "list_" . $style, "RowMenu_select" => $selectedElements->toHtml(), "RowMenu_name" => myDecode($report["name"]), "RowMenu_link" => "?p=" . $p . "&o=c&report_id=" . $report['report_id'], "RowMenu_desc" => myDecode(substr($report["report_description"], 0, 40)), "RowMenu_status" => $tabStatus[$report["activate"]], "RowMenu_schedule" => $periodList[myDecode($report["period"])], "RowMenu_options" => $moptions);
    $style != "two" ? $style = "two" : ($style = "one");
}
$tpl->assign("elemArr", $elemArr);
#Different messages we put in the template
$tpl->assign('msg', array("addL" => "?p=" . $p . "&o=a", "addT" => _("Add"), "delConfirm" => _("Do you confirm the deletion ?")));
#
##Toolbar select
#
?>
	<script type="text/javascript">
	function setO(_i) {
		document.forms['form'].elements['o'].value = _i;
	}
	</SCRIPT>
	<?php