/**
 * serverDown()
 * Report that the server is down, eventually activate the notifier
 * 
 * @return str 'Reported'
 */
function serverDown()
{
    global $settings;
    updateSetting('server_status', 'down');
    /*
     * NOTIFIER
     * 
     * - Sends an e-mail when the server is down
     */
    if ($settings['notify'] == 'true' && $settings['notify_sent'] == 'false') {
        // Message
        $message = 'Hello!' . PHP_EOL . 'The servertool could not connect to your BFP4F server, please check your server and your RCON information.' . PHP_EOL . 'Click on this link to access the ControlPanel: ' . HOME_URL . PHP_EOL . PHP_EOL . 'BF2 Servertool Notifier';
        // Send e-mail
        Email($settings['notify_email'], $settings['notify_email'], 'Server is down!', $message);
        // Update the notifier, so it won't send another e-mail the next time
        updateSetting('notify_sent', 'true');
    }
    return 'Reported';
}
示例#2
0
<?php

return function ($site, $pages, $page) {
    $data = array('name' => get('name'), 'email' => get('email'), 'phone' => get('phone'), 'message' => get('message'));
    $rules = array('name' => array('required'), 'email' => array('required'));
    $messages = array('name' => 'Please enter a valid name', 'email' => 'Please enter a valid email address', 'phone' => 'Please enter a phone number');
    if ($invalid = invalid($data, $rules, $messages)) {
        echo "failure";
    } else {
        $body = snippet('contactmail', $data, true);
        $email = Email(array('to' => '*****@*****.**', 'from' => '*****@*****.**', 'subject' => 'New contact request', 'replyTo' => $data['email'], 'body' => $body));
        $email_confirmation = Email(array('to' => '*****@*****.**', 'from' => '*****@*****.**', 'subject' => 'New contact request', 'replyTo' => $data['email'], 'body' => $body));
        if ($email->send()) {
            $email_confirmation->send();
            echo 'success';
        } else {
            echo 'email failed';
        }
    }
};
示例#3
0
 * ->class('someclass'),
 * for a placeholder: ->placeholder('Some text'). If the attribute doesn't
 * take a value just omit it, so : ->required()
 *
 * In addition to HTML attributes, each element takes meta-data such as the
 * submitted value. All meta-data is set in exactly the same way but is prefixed
 * with a single underscore. For example, you can set the form's show_submitted
 * flag with ->_show_submitted(true), or force an initial check on a specific
 * item in a radioset using ->_value('name') -- in this case you are setting up
 * the element to appear as if that value was already submitted to it.
 *
 * This is done to make form specification as terse and fluent as possible
 * -- yet still giving control where needed.
 *
 **/
$contact_form = Form('contact', './')->setRenderer($r)->onSuccess('MySuccessHandler')->novalidate()->add(Fieldset('About you...', 'about')->class('about')->add(Checkbox('control', '>Collect Personal Details', 'ok')->_ignore_parent_fields('disabled,readonly,required'))->add(Input('salutation', 'Title', 'Your title please')->autofocus()->datalist($salutations)->required())->add(Input('name', 'Your Name', 'Your name please')->autocomplete('off')->required()->validator('myNameValidator'))->add(Email('email', 'Your Email', 'Your email address')->required()->autocomplete('off'))->add(URL('url', 'Website', 'Your URL here (optional)'))->add(Hidden('secret', '123'))->add(Password('pass', 'Your Password', 'Enter a password of 10 characters or more')->required()->minlength(10, '10+ chars. please'))->add(Password('oth', 'Repeat Password', 'Enter password again')->required()->minlength(10, '10+ chars. please')->matches('pass', 'This must match what you typed in the "Your Password" field.'))->add(Tel('tel', 'Phone', 'A contact number please')->pattern('/^[\\s]*[\\+]?[0-9][-0-9]*[\\s-0-9]*[\\s]*$/', 'Enter a valid phone number. This can start with an international code like +44 if needed.'))->add(Input('human', 'Are you human?', 'No bots please')->pattern('/^yes|yep|yeah|sure am|indeed$/i', 'Some form of affirmation is needed.')->required())->add(YesNo('alive', 'Were you alive when you celebrated your last birthday?', 'Babies excluded.', 'Just yes or no please.')->required())->add(Integer('age', 'How old are you?')->value(5)->min(2)->max(10)))->add(Fieldset('Your message...')->add(TextArea('msg', 'Message', 'Your message to us')->required()->pattern('/^[^0-9]*$/', 'No numbers please!')->whitelist('great,good,fantastic,amazing')))->add(Fieldset('Legal stuff...')->add(Radios('agreement', '>Do you agree to our terms?', $conditions)->required('* Please select one of the options')->validator('myConditionValidator'))->add(Checkboxes('options', 'Additional Options...', $checkboxes)->required()->value('spam_me'))->add(MSelect('depts', 'Forward to which departments?', $departments)->required('Please choose at least one department')->value('complaints-2 , complaints-3 , sales-0')))->add(Submit('Send'))->process();
/** ==================== Custom formatters follow ====================
 *
 * These all override, or append to, some aspect of the renderer's output
 * and should allow you fine enough control over your form output not to
 * have to resort to hand-crafted HTML.
 *
 * They are all enabled by setting values on the renderer.
 * Thay are also totally option. In fact, the default output of the renderer
 * should be fine in most cases so you can probably delete all the code in
 * this part of the file.
 **/
