asterisk2billing.org
http://forum.asterisk2billing.org/

$_SESSION variables
http://forum.asterisk2billing.org/viewtopic.php?f=14&t=5676
Page 1 of 1

Author:  mazhar996 [ Thu Jun 04, 2009 7:32 pm ]
Post subject:  $_SESSION variables

Dear All,
can anyone tell me where are $_SESSION variables defined?
for example in singup_confirmation.php i see statements like
Code:
if (!isset($_SESSION["date_mail"]) || (time()-$_SESSION["date_mail"]) > 60)

i need to make a check that only a single signup is made with an email address. that is the email address once registered cannot be used with any other new registration.

i tried to achieve this by querying the database if the email already exists, so in order to query i need to know the email address the new user is providing in the signup form.

i have tried using $_SESSION["email"] and $_SESSION["email_signup"] as i saw in other cases but no success.
I can not find those variable defined anywhere in the source code.

Please help and advise.

with sincere regards

mazhar

Author:  stavros [ Fri Jun 05, 2009 2:38 pm ]
Post subject:  Re: $_SESSION variables

mazhar996 wrote:
can anyone tell me where are $_SESSION variables defined?
grep -R '$_SESSION\[.*\][-*\/+. ]*=' /path/to/a2b/source
Quote:
i need to make a check that only a single signup is made with an email address.
http://forum.asterisk2billing.org/viewtopic.php?f=12&t=4580

Author:  Swift [ Sat Jun 06, 2009 10:52 am ]
Post subject:  Re: $_SESSION variables

Hello,

I searched the forum for this but could not find any code other than (dB unique index) solution..

When stavroz said he could not find it too, i gave up the search an prepared my own code.. here is how i did it :

in the file Class.FormHandler.inc.php there is an (if) statement that looks like this (around line 1421):

Code:
if (!$this-> FG_fit_expression[$i]){
                     $this->VALID_SQL_REG_EXP = false;
                     $form_action="ask-add";
                  }



Add an (else) branch and make it look similar to this :

Code:
                  if (!$this-> FG_fit_expression[$i]){
                     $this->VALID_SQL_REG_EXP = false;
                     $form_action="ask-add";
                  } else { // dB based verification
                      switch ($fields_name) {
                          case  'email' :
                           $QUERY = "select count(email) from cc_card where email = '".$_POST["email"]."' " ;
                           $res = $this -> DBHandle -> Execute($QUERY) ;
                           $row = $res -> fetchRow() ;
                           if ($row[0] > 0) {
                              $this -> FG_fit_expression[$i]= false ;
                              // Mean and dirty by all means, but hey .. all is fair in love and war and A2B hacking !
                              $this -> FG_regular[1][1] = " (This email is already registered!  Have you  forgot your account password ?  You can retrive it below)"  ;
                              $this->VALID_SQL_REG_EXP = false;
                              $form_action="ask-add";
                           }
                         break ;
                        
                     // case something else
                     // case something else 2
                      } // switch
                  }// else


The (switch) is not necessary but it is useful if you want to do dB verification on some other fields later

Author:  sschluet [ Sat Jun 06, 2009 5:47 pm ]
Post subject:  Re: $_SESSION variables

Perfect! Thanks a lot!

I tried to find a solution for that a couple of times and also spent a few minutes to code my own solution but i gave up.

This one works perfectly.

Thanks for sharing!

Greetings from Berlin

:beer2:

Author:  r00f [ Thu Jan 22, 2015 10:42 am ]
Post subject:  Re: $_SESSION variables

5 years later and we still have to deal with this hack to disable multiple signup with same email?

Author:  Swift [ Fri Jan 23, 2015 11:20 pm ]
Post subject:  Re: $_SESSION variables

Flattered ! :D

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/