public static function isValid(&$properties_dictionary, $limit_to_keys, &$error)
 {
     //	Check each property is valid
     //
     if (!parent::isValid($properties_dictionary, $limit_to_keys, $error)) {
         return false;
     }
     //		First name, surname, name
     //
     if (ValidationC::should_test_property(CREATINGUSER_KEY_FIRST_NAME, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_FIRST_NAME, $properties_dictionary[CREATINGUSER_KEY_FIRST_NAME], $error)) {
         return false;
     }
     if (ValidationC::should_test_property(CREATINGUSER_KEY_SURNAME, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_SURNAME, $properties_dictionary[CREATINGUSER_KEY_SURNAME], $error)) {
         return false;
     }
     if (ValidationC::should_test_property(CREATINGUSER_KEY_NAME, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_NAME, $properties_dictionary[CREATINGUSER_KEY_NAME], $error)) {
         return false;
     }
     if (ValidationC::should_test_property(CREATINGUSER_KEY_GENDER, $properties_dictionary, true, $limit_to_keys) && !CreatingUser::propertyIsValid(CREATINGUSER_KEY_GENDER, $properties_dictionary[CREATINGUSER_KEY_GENDER], $error)) {
         return false;
     }
     $should_test_all_names = ValidationC::should_test_property(CREATINGUSER_KEY_FIRST_NAME, $properties_dictionary, true, $limit_to_keys) && ValidationC::should_test_property(CREATINGUSER_KEY_SURNAME, $properties_dictionary, true, $limit_to_keys) && ValidationC::should_test_property(CREATINGUSER_KEY_NAME, $properties_dictionary, true, $limit_to_keys);
     if ($should_test_all_names && (empty($properties_dictionary[CREATINGUSER_KEY_FIRST_NAME]) || isset($properties_dictionary[CREATINGUSER_KEY_SURNAME])) && isset($properties_dictionary[CREATINGUSER_KEY_NAME])) {
         //	Set either first name and surname, or, just a name
         //
         $error = Error::withDomain(VALIDATION_ERROR_DOMAIN, VALIDATION_ERROR_CODE_INVALID_PROPERTY, 'When setting a name, set either ' . CREATINGUSER_KEY_FIRST_NAME . ' and ' . CREATINGUSER_KEY_SURNAME . ', or, just a ' . CREATINGUSER_KEY_NAME . '.');
         return false;
     }
     return true;
 }
 /**
  * @return bool
  * Метод для регистрации пользователя
  */
 public function actionRegister()
 {
     $name = '';
     $email = '';
     $password = '';
     $res = '';
     $fail = false;
     //флаг ошибок
     if (isset($_POST['submit'])) {
         //если форма отправлена
         $name = $_POST['name'];
         $email = $_POST['email'];
         $password = $_POST['password'];
         if (!User::isValid($name, $email, $password)) {
             $fail = 'Поля заполнены некорректно';
         } elseif (User::isSameEmailExists($email)) {
             $fail = 'Такой email уже используется';
         }
         //Если нет ошибок->сохраняем пользователя в базе(регистрируем)
         if ($fail == false) {
             $res = User::register($name, $email, $password);
         }
     }
     $args = array('name' => $name, 'email' => $email, 'password' => $password, 'fail' => $fail, 'res' => $res);
     return self::render('register', $args);
 }
Example #3
0
 public function invokeHandler(Smarty $viewModel, $header, $f, $page, User $user)
 {
     $header->meta(array('keywords' => 'Home Meta Keywords', 'description' => 'Home Meta Description'));
     $header->title('RUDRAX');
     $header->import('bootstrap', 'utils', 'product_login', 'utils_tunnel');
     $cahce = new RxCache();
     $page->data->assign('myDataKey', $cahce->get('mykey'));
     $cahce->set('mykey', $cahce->get('mykey') + 1);
     if (isset($_REQUEST['uname'])) {
         $username = $_POST['uname'];
         $password = $_POST['pass'];
         $user->auth($username, $password);
     }
     //Console::log($this->user->getToken(),$username,$password);
     if ($user->isValid()) {
         $viewModel->assign('token', $user->getToken());
         $viewModel->assign('profile', $user->getProfile());
         $viewModel->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
         $viewModel->assign("FirstName", array("John", "Mary", "James", "Henry"));
         $viewModel->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
         $viewModel->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"), array("I", "J", "K", "L"), array("M", "N", "O", "P")));
         $viewModel->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"), array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
         $viewModel->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
         $viewModel->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
         $viewModel->assign("option_selected", "NE");
         return "home/home";
     } else {
         return "sample/login";
     }
 }
