The Authentication Library 1.0.6 |
[eluser]jv1[/eluser]
[quote author="samhQC" date="1254916543"]Thanks for your interest Adam. I am going to do some more research, I expect the problem is with what I am doing, rather than the library itself. If I can figure it out I will post what the solution was in case it helps others. If I can't I will come back with more details looking for help ![]() I am using Auth 1.0.6 and the latest version of codeigniter Loading Time Base Classes 0.0161 Controller Execution Time ( sited / Index ) 5.0919 Total Execution Time 5.1081 The auth sessions query and user set identifier SQL queries are very fast, not half a second in total. All my pages are very slow if I am logged in, but fast if I am logged out. I suspect it's maybe something to do with apache and sessions. Cheers Sam[/quote] Hi, I think your problem may be related to Auth connecting to random.org in Auth.php line 340, method _generate(). Try commenting the first two options and leave the internal generator and see what happends.
[eluser]samhQC[/eluser]
jv1, You are correct! I commented out _generate() as you suggested and my page load times drop from ~2.2 seconds to .5 on localhost. Thanks a lot, I'm not sure if there is a better long term fix, but this sure makes development faster. Here is what the function now looks like : function _generate() { $username = $this->CI->session->userdata('username'); $rand_url = 'http://random.org/strings/?num=1&len=20&digits=on&upperalpha=on&loweralpha=on&unique=on&format=plain&rnd=new'; /* if (ini_get('allow_url_fopen')) { // Grab the random string using the easy version if we can $token_source = fopen($rand_url, "r"); $token = fread($token_source, 20); } elseif (function_exists('curl_version')) { // No easy version, so try cURL $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $rand_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $token = curl_exec($ch); curl_close($ch); } else { */ // No love either way, generate a random string ourselves $length = 20; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $token = ''; for ($i = 0; $i < $length; $i++) { $token .= $characters[mt_rand(0, strlen($characters)-1)]; } //} $identifier = $username . $token; $identifier = $this->_salt($identifier); $this->CI->db->query("UPDATE `$this->user_table` SET `identifier` = '$identifier', `token` = '$token' WHERE `username` = '$username'"); setcookie("logged_in", $identifier, time()+3600, '/'); } Cheers Sam
[eluser]jv1[/eluser]
[quote author="samhQC" date="1255027312"]jv1, You are correct! I commented out _generate() as you suggested and my page load times drop from ~2.2 seconds to .5 on localhost. Thanks a lot, I'm not sure if there is a better long term fix, but this sure makes development faster. ... Cheers Sam[/quote] Well, the two seconds delay probably mean your site couldn't resolv/connect to random.org and was only using the internal generator anyway ![]() In php.net's manual say this on the uniqid() function page: Code: Examples But I'm not sure why it says it will only work with php5, as both functions are listed as php4/php5 compatible. I'm considering using Auth but I don't understand the rationaly behind connecting to an external site (random.org) to generate this token. Besides, the hosting provider I'm working with doesn't support url_fopen or curl. Most modern OSs should provide a reasonably good random generator. I'm working on OpenBSD and I'm sure it does, as most Linux distribs out there. I'm not so sure about it on the Windows systems. Adam, are there other pieces of Auth that require external support? I don't feel like reading it all ![]()
[eluser]Raykoid666[/eluser]
If you open up the file libraries/Auth.php – you can see the two functions in there, login() and register(). That's how it all works. You could add some code into that file to shoot off a call to jQuery so when a user is registered/logged in you can do what you like with it. Yes it's not pretty but it's the only way I can think of. Thanks, Adam[/quote] Yes I know , though the problem is I don't know exactly where to add the code. That actually was the problem in the first place. I'd have to include a true, and if it fails, somehow capture the error messages. I guess all in all, the problem is i don't quite yet fully understand your coding, as in, the way you put the functions together. Thanks, Kenny
[eluser]Adam Griffiths[/eluser]
[quote author="Raykoid666" date="1255037122"]If you open up the file libraries/Auth.php – you can see the two functions in there, login() and register(). That's how it all works. You could add some code into that file to shoot off a call to jQuery so when a user is registered/logged in you can do what you like with it. Yes it's not pretty but it's the only way I can think of. Thanks, Adam[/quote] Yes I know , though the problem is I don't know exactly where to add the code. That actually was the problem in the first place. I'd have to include a true, and if it fails, somehow capture the error messages. I guess all in all, the problem is i don't quite yet fully understand your coding, as in, the way you put the functions together. Thanks, Kenny[/quote] Those functions follow the pattern laid out in the user guide for the Form Validation Library, here. Have a read of that, it should clear everything up. Thanks, Adam
[eluser]Unknown[/eluser]
Github seems to be freezing on loading www.google-analytics.com lol.. from here anyway
[eluser]marlboro[/eluser]
Github is freezing on the same URL for me too... Is there a mirror somewhere?
[eluser]InsiteFX[/eluser]
GitHub doe's not work with IE Browsers! Enjoy InsiteFX
[eluser]wildarp[/eluser]
[quote author="squarebones" date="1247180986"]Can't say how well I like this library as I haven't been able to get it working. I followed the installation instructions and all is well until I actually try to access the register function (step 3). There is is no register function in the admin controller. Huh? Nor does login work by entering admin/login. All I get is a 404 page for both. I have renamed my various CI folders, but noted that in the config array so CI knows where to find everything. And my initial controller works to load up a simple construction page, so I know the CI install is good (not my first time using CI, by the way. About my fifth, actually). I'm kind of stuck now. Is there perhaps something else I need to change to get this working? I know this isn't much information to go on, so ask if you need more to make an educated guess. Thank you.[/quote] Have same problem 404 Page. All setup from clean CI. Anybody made it works? Need help with it. |
Welcome Guest, Not a member yet? Register Sign In |