0
votes

I have developed a Web Application in pyrocms and thats working perfectly. Now i want to create the mobile version of this site in core php as my client ask me to do. I have done almost but facing problem in creating login module in core php as i want to be able the users created by the main site using pyrocms.. So please let me know how i can create login functionality in core php that works same like pyrocms login.

2
why do you want to create a new module in core php instead pyrocms lets you to create separate layout for mobile version and you can use same module for mobile version as well. - uttam
ya..we can do like this but my client is very keen to develop mobile site in core php because he dont want to load the Pyrocms and codeigniter library in mobile site to reduce the weight of the site.Thats why i have to do this in this fashion...:( - Pramod Kumar Sharma

2 Answers

3
votes

The login module resides in cms/users module.

It is based on the ION auth library which you can take the relevant functions from. You need to make sure that you keep all the configuration options identical via cms/users/config.

Codeigniter is a very light and fast framework. Writing the code in core PHP won't ensure a faster website; it will just make maintaining and upgrading it a much harder and longer process.

1
votes

Necessity is the mother of all invention...:)

Finally i have done this.. There is few steps ..

1. Get the email and password from login form.
2. Select user detail from default_users detail using emailid.
3. Calcuate the encrypted password using  password  and salt in this `sha1($password . $salt)`
4. Check the encrypted password value with db password value..

Here is the working code.

$result = fetchuserdetail($email);
            while($row = mysql_fetch_object($result))
                    {
                         $dbpassword =  $row->password;
                         $salt =  $row->salt;
                         $userid =  $row->id;
                    }
            $encrypassword = sha1($password . $salt);
            if($encrypassword == $dbpassword)
            {
                $_SESSION['user_logged_in'] = TRUE;     
                $_SESSION['user_logged_id'] = $userid;                  
                header("Location:$refer");
            }
            else
            {
                $_SESSION['email'] = $email;
                $_SESSION['password'] = $password;
                $_SESSION['loginerro'] = "Please fill the login detail";
                header('Location:login.php');
            }

Hopefully this will help someone ....Thanks for your time on this question.