/**
 * Controls the output that goes at the head of the form when there are any
 * invalid elements. Use this only if the renderer's default markup isn't
 * what you need.
示例#4
0
         $Params[] = $this->Data['MyMeta'][$Param];
     }
 }
 switch ($this->Data['MetaSpec'][$MetaI]['type']) {
     case 'text':
         $MetaV = Gdn_Format::Text($MetaV);
         $Picasa = '';
         $Flickr = '';
         if ($this->Data['MetaSpec'][$MetaI]['social'] == 'picasa') {
             $Picasa = '<input type="hidden" class="picsa" value="' . $MetaV . '" />';
         }
         if ($this->Data['MetaSpec'][$MetaI]['social'] == 'flickr') {
             $Flickr = '<input type="hidden" class="flickr" value="' . $MetaV . '" />';
         }
         if (ValidateEmail($MetaV)) {
             $MetaV = Email($MetaV);
         } else {
             if (ValidateWebAddress($MetaV) && preg_match('`\\.(jpg|jpeg|gif|png)$`i', $MetaV)) {
                 $MetaV = Anchor(Img($MetaV, $MetaV), $MetaV);
             } else {
                 if (ValidateWebAddress($MetaV)) {
                     $LabelDefault = Gdn_Format::Text(GetValue('labeldefault', $this->Data['MetaSpec'][$MetaI]));
                     $Params = array_merge(array($this->User->Name, $this->Data['MetaSpec'][$MetaI]['name']), $Params);
                     $MetaV = '<a href="' . $MetaV . '">' . vsprintf(T('MyMeta.' . $MetaI . '.Label', $LabelDefault ? $LabelDefault : '%2$s'), $Params) . '</a>';
                 } else {
                     if ($this->Data['MetaSpec'][$MetaI]['urlformat'] && ValidateWebAddress($this->Data['MetaSpec'][$MetaI]['urlformat'])) {
                         $LabelDefault = Gdn_Format::Text(GetValue('labeldefault', $this->Data['MetaSpec'][$MetaI]));
                         $Params = array_merge(array($this->User->Name, $this->Data['MetaSpec'][$MetaI]['name']), $Params);
                         $MetaV = '<a href="' . str_replace('[id]', $MetaV, $this->Data['MetaSpec'][$MetaI]['urlformat']) . '">' . vsprintf(T('MyMeta.' . $MetaI . '.Label', $LabelDefault ? $LabelDefault : '%2$s'), $Params) . '</a>';
                     }
                 }
示例#5
0
    if ($file["error"][$i] > 0) {
        echo "Return Code: " . $file["error"][$i] . "<br />";
    } else {
        //To save attachments.
        move_uploaded_file($file["tmp_name"][$i], "upload/" . $file["name"][$i]);
        echo "Stored in: " . "upload/" . $file["name"][$i] . " with type" . $file["type"][$i];
        //
    }
}
$RecipientEmail = $_POST['recipient'];
echo "kjkj" . $RecipientEmail;
$RecipientName = $_POST['recipient'];
echo "jhjh" . $RecipientName;
$SenderEmail = "*****@*****.**";
$SenderName = "Admin";
$subject = $_POST['subject'];
$cc = $_POST['cc'];
$bcc = "";
// For HTML
$type = "";
$message = $_POST['content'];
$priority = "high";
if ($count == 0) {
    $attachments = "";
} else {
    for ($i = 0; $i < $count; $i++) {
        $attachments[$i] = "upload/" . $file["name"][$i] . ":" . $file["type"][$i] . ":" . $file["name"][$i];
    }
}
$sent = Email($RecipientEmail, $RecipientName, $SenderEmail, $SenderName, $cc, $bcc, $subject, $message, $attachments, $priority, $type);
echo $sent ? "Mail sent Successfully" : "Error in sending mail";
function EditUserData($idToEdit, $newName, $newEmail, $newPassword, $thenLogin = true)
{
    $link = Connect();
    $sql = "UPDATE `users` SET `name` = '{$newName}', `email` = '{$newEmail}', `password` = '{$newPassword}' WHERE `id` = '{$idToEdit}';";
    mysqli_query($link, $sql);
    echo mysql_error();
    if ($thenLogin) {
        AttemptLogin($newName, $newPassword);
    }
    Email($newEmail, "*****@*****.**", "DnD Account", "Your info has been edited! Your new name is: " . $newName . ", your password is: " . $newPassword . ". Check all other stuff online on http://www.timfalken.com/dnd/");
}
 public function testEmail()
 {
     $id = "*****@*****.**";
     $this->assertEquals(true, Email($id));
 }