Example #4
0
 public function createUser()
 {
     $options = $this->option();
     $this->info('Creating the developer account');
     if (!$options['name']) {
         $options['name'] = $this->ask('What is your name?');
     }
     if (!$options['email']) {
         $options['email'] = $this->ask('What is your email?');
     }
     if (!$options['password']) {
         $p1 = ' ';
         $p2 = '';
         while ($p1 !== $p2) {
             $p1 = $this->secret('Type a password');
             $p2 = $this->secret('Repeat the password');
             if ($p1 !== $p2) {
                 $this->error('Passwords doesn\'t match, try again');
             }
         }
         $options['password'] = $p1;
     }
     $user = ['name' => $options['name'], 'email' => $options['email'], 'role' => 'dev'];
     try {
         $model = new \User();
         $model->fill($user);
         $model->password = \Hash::make($options['password']);
         $model->isValid();
         $model->save();
     } catch (\Exception $e) {
         $this->error('Error creating developer user: "******"');
     }
 }
Example #5
0
 public function invokeHandler(User $user, $pid)
 {
     if ($user->isValid()) {
         global $RDb;
         $image = $RDb->fetch("select * from files where id=%d", $pid);
         $upload_handler = new ImageUploader(array('user_token' => $user->getToken()), false);
         $upload_handler->delete_file($image->id, $image->name);
     }
     header('Location: ' . CONTEXT_PATH . 'home');
 }
 public function createAction()
 {
     $this->logger->entering();
     $paramTerms = $this->_getParam('terms');
     $paramUser = $this->_getParam('user');
     $this->logger->info('Validating user from params');
     $validity = User::isValid($paramUser);
     if ($paramTerms != 1 || !$validity) {
         $this->logger->notice('Invalid User');
         $this->flash->notice = "Please complete all fields and agree to the terms and conditions";
         if (!$validity) {
             foreach ($paramUser['errors'] as $k => $v) {
                 $this->flash->notice = $this->flash->notice . ", {$k} {$v}";
             }
         }
         $this->logger->info('Loading view parameters');
         $this->view->assign(array('title' => "New User", 'user' => $paramUser, 'states' => $this->states, 'terms' => $paramTerms));
         $this->logger->info('Render view');
         /*             echo $this->view->render('applicationTemplate.phtml'); */
         $this->render();
         $this->logger->info('Clearing flash notice');
         $this->flash->keep = 1;
         unset($this->flash->notice);
     } else {
         $this->logger->info('Building a new user from request');
         $users = new User();
         $user = $users->fetchNew();
         $paramUser = $users->filterColumns($paramUser);
         $user->setFromArray($paramUser);
         $this->logger->info('Inserting the user');
         if ($user->save()) {
             $this->logger->notice('Crediting signup bonus');
             $transactions = new Transaction();
             $transactions->signupUser($user);
             $this->logger->notice('Sending welcome message');
             $mail = new Zend_Mail();
             $mail->setBodyText('Welcome to swaplady.');
             $mail->setFrom('*****@*****.**', 'Some Sender');
             $mail->addTo($user->email, $user->name);
             $mail->setSubject('Welcome to Swaplady');
             $mail->send();
             $this->logger->notice('Marking as logged in');
             $this->session->user_id = $user->id;
             if (isset($this->flash->redirectedFrom)) {
                 $intendedAction = $this->flash->redirectedFrom;
                 $this->logger->info("Redirecting to intended action '{$intendedAction['controller']}::{$intendedAction['action']}'");
                 $this->_redirect('/' . $intendedAction['controller'] . '/' . $intendedAction['action']);
             } else {
                 $this->logger->info("Redirecting to show user {$user->id}");
                 $this->_redirect("user/show/{$user->id}");
             }
         }
     }
     $this->logger->exiting();
 }
