本文整理汇总了PHP中Vars::POST方法的典型用法代码示例。如果您正苦于以下问题:PHP Vars::POST方法的具体用法?PHP Vars::POST怎么用?PHP Vars::POST使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vars
的用法示例。
在下文中一共展示了Vars::POST方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUser
/**
* Add a User
*
* $data = array(
* 'firstname' => '',
* 'lastname' => '',
* 'email' => '',
* 'password' => '',
* 'code' => '',
* 'location' => '',
* 'hub' => '',
* 'confirm' => false);
*/
public static function addUser($data)
{
/*$data = array(
'firstname' => '',
'lastname' => '',
'email' => '',
'password' => '',
'code' => '',
'location' => '',
'hub' => '',
'confirm' => false);*/
$exists = self::CheckUserEmail($data['email']);
if (is_object($exists)) {
self::$error = 'Email already exists';
return false;
}
//Set the password, add some salt
$salt = md5(date('His'));
$password = md5($data['password'] . $salt);
//Stuff it into here, the confirmation email will use it.
self::$salt = $salt;
$code = DB::escape(strtoupper($data['code']));
$firstname = DB::escape(ucwords($data['firstname']));
$lastname = DB::escape(ucwords($data['lastname']));
$location = DB::escape(strtoupper($data['location']));
//Add this stuff in
if ($data['confirm'] === true) {
$confirm = 1;
} else {
$confirm = 0;
}
$sql = "INSERT INTO " . TABLE_PREFIX . "pilots (firstname, lastname, email,\n\t\t\t\t\tcode, location, hub, password, salt, confirmed, joindate, lastip)\n\t\t\t\t VALUES ('{$firstname}', '{$lastname}', '{$data['email']}', '{$code}',\n\t\t\t\t\t\t\t'{$location}', '{$data['hub']}', '{$password}', '{$salt}', {$confirm}, NOW(), '{$_SERVER['REMOTE_ADDR']}')";
$res = DB::query($sql);
if (DB::errno() != 0) {
if (DB::errno() == 1062) {
self::$error = 'This email address is already registered';
return false;
}
self::$error = DB::error();
return false;
}
//Grab the new pilotid, we need it to insert those "custom fields"
$pilotid = DB::$insert_id;
RanksData::CalculateUpdatePilotRank($pilotid);
PilotData::GenerateSignature($pilotid);
/* Add them to the default group */
$defaultGroup = SettingsData::getSettingValue('DEFAULT_GROUP');
PilotGroups::addUsertoGroup($pilotid, $defaultGroup);
// For later
self::$pilotid = $pilotid;
//Get customs fields
$fields = self::GetCustomFields();
if (!$fields) {
return true;
}
foreach ($fields as $field) {
$value = Vars::POST($field->fieldname);
$value = DB::escape($value);
if ($value != '') {
$sql = "INSERT INTO " . TABLE_PREFIX . "fieldvalues (fieldid, pilotid, value)\n\t\t\t\t\t\t\tVALUES ({$field->fieldid}, {$pilotid}, '{$value}')";
DB::query($sql);
}
}
return true;
}
示例2: explode
<dt><?php
echo $field->title;
?>
</dt>
<dd>
<?php
if ($field->type == 'dropdown') {
echo "<select name=\"{$field->fieldname}\">";
$values = explode(',', $field->value);
if (is_array($values)) {
foreach ($values as $val) {
$val = trim($val);
echo "<option value=\"{$val}\">{$val}</option>";
}
}
echo '</select>';
} elseif ($field->type == 'textarea') {
echo '<textarea name="' . $field->fieldname . '" class="customfield_textarea"></textarea>';
} else {
?>
<input type="text" name="<?php
echo $field->fieldname;
?>
" value="<?php
echo Vars::POST($field->fieldname);
?>
" /></dd>
<?php
}
}
}
示例3: foreach
<dt>Hub: *</dt>
<dd>
<select name="hub" id="hub">
<?php
foreach ($hub_list as $hub) {
echo '<option value="' . $hub->icao . '">' . $hub->icao . ' - ' . $hub->name . '</option>';
}
?>
</select>
</dd>
<dt>Location: *</dt>
<dd><select name="location">
<?php
foreach ($country_list as $countryCode => $countryName) {
if (Vars::POST('location') == $countryCode) {
$sel = 'selected="selected"';
} else {
$sel = '';
}
echo '<option value="' . $countryCode . '" ' . $sel . '>' . $countryName . '</option>';
}
?>
</select>
<?php
if ($location_error == true) {
echo '<p class="error">Please enter your location</p>';
}
?>
</dd>