Пример #1
0
function load_groupcp()
{
    global $mybb, $db, $cache, $templates, $title, $header, $headerinclude, $footer, $theme, $group;
    if ($mybb->settings['rpgsuite_groupmanagecp'] && $mybb->input['action'] == "managegroup") {
        // Get group id
        if ($mybb->input['gid'] && $mybb->usergroup['issupermod']) {
            $gid = intval($mybb->input['gid']);
            $groupnav = '&gid=' . $gid;
        } else {
            $gid = $mybb->user['displaygroup'];
            $groupnav = '';
        }
        $cpcontent = "";
        if ($mybb->settings['rpgsuite_groupranks_custom']) {
            $customranklink = '<a href="modcp.php?action=managegroup&section=customranks' . $groupnav . '">Manage Custom Ranks</a>';
        } else {
            $customranklink = '';
        }
        $usergroup = new UserGroup($mybb, $db, $cache);
        if ($usergroup->initialize($gid)) {
            $group = $usergroup->get_info();
            if (handle_form($usergroup)) {
                $url = "modcp.php?action=managegroup&gid=" . $gid;
                if ($mybb->input['section']) {
                    $url .= "&section=" . $mybb->input['section'];
                }
                redirect($url, "Your pack settings were successfully updated.");
            }
            if ($mybb->input['section'] == 'groupoptions') {
                $title = 'Manage Options';
                add_breadcrumb('Manage Options');
                $cpcontent = load_groupmod_options($usergroup);
            } else {
                if ($mybb->input['section'] == 'groupmembers') {
                    $title = 'Manage Members';
                    add_breadcrumb('Manage Members');
                    $cpcontent = load_groupmod_members($usergroup);
                } else {
                    if ($mybb->input['section'] == 'customranks' && $mybb->settings['rpgsuite_groupranks_custom']) {
                        $ttile = 'Manage Custom Ranks';
                        add_breadcrumb('Manage Custom Ranks');
                        $cpcontent = load_groupmod_customranks($usergroup);
                    } else {
                        $title = 'Manage Ranks';
                        add_breadcrumb('Manage Ranks');
                        $cpcontent = load_groupmod_ranks($usergroup);
                    }
                }
            }
            // Add group styling
            eval("\$headerinclude .= \"" . $templates->get('rpgmisc_groupstyle') . "\";");
        } else {
            $cpcontent = "Invalid Group";
        }
        eval("\$groupmanagecp = \"" . $templates->get('rpggroupmanagecp_full') . "\";");
        output_page($groupmanagecp);
        exit;
    }
}
Пример #2
0
<?php

include 'dbconn.php';
?>
<!DOCTYPE html>
<head>
<title>Creating a drop down</title>
</head>
<body>
<pre><?php 
print_r($_GET);
?>
 </pre>