Example #7
0
 public function store()
 {
     $data = Input::all()['user'];
     $user = new User();
     if ($user->isValid($data)) {
         $data['password'] = Hash::make($data['password']);
         $user->fill($data);
         $user->save();
         return Redirect::route('users.index');
     }
     return Redirect::route('users.create')->withInput()->withErrors($user->errors);
 }
Example #8
0
 public function invokeHandler(Smarty $viewModel, Header $header, User $user)
 {
     $header->title('PayPic');
     $header->import('jqgeeks/bootstrap_css', 'google_login');
     $viewModel->assign("pname", "@RTPic");
     //Browser::log($user->getData());
     if ($user->isValid()) {
         include_once HANDLER_PATH . "/Images.php";
         return Images::showlatest($viewModel);
     } else {
         return "login";
     }
 }
Example #9
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     if (!User::isValid(Input::all())) {
         return Redirect::back()->withInput()->withErrors(User::$errors);
     }
     $user = new User();
     $user->username = Input::get('username');
     $user->email = Input::get('email');
     $user->password = Hash::make(Input::get('password'));
     $user->save();
     Auth::login($user);
     return Redirect::route('tasks.index');
 }
 /**
  * Store a newly created user in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $user = new User();
     if (!$user->isValid($data)) {
         return Response::json(array('status' => false, 'dataError' => $user->getListErrors()), 500);
     }
     $user->name = $data['name'];
     $user->username = $data['username'];
     $user->password = Hash::make($data['password']);
     $user->save();
     return Response::json(array('status' => true));
 }
Example #11
0
 public function invokeHandler(Smarty $viewModel, Header $header, User $user, $page)
 {
     $header->title('PayPic');
     $viewModel->assign("pname", "@RTPic");
     if ($user->isValid()) {
         $header->import('jqgeeks/bootstrap_css', 'upload');
         global $RDb;
         $images = $RDb->fetchAll("select * from files where uid=%d AND albumid=0", $user->getToken());
         $viewModel->assign("images", $images);
         return "upload";
     } else {
         $header->import('jqgeeks/bootstrap_css', 'google_login');
         return "login";
     }
 }
 public function store()
 {
     if (!User::isValid(Input::all())) {
         return Redirect::back()->withInput()->withErrors(User::$messages);
     }
     $user = new User();
     $user->user_login = Input::get('username');
     $user->user_nicename = Input::get('name');
     $user->user_email = Input::get('email');
     $user->user_pass = Hash::make(Input::get('password'));
     $user->save();
     Mail::send('emails.welcome', array('username' => Input::get('username')), function ($message) {
         $message->to(Input::get('username'))->subject('Welcome to Online resource portal!');
     });
     return Redirect::to('login');
 }
 public function store()
 {
     /*$user =  new User;
       $user->email = Input::get('email');
       $user->*/
     if (!User::isValid(Input::all())) {
         return Redirect::to('/failed');
     }
     $accesscode = Str::random(60);
     User::create(['email' => Input::get('email'), 'password' => Hash::make(Input::get('password')), 'gender' => Input::get('gender'), 'accesscode' => $accesscode, 'verified' => '0']);
     $email_data = array('recipient' => Input::get('email'), 'subject' => 'Share-A-Meal: Verification Code');
     $view_data = ['accesscode' => $accesscode];
     Mail::send('emails.verify', $view_data, function ($message) use($email_data) {
         $message->to($email_data['recipient'])->subject($email_data['subject']);
     });
     Session::push('email', Input::get('email'));
     return Redirect::to('/verify');
 }
