$type = 'success'; $msg = 'User added!'; } else { $type = 'warning'; $msg = 'User cannot create!'; } echo "<div class=\"alert alert-{$type} alert-dismissible\" role=\"alert\">\n<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button>\n{$msg}</div>"; } if (isAjax()) { switch (post("a")) { case 'delete': if (isset($_POST['id'])) { $v = post("id"); $id = intval($v); if ($id > 0 && !is_array($v)) { $ans = CAdmin::removeUser($id); echo $ans ? "OK" : "Can't remove user"; exit; } else { exit; } } else { exit; } break; default: exit; } } $content = "<div class='container'><div class='page-header'> "; $content = "<div class='panel'>\n<form class=\"form-inline toggle-disabled\" method='post'>\n <div class=\"form-group\">\n <label for=\"name\">Name</label>\n <input type=\"text\" name='username' class=\"form-control valid\" id=\"username\" placeholder=\"Jane Doe\"\n data-validation-event='keyup'\n data-validation=\"letternumeric,required,length\"\n data-validation-length=\"3-32\"\n >\n </div>\n <div class=\"form-group\">\n <label for=\"p\">Password</label>\n <input type=\"password\" name='password' class=\"form-control valid\" id=\"password\" placeholder=\"My Precious\"\n data-validation-event='keyup'\n data-validation=\"required,letternumeric\"\n data-validation-error-msg='Only alphabetic chars and digits allowed'\n >\n </div>\n <button type='submit' class=\"btn btn-default\">Add User</button>\n <button class=\"btn btn-info media-right\" id='button-refresh-table'>Refresh Table</button>\n</form>\n<script>\n\$.validate({\n modules : 'security, toggleDisabled',\n disabledFormFilter : 'form.toggle-disabled',\n onModulesLoaded : function() {\n console.log('validators loaded');\n }\n });\n</script>\n</div>";