<?php 
if (isset($_GET['submitted'])) {
    handle_form($_GET['student']);
}
display_form("student");
?>
</body>
</html>
<?php 
function handle_form($id)
{
    $dbc = connect_to_db("jed");
    $query = "select lastname, firstname, major from student where ID = '{$id}'";
    $result = perform_query($dbc, $query);
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
    //print_r($row);
    $lastname = $row['lastname'];
    $firstname = $row['firstname'];
Пример #3
0
        if ($response->status == "401") {
            $errors[] = 'Invalid username/password combination';
        }
        if ($response->status == "200") {
            // Now we're going to setup ip, port and password
            $contents = "<?php\n                 \$ip = '{$ip}';\n                 \$port = '{$port}';\n                 \$rest_user = '******';\n                 \$rest_pass = '******';\n                 ";
            file_put_contents('settings.php', $contents);
        }
    }
    return $errors;
}
$setup = false;
$form = true;
// Check values are correct and then test connection
if (!empty($_POST['ip'])) {
    $errors = handle_form($_POST, $ctx);
    if (empty($errors)) {
        $form = false;
        $setup = true;
    }
}
if ($form) {
    // Error list
    if (!empty($errors)) {
        $list = "";
        foreach ($errors as $e) {
            $list .= '<li>' . $e . '</li>';
        }
        echo "<ul>{$list}</ul>";
    }
    $ip = isset($_POST['ip']) ? $_POST['ip'] : '';
<html>
<head>
    <title>XML demo 3: RSS News Viewer</title>
	<link rel="stylesheet" type="text/css" href="css/baseA.css" />	      
</head>
<body>
  <?php 
$feeds = array('http://rss.nytimes.com/services/xml/rss/nyt/Space.xml', 'http://www.usa.gov/rss/updates.xml', 'http://www.nasa.gov/rss/dyn/image_of_the_day.rss', 'http://cscilab.bc.edu/~csinsider/?feed=rss2', 'http://www.newyorker.com/feed/humor');
print_r($_GET);
?>
  <h1>RSS Feeds</h1>
  <?php 
create_form($feeds, "feed");
if (isset($_GET['getfeed'])) {
    handle_form($_GET['feed']);
}
?>
  </body>
</html>
<?php 
function handle_form($myfeed)
{
    $rss = simplexml_load_file($myfeed);
    $title = $rss->channel->title;
    echo "<h1>{$title}</h1>";
    # I would like to do this:
    #     foreach ($rss->channel->item as $item) {
    # or this:
    #     foreach ($rss->item as $item) {
    # but which one depends on the rss version in use.
    $items = $rss->channel->item;
Пример #5
0
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>Google Geocode XML Request</title>
</head>
<body>

</body>
</html>
<?php 
$address = isset($_GET['address']) ? $_GET['address'] : "";
display_form($address);
if (isset($_GET['submitForm']) && $address != "") {
    handle_form($address);
}
?>
</body>
</html>
<?php 
function display_form($address)
{
    ?>
		<fieldset><legend>Enter and Address to get Location Information</legend>
			<form method="get">
				Address:<input type="text" name=address size="55" value='<?php 
    echo $address;
    ?>
'/>
				<br><br>
				<input type="submit" name="submitForm" value="Get Info" />
Пример #6
0
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>PHP Form Example</title>
	<link rel="stylesheet" type="text/css" href="css/base.css" />
</head>
<body>
<?php 
echo "<pre>";
print_r($_GET);
echo "</pre>";
display_form();
if (isset($_GET['mysubmit'])) {
    handle_form();
}
?>
</body>
</html>
<?php 
function display_form()
{
    if (isset($_GET['count1'])) {
        $count1 = $_GET['count1'];
    } else {
        $count1 = '';
    }
    ?>
<fieldset>
	<legend>The First Form</legend>
	<form method="get">
Пример #7
0
$page_security = 15;
$path_to_root = "..";
include_once $path_to_root . "/includes/session.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/admin/db/maintenance_db.inc";
$valid_paths = valid_paths();
//$valid_paths = '';
if ($valid_paths != "") {
    page(tr("Backup and Restore Database - Error"));
    display_error(tr("Backup paths have not been set correctly.") . "&nbsp;&nbsp;&nbsp;" . tr("Please contact System Administrator.") . "<br>" . $valid_paths);
    end_page();
    exit;
}
$db_name = $_SESSION["wa_current_user"]->company;
$msg = handle_form($db_connections[$db_name]);
page(tr("Backup and Restore Database"));
//-------------------------------------------------------------------------------
start_form(true, true);
$cmb = get_backup_file_combo();
$compr = get_compr_combo();
echo "\n\t<script language='javascript'>\n\tfunction createBackup() {\n\t\text = document.forms[0].cmb_comp.options[document.forms[0].cmb_comp.selectedIndex].value\n\t\tcomm = document.forms[0].comments.value\n\t\tdocument.location.replace('backups.php?c=g&comp='+ext+'&comm='+comm)\n\t}\n\tfunction restoreBackup() {\n\t\tpFilename = document.forms[0].cmb_backups.options[document.forms[0].cmb_backups.selectedIndex].value\n\t\tdocument.location.replace('backups.php?c=r&fn='+pFilename)\n\t}\n\tfunction viewBackup() {\n\t\tpFilename = document.forms[0].cmb_backups.options[document.forms[0].cmb_backups.selectedIndex].value\n\t\tvar ext = pFilename.substr(pFilename.lastIndexOf('.') + 1)\n\t\tif (ext != 'sql') {\n\t\t\talert('" . tr('This extension can not be be viewed: ') . "' + ext)\n\t\t\treturn\n\t\t}\t\n\t\twindow.open('" . BACKUP_PATH . "'+pFilename, '', 'toolbar=no,scrollbars=yes')\n\t}\n\tfunction deleteBackup() {\n\t\tpFilename = document.forms[0].cmb_backups.options[document.forms[0].cmb_backups.selectedIndex].value\n\t\tif (!confirm('" . tr("Are you sure you want to delete the backup file - ") . "'+pFilename+'?'))\n\t\t\treturn\n\t\tdocument.location.replace('backups.php?c=df&fn='+pFilename)\n\t}\n\tfunction downloadBackup() {\n\t\tpFilename = document.forms[0].cmb_backups.options[document.forms[0].cmb_backups.selectedIndex].value\n\t\tdocument.location.replace('backups.php?c=ds&fn='+pFilename)\n\t}\n\tfunction uploadBackup() {\n\t\tif (document.forms[0].uploadfile.value=='') {\n\t\t\talert('" . tr("Please select a file to upload.") . "')\n\t\t\treturn\n\t\t}\n\t\tdocument.forms[0].action='backups.php?c=u&fn=' + document.forms[0].uploadfile.value\n\t\tdocument.forms[0].submit()\n\t}\n\t</script>\n\t<center>\n\t<table cellpadding=2 cellspacing=2 border=0>\n\t<tr><td colspan=2 style='color:darkred'><b>{$msg}</b>&nbsp;</td></tr>\n\t<tr>\n\t\t<td style='padding-right:30'>" . tr("Backup scripts") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td style='padding-right:30'>{$cmb}</td>\n\t\t<script language='javascript'>\n\t\t\tif (document.forms[0].cmb_backups.options.length!=0) document.forms[0].cmb_backups.selectedIndex=0\n\t\t</script>\n\t\t<td>\n\t\t\t<table height=160 cellpadding=0 cellspacing=0 border=0>\n\t\t\t<tr><td><input onclick='javascript:createBackup()' type='button' style='width:150' value='" . tr("Create Backup") . "'></td><td style='padding-left:20'>" . tr("Compression") . "&nbsp;&nbsp;{$compr}</td></tr>\n\t\t\t<tr><td><input onclick='javascript:restoreBackup()' type='button' style='width:150' value='" . tr("Restore Backup") . "'></td><td>&nbsp;</td></tr>\n\t\t\t<tr><td><input onclick='javascript:viewBackup()' type='button' style='width:150' value='" . tr("View Backup") . "'></td><td>&nbsp;</td></tr>\n\t\t\t<tr><td><input onclick='javascript:deleteBackup()' type='button' style='width:150' value='" . tr("Delete Backup") . "'></td><td>&nbsp;</td></tr>\n\t\t\t<tr><td><input onclick='javascript:downloadBackup()' type='button' style='width:150' value='" . tr("Download Backup") . "'></td><td>&nbsp;</td></tr>\n\t\t\t<tr><td><input onclick='javascript:uploadBackup()' type='button' style='width:150' value='" . tr("Upload Backup") . "'></td>\n\t\t\t\t<td style='padding-left:20'><input name='uploadfile' type='file'></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td style='padding-right:30'>" . tr("Comments") . " (" . tr("Create Backup") . ")</td>\n\t</tr>\n\t<tr>\n\t\t<td style='padding-right:30'><textarea rows=4 cols=30 name='comments'></textarea></td>\n\t</tr>\n\t</table></center>";
end_form();
//-------------------------------------------------------------------------------------------------
end_page();
function handle_form($conn)
{
    global $path_to_root;
    //Generate Only
    if (isset($_GET['c'])) {
        if ($_GET['c'] == 'g') {