Example #14
0
 public function invokeHandler(User $user, $img, $page, $pid)
 {
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Cache-Control: no-store, no-cache,must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     header("Content-type: image/jpeg");
     $hasAccess = false;
     $file_path = null;
     $isPaid = true;
     if ($user->isValid()) {
         $file_path = $user->get('canAccess_' . $pid);
         $hasAccess = $file_path != null;
     } else {
         $file_path = self::$freePics->get($pid);
         if ($file_path == null) {
             $image = Picture::getPicById($pid);
             $isPaid = $image->price > 0;
             $file_path = $image->file_path;
             if ($isPaid) {
                 self::$freePics->set($pid, false);
             } else {
                 self::$freePics->set($pid, $file_path);
             }
         } else {
             if ($file_path == false) {
                 $isPaid = true;
             } else {
                 $isPaid = false;
             }
         }
     }
     if ($hasAccess || !$isPaid) {
         // If they're authorized, read userphotos/$PATH
         // The .htaccess file is in userphotos (since that's the top level we care to protect)
         // so the path is relative to that folder. auth.php is up one level to keep photos
         // and code as separate as possible
         //@readfile("../static/def.gif");
         @readfile("../static/pri/" . $file_path);
         // Read and send image file
     } else {
         @readfile("../static/def.gif");
     }
 }
 public function store()
 {
     $username = Input::get('username');
     $userdata = array('user_login' => Input::get('username'), 'user_pass' => Input::get('password'));
     $userId = User::where('user_login', $username)->pluck('ID');
     if (!User::isValid(Input::all())) {
         return Redirect::back()->withInput()->withErrors(User::$messages);
     } else {
         if (Auth::attempt($userdata)) {
             //$ip = $_SERVER["REMOTE_ADDR"];
             //$track = new Session;
             //$track -> Ip_address = '4245755252';
             //$track -> save();
             Session::put('userId', $userId);
             Session::put('username', $username);
             return Redirect::to('/');
             //->with('ip',$ip);
         }
     }
     Flash::error('The username or password does not exist. Please Try again.');
     return Redirect::back();
 }
Example #16
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //Creamos un nuevo objeto para nuestro nuevo usuario
     $user = new User();
     //return Input::all();
     //Obtenemos la data enviada por el usuario
     $data = Input::all();
     //
     //var_dump($data);
     //Revisamos si la data es valida
     if ($user->isValid($data)) {
         //Si la data es valida se la asignamos al usuario
         $user->fill($data);
         //Guardamos el usuario
         $user->save();
         //Y devolvemos una redirección a la acción show para mostrar el usuario
         return Redirect::route('admin.users.show', array($user->id));
     } else {
         // En caso de error regresa a la acción create con los datos y los errores encontrados
         return Redirect::route('admin.users.create')->withInput()->withErrors($user->errors);
     }
 }
Example #17
0
 function actionDelete($httpData)
 {
     if (!isset($httpData['id'])) {
         $this->view->outputBasicPage("Error", "Please specify a user ID.");
     } elseif (!isset($_SESSION[$this->userSession])) {
         $this->view->redirectMsg("Please login", "user.php?action=login&redirect=/index.php");
     } else {
         if ($_SESSION[$this->adminSession] != 1) {
             $this->view->outputBasicPage("Error", "Only the administrator can delete accounts.");
         } else {
             $u = new User($httpData["id"], $this->conn);
             if ($u->isValid()) {
                 $status = $u->remove();
                 $msg = $status ? "Deleted successfully" : "No user with that ID!";
                 $heading = $status ? "Deleted" : "Error";
                 $this->view->outputBasicPage($heading, $msg);
             } else {
                 $this->view->outputBasicPage("Error", "Invalid user ID.");
             }
         }
     }
 }
Example #18
0
 public function invokeHandler(User $user, $img, $page, $q)
 {
     $reqpath = strip_tags($q);
     // User albums are structured like so
     // ourURL.com/me/userphotos/<username>/<album>/...
     // $reqpath will now have the <username>/<album>/... part
     // <username> matches the username stored in the session variable
     // so we get a substring from the start of $reqpath to the first /
     //echo "no-".$q;  return;
     $foundslash = strpos($reqpath, '/');
     // Get the position of the first slash
     if ($foundslash === FALSE) {
         // $foundslash could return 0 or other "false" variables, use ===
         header("Location http://elementsbycaroline.com/index.php");
     }
     // Save their username off...
     $username = substr($reqpath, 0, $foundslash);
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Cache-Control: no-store, no-cache,must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     header("Content-type: image/jpeg");
     $hasAccess = false;
     if ($user->isValid()) {
         $hasAccess = true;
     }
     if ($hasAccess) {
         // If they're authorized, read userphotos/$PATH
         // The .htaccess file is in userphotos (since that's the top level we care to protect)
         // so the path is relative to that folder. auth.php is up one level to keep photos
         // and code as separate as possible
         //@readfile("../static/def.gif");
         @readfile("../" . $reqpath);
         // Read and send image file
     } else {
         @readfile("../static/def.gif");
     }
 }
