本文整理匯總了PHP中PAGEHEADER函數的典型用法代碼示例。如果您正苦於以下問題:PHP PAGEHEADER函數的具體用法?PHP PAGEHEADER怎麽用?PHP PAGEHEADER使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PAGEHEADER函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SPITFORM
function SPITFORM($target_user, $new_uid, $error)
{
global $TBDB_UIDLEN;
$target_uid = $target_user->uid();
$target_webid = $target_user->webid();
$new_uid = CleanString($new_uid);
#
# Standard Testbed Header.
#
PAGEHEADER("Change login UID for user");
if ($error) {
# XSS prevention.
$error = CleanString($error);
echo "<center>\n <font size=+1 color=red>{$error}</font>\n </center><br>\n";
} else {
echo "<center>\n <font size=+1>\n Please enter the new UID for user '{$target_uid}'<br><br>\n </font>\n </center>\n";
}
echo "<table align=center border=1>\n <form action=changeuid.php method=post>\n <tr>\n <td>New UID:</td>\n <td><input type=text\n name=\"new_uid\"\n value=\"{$new_uid}\"\n\t size={$TBDB_UIDLEN}\n\t maxlength={$TBDB_UIDLEN}></td>\n </tr>\n <tr>\n <td align=center colspan=2>\n <b><input type=submit value=\"Change UID\"\n name=submit></b>\n </td>\n </tr>\n\t <input type=hidden name=user value={$target_webid}>\n </form>\n </table>\n";
echo "<br><br>\n";
echo "<center>\n";
$target_user->Show();
echo "</center>\n";
PAGEFOOTER();
return;
}
示例2: CheckLoginOrDie
#
include "defs.php3";
#
# Only known and logged in users can do this.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
#
# Verify page arguments
#
$optargs = OptionalPageArguments("sortby", PAGEARG_STRING);
#
# Standard Testbed Header
#
PAGEHEADER("Emulab Site List");
if (!($isadmin || OPSGUY() || STUDLY())) {
USERERROR("Cannot view site list.", 1);
}
if (!isset($sortby)) {
$sortby = "created";
}
$sortclause = "";
if ($sortby == "created") {
$sortclause = "order by created";
} elseif ($sortby == "urn") {
$sortclause = "order by urn";
} elseif ($sortby == "commonname") {
$sortclause = "order by commonname";
} elseif ($sortby == "buildinfo") {
$sortclause = "order by buildinfo";
示例3: SPITFORM
function SPITFORM($formfields, $errors)
{
global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE;
global $projlist;
global $TBVALIDDIRS_HTML;
global $WIKIDOCURL;
PAGEHEADER("Create an Experiment Template");
if ($errors) {
echo "<table class=nogrid\n align=center border=0 cellpadding=6 cellspacing=0>\n <tr>\n <th align=center colspan=2>\n <font size=+1 color=red>\n Oops, please fix the following errors! \n </font>\n </td>\n </tr>\n";
while (list($name, $message) = each($errors)) {
# XSS prevention.
$message = CleanString($message);
echo "<tr>\n <td align=right>\n <font color=red>{$name}: </font></td>\n <td align=left>\n <font color=red>{$message}</font></td>\n </tr>\n";
}
echo "</table><br>\n";
}
# XSS prevention.
while (list($key, $val) = each($formfields)) {
$formfields[$key] = CleanString($val);
}
echo "<form enctype=multipart/form-data\n action=template_create.php method=post>\n";
echo "<table align=center border=1>\n";
#
# Select Project
#
echo "<tr>\n\t <td class='pad4'>Select Project:</td>\n\t <td class='pad4'><select name=\"formfields[pid]\">\n";
# If just one project, make sure just the one option.
if (count($projlist) != 1) {
echo "<option value=''>Please Select  </option>\n";
}
while (list($project) = each($projlist)) {
$selected = "";
if (strcmp($formfields["pid"], $project) == 0) {
$selected = "selected";
}
echo " <option {$selected} value=\"{$project}\">\n\t\t\t {$project} </option>\n";
}
echo " </select>";
echo " </td>\n\t </tr>\n";
#
# Select a group
#
echo "<tr>\n\t <td class='pad4'>Group:</td>\n\t <td class='pad4'><select name=\"formfields[gid]\">\n\t <option value=''>Default Group </option>\n";
reset($projlist);
while (list($project, $grouplist) = each($projlist)) {
for ($i = 0; $i < count($grouplist); $i++) {
$group = $grouplist[$i];
if (strcmp($project, $group)) {
$selected = "";
if (isset($formfields["gid"]) && isset($formfields["pid"]) && strcmp($formfields["pid"], $project) == 0 && strcmp($formfields["gid"], $group) == 0) {
$selected = "selected";
}
echo "<option {$selected} value=\"{$group}\">\n\t\t\t {$project}/{$group}</option>\n";
}
}
}
echo " </select>\n\t <font size=-1>(Must be default or correspond to selected project)\n\t </font>\n\t </td>\n\t </tr>\n";
#
# TID:
#
echo "<tr>\n <td class='pad4'>Template ID:\n <br><font size='-1'>(alphanumeric, no blanks)</font></td>\n <td class='pad4' class=left>\n <input type=text\n name=\"formfields[tid]\"\n value=\"" . $formfields["tid"] . "\"\n\t size={$TBDB_EIDLEN}\n maxlength={$TBDB_EIDLEN}>\n </td>\n </tr>\n";
#
# NS file
#
if (isset($formfields["nsref"])) {
$nsref = $formfields["nsref"];
if (isset($formfields["guid"])) {
$guid = $formfields["guid"];
echo "<tr>\n <td class='pad4'>Your auto-generated NS file:  </td>\n <input type=hidden name=\"formfields[nsref]\"\n value={$nsref}>\n <input type=hidden name=\"formfields[guid]\"\n value={$guid}>\n <td class='pad4'>\n <a target=_blank\n href=\"spitnsdata.php3?nsref={$nsref}&guid={$guid}\">\n View NS File</a></td>\n </tr>\n";
} else {
echo "<tr>\n <td class='pad4'>Your auto-generated NS file:  </td>\n <input type=hidden name=\"formfields[nsref]\"\n value={$nsref}>\n <td class='pad4'>\n <a target=_blank href=spitnsdata.php3?nsref={$nsref}>\n View NS File</a></td>\n </tr>\n";
}
} else {
echo "<tr>\n <td class='pad4'>Your NS file: </td>\n <td><table cellspacing=0 cellpadding=0 border=0>\n <tr>\n <td class='pad4'>Upload<br>\n\t\t\t<font size='-1'>(500k max)</font></td>\n <td class='pad4'>\n <input type=hidden name=MAX_FILE_SIZE value=512000>\n\t <input type=file\n name=nsfile\n value=\"" . $formfields["nsfile"] . "\"\n\t size=30>\n </td>\n </tr><tr>\n <td> <b>or</b></td><td></td>\n </tr><tr>\n <td class='pad4'>On Server<br>\n <font size='-1'>({$TBVALIDDIRS_HTML})</font></td>\n <td class='pad4'>\n\t <input type=text\n name=\"formfields[localnsfile]\"\n value=\"" . $formfields["localnsfile"] . "\"\n\t size=40>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n";
}
echo "<tr>\n <td colspan=2>\n Use this text area to describe your template:\n </td>\n </tr>\n <tr>\n <td colspan=2 align=center class=left>\n <textarea name=\"formfields[description]\"\n rows=10 cols=80>" . str_replace("\r", "", $formfields["description"]) . "</textarea>\n </td>\n </tr>\n";
echo "<tr>\n <td class='pad4' align=center colspan=2>\n <b><input type=submit name=create value='Create Template'></b>\n </td>\n </tr>\n </form>\n </table>\n";
echo "<blockquote><blockquote>\n <ol>\n <li> Please read this\n <a href='{$WIKIDOCURL}/kb112'>KB entry</a>\n to see what NS extensions are available for templates.\n </ol>\n </blockquote></blockquote>\n";
}
示例4: USERERROR
if (!$instance->ValidRun($runidx)) {
USERERROR("The run {$runidx} is not a valid experiment run!", 1);
}
#
# For the Sajax Interface
#
function ModifyAnno($newtext)
{
global $this_user, $template, $instance, $runidx;
$instance->SetRunAnnotation($this_user, $runidx, $newtext);
return 0;
}
#
# See if this request is to the above function. Does not return
# if it is. Otherwise return and continue on.
#
sajax_handle_client_request();
#
# Standard Testbed Header after argument checking.
#
PAGEHEADER("Experiment Run");
echo "<script type='text/javascript' language='javascript'>\n";
sajax_show_javascript();
echo "</script>\n";
echo $instance->RunPageHeader($runidx);
echo "<br><br>\n";
$instance->ShowRun($runidx);
#
# Standard Testbed Footer
#
PAGEFOOTER();
示例5: elseif
if (isset($query) && $query != $defaultsearchstring) {
$showtypes[] = "cm";
} elseif (!isset($showtype)) {
$showtypes[] = "cm";
$showtypes[] = "sa";
$showtypes[] = "ch";
} else {
if (!($showtype == "sa" || $showtype == "cm" || $showtype == "ch")) {
USERERROR("Improper argument: showtype={$showtype}", 1);
}
$showtypes[] = $showtype;
}
#
# Standard Testbed Header
#
PAGEHEADER("Geni Slice List");
if (!($isadmin || STUDLY())) {
USERERROR("You do not have permission to view Geni slice list!", 1);
}
#
# Search box for CM only.
#
if (isset($query) && $query != $defaultsearchstring) {
$searchstring = $query;
} else {
$searchstring = $defaultsearchstring;
}
echo "<center>";
echo "<table class=stealth>\n";
echo "<tr>";
echo "<td class=stealth>";
示例6: ISADMIN
$uid_idx = $this_user->uid_idx();
$isadmin = ISADMIN();
#
# Verify feature is enabled
#
if (!$PUBSUPPORT) {
USERERROR("Publication support not enabled.");
}
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("submit", PAGEARG_STRING, "idx", PAGEARG_INTEGER, "formfields", PAGEARG_ARRAY);
#
# Standard Testbed Header
#
PAGEHEADER("Submit Publication");
$also_required = array();
$also_required['article'] = array('conf', 'month');
$typelist = array('article', 'phd thesis', 'masters thesis', 'bachelors thesis', 'techreport', 'unpublished', 'talk', 'software', 'service');
$submit_url = isset($idx) ? CreateURL("submitpub", 'idx', $idx) : CreateURL("submitpub");
#
# Make Month List
#
$monthlist = array();
$query_result = DBQueryFatal("select * from emulab_pubs_month_map order by display_order");
while ($r = mysql_fetch_array($query_result)) {
$monthlist[$r['month']] = $r['month_name'];
}
#
# Make Project List
#
示例7: OptionalPageArguments
#
# }}}
#
require "defs.php3";
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("printable", PAGEARG_BOOLEAN);
if (!isset($printable)) {
$printable = 0;
}
#
# Standard Testbed Header
#
if (!$printable) {
PAGEHEADER("Emulab Copyright Notice");
}
if ($printable) {
#
# Need to spit out some header stuff.
#
echo "<html>\n <head>\n <title>Copyright Notice</title>\n \t <link rel='stylesheet' href='tbstyle-plain.css' type='text/css'>\n </head>\n <body>\n";
} else {
echo "<b><a href='copyright.php?printable=1'>\n Printable version of this document</a></b><br>\n";
echo "<p><center><b>Copyright Notice</b></center><br>\n";
}
#
# Allow for a site specific copyright
#
$sitefile = "copyright-local.html";
if (!file_exists($sitefile)) {
示例8: OptionalPageArguments
# Verify Page Arguments.
#
$optargs = OptionalPageArguments("searchfor", PAGEARG_STRING, "search", PAGEARG_STRING, "slice_uuid", PAGEARG_STRING, "ch", PAGEARG_BOOLEAN, "index", PAGEARG_INTEGER);
if (!isset($index)) {
$index = 0;
}
if (!isset($searchfor)) {
$searchfor = $searchbox;
}
if (!isset($ch)) {
$ch = 0;
}
#
# Standard Testbed Header
#
PAGEHEADER("Geni History");
if (!($isadmin || STUDLY())) {
USERERROR("You do not have permission to view Geni slice list!", 1);
}
#
# Spit out a search form
#
echo "<br>";
echo "<form action=genihistory.php method=post>\n <b>Search:</b> \n <input type=text\n name=searchfor\n size=50\n value=\"{$searchfor}\"";
if ($searchfor == $searchbox) {
echo " onfocus='focus_text(this, \"{$searchfor}\")'\n onblur='blur_text(this, \"{$searchfor}\")'";
}
echo " />\n <b><input type=submit name=search value=Go></b> ";
if ($ISCLRHOUSE) {
echo "<input type=checkbox name=ch value=1 " . ($ch ? "checked" : "") . "> Search CH";
}
示例9: EXPERROR
} else {
$thensfile = "/tmp/{$uid}-{$nsref}.nsfile";
}
if (!file_exists($thensfile)) {
$errors["NS File"] = "Temp file no longer exists on server";
EXPERROR();
}
$deletensfile = 1;
} elseif ($nsfilelocale == "upload") {
$thensfile = $_FILES['exp_nsfile']['tmp_name'];
chmod($thensfile, 0666);
} else {
$nonsfile = 1;
}
# Okay, we can spit back a header now that there is no worry of redirect.
PAGEHEADER("Begin a Testbed Experiment");
#
# Convert other arguments to script parameters.
#
$exp_swappable = "";
# Experiments are swappable by default; supply reason if noswap requested.
if ($formfields["exp_swappable"] == "0") {
$exp_swappable .= " -S " . escapeshellarg($formfields["exp_noswap_reason"]);
}
if ($formfields["exp_autoswap"] == "1") {
$exp_swappable .= " -a " . 60 * $formfields["exp_autoswap_timeout"];
}
# Experiments are idle swapped by default; supply reason if noidleswap requested.
if ($formfields["exp_idleswap"] == "1") {
$exp_swappable .= " -l " . 60 * $formfields["exp_idleswap_timeout"];
} else {
示例10: CheckLoginOrDie
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
include "defs.php3";
include "form_defs.php";
#
# Only known and logged in users.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$optargs = OptionalPageArguments("submit", PAGEARG_STRING, "formfields", PAGEARG_ARRAY);
PAGEHEADER("Silly Forms example");
# The form attributes:
$form = array('#id' => 'form1', '#caption' => 'My Form', '#enctype' => 'multipart/form-data', '#action' => 'form_example.php');
# A set of form fields.
$fields = array();
# Text field.
$fields['slot1'] = array('#type' => 'textfield', '#label' => 'Slot1', '#value' => 'Hello World', '#size' => 60, '#maxlength' => 64, '#description' => 'Alphanumeric, No Blanks');
# Password
$fields['slot2'] = array('#type' => 'password', '#label' => 'Password', '#required' => TRUE, '#footnote' => 'This is a footnote', '#size' => 8);
#
# File Upload. You must set '#enctype' in the form array above.
#
# Files are special cause PHP puts all the stuff into the $_FILES
# superglobal. So, there is nothing in $formfields for them. For
# doing the validation, easiest to define a local function.
#
示例11: while
# print data
while ($row = mysql_fetch_array($qres)) {
echo $row[$resource];
foreach ($fields[$resource] as $f => $finfo) {
echo "\t" . $row[$f] . "";
}
echo "\n";
}
return;
}
#
# Standard Testbed Header (do this after checking getdata so we do not spit
# headers if getdata=1 -- of course, if any args are bad, the error msgs will
# be screwed up!)
#
PAGEHEADER("Resource Usage Visualization");
#
# Pull in some style sheets.
#
echo "<link type=text/css rel=stylesheet href={$TBBASE}/rusage_viz.css />\n";
if (!$isadmin) {
USERERROR("You do not have permission to view the resource usage viz!", 1);
}
#
# Dump some Emulab auth vars for the xmlhttprequests
#
$auth = $HTTP_COOKIE_VARS[$TBAUTHCOOKIE];
echo "<script language=javascript type=text/javascript>\n";
echo "var tbuid = \"{$uid}\";\n";
echo "var tbauth = \"{$auth}\";\n";
#
示例12: PAGEFOOTER
}
echo "<form action='{$url}' method=post>\n";
echo "<br>\n";
echo "<b><input type=submit name=confirmed value=Confirm></b>\n";
echo "<b><input type=submit name=canceled value=Cancel></b>\n";
echo "<input type=hidden name=referrer value={$referrer}>\n";
echo "</form>\n";
echo "</center>\n";
PAGEFOOTER();
return;
}
#
# Avoid SIGPROF in child.
#
set_time_limit(0);
PAGEHEADER("Reconstitute");
echo $template->PageHeader();
echo "<br><br>\n";
echo "<script type='text/javascript' src='template_sup.js'>\n";
echo "</script>\n";
STARTBUSY("Starting Database Reconstitution");
sleep(1);
#
# Run the backend script
#
$retval = SUEXEC($uid, "{$unix_pid},{$unix_gid}", "webtemplate_analyze -i {$exptidx} {$guid}/{$vers}", SUEXEC_ACTION_IGNORE);
/* Clear the 'loading' indicators above */
if ($retval) {
CLEARBUSY();
} else {
STOPBUSY();
示例13: set_time_limit
if (isset($spew) && $spew) {
$spew = 1;
} else {
$spew = 0;
}
if (isset($overwrite) && $overwrite) {
$overwrite = 1;
} else {
$overwrite = 0;
}
#
# Avoid SIGPROF in child.
#
set_time_limit(0);
if (!$spew) {
PAGEHEADER("Template Export");
echo $template->PageHeader();
echo "<br><br>\n";
echo "<script type='text/javascript' language='javascript' " . " src='template_sup.js'>\n";
echo "</script>\n";
STARTBUSY("Starting export");
sleep(1);
}
#
# A cleanup function to keep the child from becoming a zombie, since
# the script is terminated, but the children are left to roam.
#
$fp = 0;
function SPEWCLEANUP()
{
global $fp;
示例14: CheckLoginOrDie
# Only known and logged in users can do this.
#
$this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
if (!$isadmin && !STUDLY()) {
USERERROR("You are not allowed to view this page!", 1);
}
#
# Verify page arguments.
#
$optargs = OptionalPageArguments("type", PAGEARG_STRING);
#
# Standard Testbed Header
#
PAGEHEADER("Node Control Center");
$query_result = DBQueryFatal("select n.inception,util.*, " . " UNIX_TIMESTAMP(now())-UNIX_TIMESTAMP(n.inception) as age " . " from node_utilization as util " . "left join nodes as n on n.node_id=util.node_id " . "left join node_types as t on t.type=n.type " . "where n.inception is not null and t.class='pc' and " . " role='testnode'" . "order BY priority");
if (mysql_num_rows($query_result) == 0) {
echo "<center>Oops, no nodes to show you!</center>";
PAGEFOOTER();
exit;
}
echo "<center>\n <table id='nodetable' align=center cellpadding=2 border=1>\n <thead class='sort'>\n <tr>\n <th>Node ID</th>\n <th>Inception Date</th>\n <th align=center>Age<br>(seconds)</th>\n <th align=center>Free<br>(seconds)</th>\n <th align=center>Free<br>(percent)</th>\n <th align=center>Alloc<br>(seconds)</th>\n <th align=center>Alloc<br>(percent)</th>\n <th align=center>Down<br>(seconds)</th>\n <th align=center>Down<br>(percent)</th>\n </tr>\n </thead>\n";
while ($row = mysql_fetch_array($query_result)) {
$node_id = $row["node_id"];
$inception = $row["inception"];
$age = $row["age"];
$alloctime = $row["allocated"];
$downtime = $row["down"];
$freetime = $age - ($alloctime + $downtime);
$allocpercent = sprintf("%.3f", $alloctime / $age * 100);
示例15: sleep
sleep(1);
PAGEERROR("Invalid peer login request");
}
# Delete the entry so it cannot be reused, even on failure.
DBQueryFatal("delete from login " . "where uid='{$target_uid}' and hashhash='{$safe_key}'");
#
# Now do the login, which can still fail.
#
$dologin_status = DOLOGIN($user->uid(), "", 0, 1);
if ($dologin_status == DOLOGIN_STATUS_WEBFREEZE) {
# Short delay.
sleep(1);
PAGEHEADER("Login");
echo "<h3>\n Your account has been frozen due to earlier login attempt\n failures. You must contact {$TBMAILADDR} to have your account\n restored. <br> <br>\n Please do not attempt to login again; it will not work!\n </h3>\n";
PAGEFOOTER();
die("");
} else {
if ($dologin_status != DOLOGIN_STATUS_OKAY) {
# Short delay.
sleep(1);
PAGEHEADER("Login");
echo "<h3>Peer login failed. Please contact {$TBMAILADDR}</h3>\n";
PAGEFOOTER();
die("");
} else {
#
# Zap back to front page in secure mode.
#
header("Location: {$TBBASE}/showuser.php3?user={$target_uid}");
}
}