Esempio n. 1
1
function dev_check_dupes($field, $value = '', $table, $message = '', $redirect = '')
{
    $href = dev_href($redirect);
    if ($message == '') {
        $message = "Sorry, but an entry already exists for field `{$field}` having value '{$value}'. Please try again with a new value";
    }
    $rows = new DevModel($table);
    $rows->clear();
    if ($value != '') {
        $rows->setCondition($field, '=', $value);
        if (count($rows->getRecordSet()) > 0) {
            if ($redirect != '') {
                dev_redirect($href, array('fld' => $field, 'msg' => $message));
            } else {
                return false;
            }
        }
    }
    return true;
}
Esempio n. 2
0
 public function handle($ip = '', $redirect = '', $exit = false)
 {
     $blocked = false;
     $status = '';
     $ip = $ip == '' ? $this->remote() : $ip;
     $ip_list = dev_view_file($ip_file);
     $ip_r = explode("\n", $ip_list);
     $blocked = in_array($ip, $ip_r);
     if ($blocked) {
         $status = "Your IP address has been restricted from viewing this content.\nPlease contact the administrator.\n";
         if ($exit) {
             exit($status);
         }
         if ($redirect != '') {
             dev_redirect($redirect);
         }
     }
     return $status;
 }
Esempio n. 3
0
function dev_parachute(&$count, $max = '', $redirect = '', $log = false, $alert = false)
{
    $max = dev_not_null($rcpt) ? $max : 400;
    if ($count >= $max) {
        $status = "Loop exceeded max count! Killing Process.\n";
        if ($alert) {
            dev_email_admin_alert($status);
        }
        if ($log) {
            dev_create_log($status);
        }
        if (dev_not_null($redirect)) {
            dev_redirect($redirect, array('msg' => $status));
        } else {
            exit("A script on this page began to loop out of control. Process has been killed. If you are viewing this message, please alert the administrator.\n");
        }
    }
    $count++;
}