Example #19
0
         $_SESSION['is_restricted'] = false;
         if (isset($_SESSION['url'])) {
             $url = $_SESSION['url'];
         } else {
             $url = "";
         }
         redirect($url);
     } else {
         //l('auth', 'badlogin', NULL, NULL, NULL, array('ip'=>$_SERVER['REMOTE_ADDR'], 'login' => $login, 'password' => $password));
         redirect("/login.php?wrongloginpassword=true");
         die;
     }
 } else {
     if (isset($_POST["byip"]) && $_POST["byip"] == 'true') {
         $ipUser = new User($ipRequest);
         if ($ipUser->isValid()) {
             $_SESSION['id'] = $ipUser->getId();
         }
         if (configgetvalue('system', 'ucp', NULL, 'restrictUsersLoggedByIP')) {
             $user->isRestricted = true;
             $_SESSION['is_restricted'] = true;
         }
         if (isset($_SESSION['url'])) {
             $url = $_SESSION['url'];
         } else {
             $url = "";
         }
         redirect($url);
     }
 }
 break;
Example #20
0
 /**
  * Test uniqueness
  *
  * @return null
  */
 public function testUniqueness()
 {
     $old_user = User::find(1);
     $new_user = new User();
     $new_user->name = $old_user->name;
     $new_user->email = $old_user->email;
     $this->assertFalse($new_user->isValid());
     $this->assertEquals(TORM\Validation::VALIDATION_UNIQUENESS, $new_user->errors["email"][0]);
 }
Example #21
0
use Pop\Form\Element;
use Pop\Db\Record;
class Users extends Record
{
}
class User extends Form
{
}
try {
    // Define DB credentials
    $db = Db::factory('Mysqli', array('database' => 'helloworld', 'host' => 'localhost', 'username' => 'hello', 'password' => '12world34'));
    Users::setDb($db);
    $attribs = array('text' => array('size' => 40), 'textarea' => array('rows' => 5, 'cols' => 40));
    $values = array('id' => array('type' => 'hidden'));
    $fields = Fields::factory(Users::getTableInfo(), $attribs, $values, 'access');
    $fields->addFields(array('submit' => array('type' => 'submit', 'label' => '&nbsp;', 'value' => 'SUBMIT')));
    $form = new User($_SERVER['REQUEST_URI'], 'post', $fields->getFields());
    if ($_POST) {
        $form->setFieldValues($_POST);
        if ($form->isValid()) {
            echo 'Form is valid!';
        } else {
            $form->render();
        }
    } else {
        $form->render();
    }
    echo PHP_EOL . PHP_EOL;
} catch (\Exception $e) {
    echo $e->getMessage() . PHP_EOL . PHP_EOL;
}
Example #22
0
//Imports
require_once 'session.php';
require_once 'db/db_conn.php';
require_once 'db/SELECT.php';
require_once 'db/UPDATE.php';
require_once 'classes/Hiker.php';
require_once 'classes/User.php';
$con = connect_db();
$old_ADK_USER = new User();
$old_ADK_USER->id = intval($_POST['id']);
$old_ADK_USER->get($con);
$ADK_USER = new User();
$ADK_USER->populate();
$ADK_HIKER = new Hiker();
$ADK_HIKER->populateFromUpdateHiker();
if (!$ADK_USER->isValid()) {
    $con->close();
    header('Location: ../editHiker?_=' . $ADK_USER->id . '&e=' . $ADK_USER->err);
    exit;
}
if (!$ADK_HIKER->isValid()) {
    $con->close();
    header('Location: ../editHiker?_=' . $ADK_USER->id . '&e=' . $ADK_HIKER->err);
    exit;
}
if (!User::isUniqueUsername($con, $ADK_USER->username, $old_ADK_USER->username)) {
    $con->close();
    header('Location: ../editHiker?_=' . $ADK_USER->id . '&e=q');
    exit;
}
$ADK_USER->update($con);
        $resolution = $data["resolution"];
        //		$uuid = $data["uuid"];
        $firstname = $data["firstName"];
        $lastname = $data["lastName"];
        $academic_title = $data["academicTitle"];
        $facsimile = $data["fax"];
        $street = $data["street"];
        $housenumber = $data["houseNumber"];
        $delivery_point = $data["deliveryPoint"];
        $postal_code = $data["postalCode"];
        $city = $data["city"];
        $country = $data["country"];
    }
}
$owner = new User(intval($owner_id));
if ($owner->isValid()) {
    $owner_name = $owner->name;
}
# blank row
echo "<tr>";
echo "<td colspan='2'>&nbsp;</td>";
echo "</tr>";
#username
echo "<tr>";
echo "<td>" . _mb("Username") . ":</td>";
echo "<td>";
echo "<input type='text' size='30' name='name' value='" . htmlentities($name, ENT_QUOTES, "UTF-8") . "'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . _mb("Firstname") . ":</td>";
Example #24
0
 public function invokeHandler(User $user, $img, $page, $q, $action)
 {
     if ($user->isValid()) {
         $upload_handler = new ImageUploader(array('user_token' => $user->getToken()));
     }
 }
