Jump to content

Search the Community

Showing results for tags 'session'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hello, I'm wondering if this aproach is correct, had not been tested yet. What I'm trying to do is Log In an user from one browser and keep the user logged in a different browser. example: I have an app and send a login command to a processwire backend, the backend respons with the user id if the login was successful. http://example.com/login POST (encripted): username password response: 123 The code begin could be $username = $input->post('username'); $password = $input->post('password'); $user = $session->login($username, $password); if($user){ echo $user->id; } Then I read the User Id and open a new browser like this http://example.com/user/123 And the website checks if the user is logged in and opens a section only for logged in members. because PW saves the sessions in the server I think this could work. The code for this would be $userId = $input->urlSegment1; $user = $users->get($userId); if($user->isLoggedin()){ $session->redirect('/private/'); } else { $session->redirect('/'); } Thanks in advance
  2. Hi, I'm using the Database Session Handler the first time with a site and have noticed that the no more used sessions get not deleted automatically. They get deleted when I'm logged in and go to Setup -> Sessions. Is this normal behave or is there something wrong with the server the site is running on. How is the deletion triggert? Can I do something together with lazy-cron?
  3. Hi, I wanted to know if it is ok to change the session name in config.php from 'wire' to 'PHPSESSID'? i.e, from: $config->sessionName = 'wire'; to: $config->sessionName = 'PHPSESSID'; Are there any repercussions of doing this?
  4. Hi all, that's rather strange. It worked for some days but today it's broken and I don't know why. I'm implementing an user registration process where you have to pay some amount to earn a membership for a month. First you enter all your data (Street, Names, Username, Password...), this will be stored, and then you'll be directed to Paypal to pay the amount. Then a redirect happens to my page and a flag "payed" will be stored, too. To detect the right user, I created a $session->userdata = $input->post->getArray(); after the first post. This could be anything different, the point is: $session->userdata gets lost after the redirect from Paypal. It worked quite a while, but today it's broken. Is there a way to make $session permanent for, let's say, one day or so? Regards, Thomas
  5. Hello all, I hope everyone's having a nice weekend. For a project, I need to store some user information in session variables. Right now I'm storing that information to temp_*page_name* pages for every user. But I need to store this information only for 5 minutes, if user completes payment within that time, those stored variables are then moved to database in user's history. If user fails to complete payment before that, the session must be destroyed. I've no idea how to do this. I've read about $session in cheatsheet & PW's API documentation but no idea how exactly to do it. If someone can guide me a bit, that'd be great. All I need to know is how to use PHP's session timeout with PW's $session. Thanks in advance.
  6. Have set up a front-end registration form and it all seems fine but rather than giving them a link to "Click here to login!", I'd like to log them in automatically. I was thinking that as the login takes place after the new user has been saved that it ought to work but it doesn"t seem to be working at the moment. Is this even achievable without a page reload? Here is my code currently: <?php include("./header.inc"); $headings = " <div id='register'> <div class='row'> <div class='twelve columns'> <h3>Register with us</h3>"; $form="<form action='./' id='registration' method='post'> <div class='row'> <div class='four columns'> <label for='username'>Username</label> <p class='help'>Please ensure your username contains no spaces</p> <input type='text' name='username' value='{$input->post->username}'> <label for='first_name'>First name</label> <input type='text' name='first_name' value='{$input->post->first_name}'> <label for='last_name'>Last name</label> <input type='text' name='last_name' value='{$input->post->last_name}'> <label for='email'>Email address</label> <input type='text' name='email' value='{$input->post->email}'> </div> <!-- /.four columns --> <div class='four columns'> <label for='company_name'>Company name</label> <input type='text' name='company_name' value='{$input->post->company_name}'> <label for='company_url'>Company URL</label> <input type='text' name='company_url' value='{$input->post->company_url}'> <label for='company_phone'>Company phone</label> <input type='text' name='company_phone' value='{$input->post->company_phone}'> </div> <!-- /.four columns --> <div class='four columns'> <label for='pass'>Password</label> <p class='help'>Please ensure your password is at least 6 characters long and contains at least one digit and one letter</p> <input type='password' name='pass' value='{$input->post->pass}'> <label for='pass_confirm'>Confirm password</label> <input type='password' name='pass_confirm' value='{$input->post->pass_confirm}'> </div> <!-- /.four columns --> </div> <!-- /.row --> <input class='button success small' type='submit' name='submit_registration' id='submit'> </form>"; $message = "Please fill in the form below if you would like to register in order to receive exclusive access to our brochures and latest information."; $usernames = array(); foreach ($users as $u) { $usernames[] = $u->name; } if($input->post->submit_registration) { if (empty($input->post->username) || empty($input->post->email) || empty($input->post->pass)) { $message = "Please fill out all fields marked with a *"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif (in_array($input->post->username, $usernames)) { $message = "Sorry, that username is already taken, please choose another."; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif (filter_var($input->post->email, FILTER_VALIDATE_EMAIL) === FALSE) { $message = "Please include a valid email address"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif (!preg_match("/[0-9]/", $input->post->pass) || strlen($input->post->pass) < 6) { $message = "Please ensure your password has at least one digit and is at least 6 characters long"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } elseif($input->post->pass !== $input->post->pass_confirm) { $message = "Please ensure that your passwords match"; echo $headings; echo "<h5 class='error'>$message</h5>"; echo $form; } else { echo $headings; $message = "Congratulations! You have successfully registered and have been logged in"; echo "<h5 class='success'>$message</h5>"; $u = new User(); $u->of(false); $u->name = $sanitizer->username($input->post->username); $u->first_name = $sanitizer->text($input->post->first_name); $u->last_name = $sanitizer->text($input->post->last_name); $u->company_name = $sanitizer->text($input->post->company_name); $u->company_url = $sanitizer->url($input->post->company_url); $u->company_phone = $sanitizer->text($input->post->company_phone); $u->email = $sanitizer->email($input->post->email); $u->pass = $sanitizer->text($input->post->pass); $u->addRole('registered'); $u->save(); $u->of(true); require_once("./scripts/PHPMailer/class.phpmailer.php"); $form_contents = array( 'username' => $sanitizer->username($page->username), 'First name' => $sanitizer->text($input->post->first_name), 'Last name' => $sanitizer->text($input->post->last_name), 'Company name' => $sanitizer->text($input->post->company_name), 'Company URL' => $sanitizer->url($input->post->company_url), 'email' => $sanitizer->email($input->post->email), 'Phone Number' => $sanitizer->text($input->post->company_phone), ); $to_name = "My company"; $to = "me@me.com"; $subject = "New registered user"; $form_message = ""; foreach ($form_contents as $key => $value) { $form_message .= "$key: $value\n"; } $from = "$form_contents[email]"; $from_name = "$form_contents[username]"; $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->FromName = "$from_name"; $mail->From = "$from"; $mail->AddAddress ($to, $to_name); $mail->Subject = "$subject"; $mail->Body = "$form_message"; $mail->Send(); $name = $u->name; $pass = $u->pass; if ($session->login($name, $pass)) { $session->redirect("../"); } } } elseif ($user->isLoggedin()) { echo $headings; echo "<h5>No need to register " . $user->get('first_name|name') . ", you are already are! <a href='{$config->urls->root}'>Click here</a> if you would like to return to the homepage.</h5>"; } else { echo $headings; echo "<h5>$message</h5>"; echo $form; } ?> </div> <!-- /.twelve columns --> </div> <!-- /.row --> </div> <!-- /#register --> <?php ?> <?php include("./footer.inc"); Thanks.
  7. Hello, maybe it's too late or I had too little coffee or something else is sitting on my brain but I can't figure this out. I want to build a hook that determines if the User Agent is a phone and set a session variable accordingly: $this->addHookBefore('Page::render', $this, 'checkMobile'); function checkMobile(HookEvent $event) { $page = $event->object; $session = wire('session'); $domain = preg_replace("/^(m\.)/",'',$_SERVER['HTTP_HOST']); # this is to force one version or the other: if(wire('input')->get->v == 'desktop') { $session->isMobile = 'no'; } if(wire('input')->get->v == 'mobile') { $session->isMobile = 'yes'; } # /force # here comes mobile detection via Mobile_Detect if(!$session->isMobile) { require(wire('config')->paths->root.'/Mobile_Detect.php'); $detect = new Mobile_Detect(); $session->isMobile = $detect->isMobile()?'yes':'no'; } # /mobile detection # now for the redirects. This is cosmetics but I would like it to work: if ($session->isMobile == "yes" && !preg_match("/\bm./", wire('config')->httpHost)) { wire("session")->redirect("//m.".$domain.$page->url); } if ($session->isMobile == "no" && preg_match("/\bm./", wire('config')->httpHost)) { $session->redirect("//".$domain.$page->url); } } The idea is, that if someone visits bmxrider.de on a mobile, he gets redirected to m.bmxrider.de and $session->isMobile is set to yes so I can change the templates later on. I also like to be able to force each version by setting $input->get->v Whenever I use the query string to "force" a state, my site ends up in endless redirects. I checked the logs and it looks like $session->isMobile toggles between yes and no and I have no idea, why this happens. Can someone help me out? Thanks, thomas Update: The eternal redirect happens, when the domain doesn't match the query string. Like m.bmxrider/?v=desktop or bmxrider/?v=mobile
  8. Hello, I want to build a site where people can *only* login with Google and/or Facebook (no registration possible). When someone connects with G+|FB I'd like to check if the ID is present in my Userlist and if not, create a new user with all the data I can get. Now I'm asking myself (and you) how I can log the user into PW, since I won't have a password and the username they got on FB|G+ might even change. I need to find those accounts by the FB|G+ ID. I thought either to create a new user with username/pass = G+|FB-ID and a field stating if it's G+ or FB. The other way would be to have a way to select and login a user via a unique ID field, but i can't find something like a "loginByCondition" method in PW. So I guess my questions are: -is there a way to login users other than user/pass? - which way would you suggest to build a system like that? My problem with the "user and pass == G+|FB-ID"-approach is that it smells like dirty hack and I couldn't, for instance, connect my own admin account with FB or G+ to make it work in front- and backend. Any help and thoughts are appreciated! Thanks, thomas
  9. Hello all ! I'm using session to store some search parameters. It's ok on subpages but when I try to print session vars, there's something strange : __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => WireInputData [stripSlashes:protected] => 0 [data:protected] => Array ( [cmbtype] => voiture [cmblargeur] => 7 [cmbhauteur] => 0 [cmbdiametre] => 10 [cmbcharge] => 0 [cmbvitesse] => 5 [cmbmanufacturer] => [price] => ) ) and on the other pages, everything seems to be correct : WireInputData Object ( [stripSlashes:protected] => 0 [data:protected] => Array ( [cmbtype] => voiture [cmblargeur] => 7 [cmbhauteur] => 0 [cmbdiametre] => 10 [cmbcharge] => 0 [cmbvitesse] => 5 [cmbmanufacturer] => [price] => ) ) Do you have an idea ? For information, I do not stock a value, but an array. Thank you !
  10. It would be great if there would be an easy way to add flash-type of session variables. Here is citation from codeigniter docs:
  11. Hi, new forum look, cool haha! Look, I'm trying to use Securimage capcha in a template. The SESSION vars that the capcha image sets get lost somewhere in processwire. The API page says that this superglobal is always available. Do you have any hints where $_SESSION may be reset? Thanks
×
×
  • Create New...