Ejemplo n.º 1
0
         if (!checkBotname($_POST['name'])) {
             $errors[] = $tr["ERR_BOTNAME_FORMAT"];
         } else {
             if (SQL("SELECT 1 FROM bots WHERE name = ? AND accountID != ?", $name, $_SESSION["accountID"]) != null) {
                 $errors[] = $tr["ERR_NAME_CONFLICT"];
             } else {
                 $name = xssafe($_POST['name']);
             }
         }
     }
 }
 if (SQL("SELECT * FROM bots WHERE name = ? AND id != ?", $name, $id) != null) {
     $errors[] = $tr["ERR_NAME_CONFLICT"];
 }
 if (isset($_POST["className"]) && !empty($_POST["className"])) {
     if (!sanityCheck($_POST['className'], 'string', 1, 60)) {
         $errors[] = $tr["ERR_BOTCLASSNAME_LENGTH"];
     } else {
         $className = $_POST['className'];
     }
 }
 $codeFileUpload = isset($_FILES["codefile"]) && $_FILES["codefile"]["error"] != UPLOAD_ERR_NO_FILE;
 if ($codeFileUpload) {
     if ($_FILES["codefile"]["error"] == UPLOAD_ERR_OK) {
         //$code = file_get_contents($_FILES["codefile"]["tmp_name"]);
         $finfo = new finfo(FILEINFO_MIME_TYPE);
         $mimeType = $finfo->file($_FILES["codefile"]["tmp_name"]);
         if (strpos($mimeType, "text/") !== 0) {
             $errors[] = $tr["ERR_CODEFILE"];
         } else {
             if ($_FILES["codefile"]["size"] < BOT_CODE_MIN_LENGTH) {
Ejemplo n.º 2
0
function handleFacebookMessage($message, $uid, $db, $user_object, $total, $type)
{
    switch ($type) {
        case "fb":
            $con = "AND (expires_at>" . time() . " OR expires_at=0)";
            break;
        case "fbp":
            $con = "";
            break;
    }
    $condition = "SELECT *  FROM manager_" . $type . "_acc  WHERE userid=" . $uid . " AND expired=0  {$con}";
    if ($fbacc = $db->query($condition)) {
        if ($fbacc->rowCount() > 0) {
            $fbacc = $fbacc->fetch();
            /*foreach($fbacc as $key=>$value)
            		error_log(" $key => $value ");*/
            $timezone = time() + $fbacc['timezone'];
            $lastTime = $user_object->getLastPublishedTime($uid, $type, 1);
            $limit = $user_object->getAllPublishedWithinTimeFrame($uid, $type, 30, $timezone);
            if ($limit < 45 && sanityCheck($timezone, $lastTime, $total)) {
                try {
                    $hfb = new Handler_Facebook();
                    error_log(json_encode($message->getFacebookPostBody()));
                    if ($post = $hfb->post("/me/feed", $message->getFacebookPostBody(), $fbacc['access_token'])) {
                        $table = "manager_stats";
                        $fields = array("userid" => $uid, "social_network" => $type, "user_id" => $fbacc['user_id'], "message" => $message->getStatus(), "message_id" => $post['id'], "type" => 1, "time" => $timezone);
                        $db->doInsert($table, $fields);
                        $message->setLastShare();
                    } else {
                        error_log($hfb->getErrorMes());
                    }
                } catch (Exception $e) {
                    error_log($e);
                }
            }
        }
    }
}
 // Make sure that the email is syntactically valid
 if (empty($_REQUEST['userEmail']) == FALSE && sanityCheck($_REQUEST['userEmail'], 'string', 50) != FALSE) {
     if (checkEmail($_REQUEST['userEmail']) == FALSE) {
         echo '<p style="color:red">Please enter a valid email address.</p>';
         exit;
     } else {
         if ($user->email != $_REQUEST['userEmail']) {
             $user->email = $_REQUEST['userEmail'];
             echo "<p style=\"color:navy\">Email address successfully updated to {$user->email} </p>";
             $prompt = FALSE;
         }
     }
 }
 // Validate the user's cell phone number
 if (empty($_REQUEST['userCell']) == FALSE) {
     if (sanityCheck($_REQUEST['userCell'], 'numeric', 10) != FALSE) {
         if (strlen($_REQUEST['userCell']) != 10) {
             echo '<p style="color:red">A valid cell phone number must be exactly ten digits long</p>';
             $_REQUEST['userCell'] = '';
             exit;
         } else {
             if (($this_user_object = User::find('phone_number', $_REQUEST['userCell'])) != NULL) {
                 if ($this_user_object != $user) {
                     echo '<p style="color:red">There is already an account associated with this cell phone number.  If you do not have an account with username ';
                     $this_user_array = $this_user_object->get((array) 'username');
                     echo $this_user_array['username'];
                     echo ', email our <a href"mailto:tripledouble1210@gmail.com">Customer Service Department</a>.</p>';
                     exit;
                 }
             }
             $user->phone_number = $_REQUEST['userCell'];
Ejemplo n.º 4
0
<?php

require_once "php/include.php";
require_once 'php/recaptchalib.php';
if ($loggedin) {
    header('Location: summary.php');
    exit;
}
$errors = array();
$email = "";
$showCaptcha = false;
if (isset($_POST['email']) || isset($_POST['p']) || isset($_POST['pLength'])) {
    //form validation
    $email = $_POST['email'];
    if (!isset($_POST['pLength']) || !sanityCheck($_POST['pLength'], 'numeric', 0, 3)) {
        $errors[] = $tr["ERR_LOGIN"];
    } else {
        $pLength = intval($_POST['pLength']);
        if ($pLength < 6 || $pLength > 100) {
            $errors[] = $tr["ERR_LOGIN"];
        } else {
            $password = $_POST['p'];
        }
    }
    $password = $_POST['p'];
    $captchaGet = false;
    $captchaWrong = false;
    if (isset($_POST["recaptcha_challenge_field"]) && isset($_POST["recaptcha_challenge_field"])) {
        $captchaGet = true;
        $cap = recaptcha_check_answer("6Lev0-kSAAAAAKT9k5Ie0-1CWuxkywQmg2N8dNWr", $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
        if (!$cap->is_valid) {
Ejemplo n.º 5
0
    if (!is_string($m)) {
        $validationSuccsess = false;
        echo "<span style='color:red'>Meldingen inneholder ugyldige tegn.</span><br />";
    }
    if ($m == "Kommentarer til oss og spesielle ting vi skal ta hensyn til.") {
        $list['message'] = "";
    }
    return $validationSuccsess;
}
#### post functions.
#if "email" is filled out, send email
if (isset($_POST['email'])) {
    # print pre messages.
    echo "\n        <html>\n        <head>\n\t\t<meta http-equiv='content-type' content='text/html; charset=utf-8' />\n        <script>\n        function goBack()\n          {\n          window.history.back()\n          }\n        </script>\n        </head>\n        <body>\n\t";
    #var_dump($_POST);
    if (sanityCheck($_POST)) {
        #send email
        # the seminar application email.
        $coperio_mail = "bedrift@coperio.no,adm@stud.ntnu.no";
        $email = $coperio_mail;
        #$email = "*****@*****.**" ;
        # email subject
        $subject = "Coperio Timebestilling";
        # message body
        $message = " \n    \tTimebestilling:" . "\n\tNavn: " . $_POST['name'] . "\n\tTelefon: " . $_POST['phone'] . "\n\tE-post: " . $_POST['email'] . "\n\tØnsket tid: " . $_POST['time'] . "\n\tKommentarer: " . $_POST['message'] . "\n";
        # email headers.
        $headers = "From: " . $coperio_mail . "\r\n" . 'Reply-To: ' . "{$coperio_mail} \r\n" . 'X-Mailer: PHP/' . phpversion() . "Content-Type: text/html; charset=utf-8\r\n";
        # sending the email
        mail($email, $subject, $message, $headers);
        # Enrollment confirmation
        $email = $_POST['email'];
Ejemplo n.º 6
0
if (!isset($site)) {
    die('This file is meant to be only included by other files!');
}
// this file deals with entering matches only
if (!isset($_GET['enter']) && !isset($_GET['edit']) && !isset($_GET['delete'])) {
    $site->dieAndEndPage();
}
// misc functions
require 'match.php';
$confirmed = 0;
if (isset($_POST['confirmed'])) {
    $confirmed = intval($_POST['confirmed']);
}
permissionsCheck();
sanityCheck($confirmed);
// start processing cases
if ($confirmed === 0) {
    // display entering form
    open_form();
    // this step is already the confirmation step for deleting a match
    if (isset($_GET['delete'])) {
        generate_confirmation_key();
    }
    echo '<div>';
    $site->write_self_closing_tag('input type="hidden" name="confirmed" value="1"');
    echo '</div>' . "\n";
    // user got sent back because of wrong data in the form for instance
    if (isset($_POST['team_id1']) && isset($_POST['team_id2']) && isset($_POST['team1_points']) && isset($_POST['team2_points']) && isset($_POST['duration'])) {
        show_form($_POST['team_id1'], $_POST['team_id2'], $_POST['team1_points'], $_POST['team2_points'], $readonly = false, $_POST['duration']);
    } elseif (isset($_GET['edit']) || isset($_GET['delete'])) {
Ejemplo n.º 7
0
function handleFacebookMessage($message, $uid, $db, $user_object, $total)
{
    $table = "manager_fb_acc";
    $condition = " userid=" . $uid . " AND expired=0 AND (expires_at>" . time() . " OR expires_at=0) ";
    if ($fbcc = $db->doSingleSelect($table, $condition)) {
        $timezone = time() + $fbacc['timezone'];
        $lastTime = $user_object->getLastPublishedTime($uid, "fb");
        $limit = $user_object->getAllPublishedWithinTimeFrame($uid, "fb", 30, $timezone);
        if ($limit < 45 && sanityCheck($timezone, $lastTime, $total)) {
            try {
                $hfb = new Handler_Facebook();
                if ($post = $hfb->post("/me/feed", $message->getFacebookPostBody(), $fbacc['access_token'])) {
                    $table = "manager_stats";
                    $fields = array("userid" => $uid, "social_network" => "fb", "user_id" => $fbacc['user_id'], "message" => $message->getStatus(), "message_id" => $post->{$response}['id'], "type" => 1, "time" => $timezone);
                    $db->doInsert($table, $fields);
                    $message->setLastShare();
                } else {
                    error_log($hfb->lastError);
                }
            } catch (Exception $e) {
                error_log($e);
            }
        }
    }
}