Example #25
0
    if (!isset($_SESSION['id'])) {
        $user = new User();
    } else {
        if ($_SESSION['id'] === 0) {
            $user = new User();
        } else {
            if ($_SESSION['id']) {
                $user = new User("WHERE id=" . $_SESSION['id']);
                if (isset($_SESSION['is_restricted']) && $_SESSION['is_restricted'] === true) {
                    $user->isRestricted = true;
                }
            }
        }
    }
}
if ($user->isValid()) {
    $_SESSION['id'] = $user->getId();
}
session_write_close();
/* languages */
$checkFn = function ($el) {
    $target = 'locale';
    $domain = 'ucp';
    if (file_exists("../{$target}/{$el}/LC_MESSAGES/{$domain}.mo") || file_exists("../{$target}/{$el}/LC_MESSAGES/{$domain}.po")) {
        return true;
    }
};
$target = 'locale';
$languages = getDirs("../{$target}", $checkFn);
$params = $_GET;
for ($i = 0; $i < count($languages); $i++) {
Example #26
0
/**
 * Lähettää tilausvahvistuksen ylläpidolle
 * @param User $asiakas <p> Tilauksen tehnyt asiakas
 * @param stdClass[] $products
 * @param int $tilausnro
 * @return bool
 */
function laheta_tilaus_yllapitajalle(User $asiakas, $products, $tilausnro)
{
    if (!empty($products) && !empty($tilausnro) && $asiakas->isValid()) {
        $admin_email = '*****@*****.**';
        $subject = "Tilaus {$tilausnro}";
        $summa = 0.0;
        $productTable = '
			<table><tr><th>Tuotenumero</th><th>Tuote</th><th style="text-align:right;">Hinta/kpl</th>
				<th style="text-align:right;">Kpl</th></tr>';
        foreach ($products as $product) {
            $article = $product->directArticle;
            $summa += $product->hinta * $product->cartCount;
            $productTable .= "\n\t\t\t\t<tr><td>{$article->articleNo}</td><td>{$article->brandName} {$article->articleName}</td>\n\t\t\t\t\t<td style='text-align:right;'>" . format_euros($product->hinta) . "</td>\n\t\t\t\t\t<td style='text-align:right;'>{$product->cartCount}</td></tr>";
        }
        $productTable .= "</table><br><br><br>";
        $message = "Tilaaja: {$asiakas->kokoNimi()}<br>\n\t\t\t\tYritys: {$asiakas->yrityksen_nimi}<br>\n\t\t\t\tS-posti: {$asiakas->sahkoposti}<br>\n\t\t\t\tPuh: {$asiakas->puhelin}<br><br>\n\t\t\t\tTilausnumero: {$tilausnro}<br>\n\t\t\t\tSumma: " . format_euros($summa) . "<br>\n\t\t\t\tTilatut tuotteet:<br>{$productTable}";
        require 'noutolista_pdf_luonti.php';
        send_email($admin_email, $subject, $message);
        return true;
    } else {
        return false;
    }
}
Example #27
0
                        <span><input type="password" name="password" id="passwordReg" value="{$password}" class="{$passwordClass}" /></span>
                </div>

\t\t\t\t<div class="form-row">
                        <label for="confirmPasswordReg">Confirm Password</label>
                        <span><input type="password" name="confirmPassword" id="confirmPasswordReg" value="{$confirmPassword}" class="{$confirmPasswordClass}" /></span>
                </div>

\t\t\t\t<div class="form-row">
                        <label for="emailReg">E-mail</label>
                        <span><input type="text" name="email" id="emailReg" value="{$email}" class="{$emailClass}" /></span>
                </div>
\t\t\t
\t\t\t\t<div class="form-row">
                        <span>{$recaptcha}</span>
                </div>
\t\t\t\t
                <div class="form-row form-row-last">
                        <span><input type="submit" name="login" value="Register!" /></span>
                </div>
        </form>
\t
</div>


EOT
);
}
if (!User::isValid()) {
    Content::addAdditionalJS('loginbox.js');
}
Example #28
0
<?php

include 'User.php';
session_start();
$response = array();
if (!isset($_SESSION['username']) && $_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['action'])) {
    $user = new User();
    $user->username = $_POST['username'];
    $user->password = $_POST['password'];
    //handle login
    if ($_POST['action'] == 'login') {
        if ($user->isValid()) {
            $_SESSION['username'] = $user->username;
            $_SESSION['password'] = $user->password;
        } else {
            $_SESSION['error'] = 'Wrong Username or Password';
        }
    } else {
        if ($_POST['action'] == 'register') {
            //using regular express to valid user name and password
            if (ereg("^([a-zA-Z0-9_-]){8,15}\$", $user->username) && ereg("^([a-zA-Z0-9_-]){8,15}\$", $user->password)) {
                if ($user->register()) {
                    $_SESSION['username'] = $user->username;
                    $_SESSION['password'] = $user->password;
                } else {
                    $_SESSION['error'] = "Username:"******" already exists";
                }
            } else {
                $_SESSION['error'] = 'Username and Password must contain 8 to 15 characters';
            }
        }
Example #29
0
<?php

$nav['index'] = array('url' => '/index', 'slug' => 'index', 'name' => 'Home', 'loggedInOnly' => false, 'weight' => -100, 'visible' => false);
if ($slug == "index") {
    $uname = 'stranger!!';
    $message = '';
    if (isset($_SESSION['message'])) {
        $message = '<p>' . $_SESSION['message'] . '</p>';
        unset($_SESSION['message']);
    }
    if (User::isValid()) {
        $uname = User::$uname;
    }
    Content::setContent(<<<EOT
\t{$message}
\tYou have reached the home of Fill The Bukkit, the global mod repository for <a href="http://bukkit.org">Bukkit</a>, the fabulous mod for <a href="http://minecraft.net">Minecraft</a>, the highly addictive online and single player 8-bit mining game
\t


EOT
);
}
Example #30
0
 * Aloitetaan sessio
 */
session_start();
/*
 * Ladataan sivuston käyttöön tarkoitetut luokat
 */
require "luokat/db_yhteys_luokka.class.php";
require "luokat/user.class.php";
require "luokat/yritys.class.php";
require "luokat/ostoskori.class.php";
require "luokat/tuote.class.php";
/*
 * Haetaan tietokannan tiedot erillisestä tiedostosta, ja yhdistetään tietokantaan.
 */
$db = parse_ini_file("../src/tietokanta/db-config.ini.php");
$db = new DByhteys($db['user'], $db['pass'], $db['name'], $db['host']);
/*
 * Luodaan tarvittava oliot
 */
$user = new User($db, $_SESSION['id']);
$cart = new Ostoskori($db, $user->yritys_id);
/*
 * Tarkistetaan, että käyttäjä on olemassa, ja oikea.
 */
if (!$user->isValid()) {
    header('Location: index.php?redir=4');
    exit;
} elseif (!$user->eula_hyvaksytty()) {
    header('Location: eula.php');
    exit;
}