Part of the EllisLab Network
   
2 of 14
2
The Authentication Library 1.0.6
Posted: 28 July 2009 02:27 PM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  374
Joined  05-04-2008
Pxlfusion - 28 July 2009 06:14 PM

Hi

So far using the Authentication Library has been a breeze - very simple setup and simple to use, overall very happy!

This is the first problem I’ve encountered - I’m looking to implement this system in a subdomain [http://subdomain.domain.com/]

CI seems to be working fine - I get the welcome page, however with any controller extending application I get the error:

The configuration file auth.php does not exist.

I have placed a .htaccess file which contains:

RewriteEngine on
RewriteCond 
$!^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ ./index.php/$1 [L,QSA] 

To be quite honest, I have no idea about .htaccess files.

Another aspect that is different from the base CI install is within config.php - which contains this code instead of the usual:

$config['base_url'=  ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'== "on") ?  "https" "http");
$config['base_url'.=  "://".$_SERVER['HTTP_HOST'];
$config['base_url'.=  str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']); 

I’m not entirely sure where the problem might be, but I can take a guess that it’s located within the MY_Controller.php script.

Any help would be greatly appreciated - I’m still rather new at CI, and it would be super-awesome, if I could implement this system within a subdomain.

Best,

Andy

Hi,


Simply rename Auth.php (config file) to auth.php (all lowercase) as this is aproblem with the linux kernel.


Thanks,
Adam

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

Profile
 
 
Posted: 28 July 2009 02:47 PM   [ Ignore ]   [ # 12 ]  
Summer Student
Total Posts:  2
Joined  07-28-2009

Ah! Simple solution - Thanks very much Adam.

Profile
 
 
Posted: 29 July 2009 03:09 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
RankRank
Total Posts:  128
Joined  01-18-2008

Hi Andy,

I’m by no means any expert on CI or the Authentication Library but I’ll try to give you another perspective.

I’m not sure your problem lies within the MY_Controller.php script. I had an error and on Linux, I had to rename the file from Auth.php to auth.php and it worked.

I’d think your controllers are fine and htaccess since as you said, you can see your Welcome Controller.

As for those confi[‘base_url’] entries, I’m quite perplexed, never seen them that complicated in CI before.

HTH

Profile
 
 
Posted: 03 August 2009 03:32 AM   [ Ignore ]   [ # 14 ]  
Summer Student
Total Posts:  1
Joined  08-02-2009

Hi,

Just a minor error in Auth.php I found as I changed the table names:-

if($login === TRUE)
            
{
                $data2[
'msg'"The user has been created, you have now been logged in.";
                
                
$userdata $this->CI->db->query("SELECT * FROM `users` WHERE `username` = '$username'"); 

should be:-

if($login === TRUE)
            
{
                $data2[
'msg'"The user has been created, you have now been logged in.";
                
                
$userdata $this->CI->db->query("SELECT * FROM `$this->user_table` WHERE `username` = '$username'"); 

RottenSod.

Profile
 
 
Posted: 03 August 2009 06:59 AM   [ Ignore ]   [ # 15 ]  
Research Assistant
RankRankRank
Total Posts:  308
Joined  01-04-2008

DELETE

Profile
 
 
Posted: 03 August 2009 07:46 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  374
Joined  05-04-2008
RottenSod - 03 August 2009 07:32 AM

Hi,

Just a minor error in Auth.php I found as I changed the table names:-

if($login === TRUE)
            
{
                $data2[
'msg'"The user has been created, you have now been logged in.";
                
                
$userdata $this->CI->db->query("SELECT * FROM `users` WHERE `username` = '$username'"); 

should be:-

if($login === TRUE)
            
{
                $data2[
'msg'"The user has been created, you have now been logged in.";
                
                
$userdata $this->CI->db->query("SELECT * FROM `$this->user_table` WHERE `username` = '$username'"); 

RottenSod.

Thanks, I’ve fixed this and it’s now in the Github repo.

Daniel H - 03 August 2009 10:59 AM

Am I being incredibly special, or can I not download from github? In Safari the ZIP/TAR dialog just stays open and does nothing, while in Firefox the dialog closes but nothing is actually downloaded. I don’t think I’ve had problems downloading from github before…

A few people have been having problems with downloading the ZIPs from Github and unfortunately I can’t help with this as it is a problem with Github. The only thing I can suggest is to go to Github support and ask them what the problem might be.

 


Thanks,
Adam

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

Profile
 
 
Posted: 03 August 2009 12:13 PM   [ Ignore ]   [ # 17 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5366
Joined  06-19-2009

Hi Adam,

I can not download from GitHub either, I emailed them and the problem is that it does not like IE Browsers they told me to switch to another browser!

Enjoy
InsiteFX

 Signature 

Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

Profile
 
 
Posted: 04 August 2009 11:55 AM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  33
Joined  08-07-2008

Thanks for your hard work in creating this auth system.

I had two small problems getting everything set up.

1. When a user tries to logout there is a call to sess_destroy() but I had to change this to destroy(). The problem is not a fault with The Authentication Library but that I made some changes to the way sessions are handled in order to get SWFUpload working with the codeigniter upload class as per this thread
http://codeigniter.com/forums/viewthread/97399/

2. When registering a user I got the following errors:

A PHP Error was encountered

Severity
Warning

Message
fopen() [function.fopen]php_network_getaddressesgetaddrinfo failedName or service not known

Filename
libraries/Auth.php

Line Number
348
A PHP Error was encountered

Severity
Warning

Message
fopen(http://random.org/strings/?num=1&len=20&digits=on&upperalpha=on&loweralpha=on&unique=on&format=plain&rnd=new) [function.fopen]: failed to open stream: No such file or directory

Filenamelibraries/Auth.php

Line Number
348
A PHP Error was encountered

Severity
Warning

Message
fread(): supplied argument is not a valid stream resource

Filename
libraries/Auth.php

Line Number
349 

This could be caused by some kind of infrastructure or server problem. I am testing this app from work and they have very strict I.T. policies, firewalls etc. It could also be some kind of server setting.

Here is the code from libraries/Auth.php around line 348:

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_source20);
        

My hunch is that the server restrictions and php.ini settings are not aligned. As the code checks the ini to see if it can use fopen(), as it is told there are no problems it gives it a try.

Either way the registration seems to work as expected so I have just suppressed the warnings like so…

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_source20);
        

Which works OK as $token contains a value like UnUmfDzdu7CQshCYqcD. I wonder however if it would be easier to generate the unique string a more like this:

$token sha1(mt_rand(10000,99999).time().$username); 

And then the whole if / ifelse / else section in the _genrate() function can be replaced?

Thanks again for your hard work on this great library.

Profile
 
 
Posted: 10 August 2009 11:21 PM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  31
Joined  07-18-2009

I’ve uploaded your auth library and followed your installation instructions, as per your user guide, but it doesn’t seem to be working.  The users table is not recording a username or email address when I register.  All other fields are filled in.

I get a success message after registering and go to the dashboard but it says ‘Welcome .’, which after looking at the code for the dashboard page, should be echoing out the username.

It does seem to be holding the session details as I am not able to get back to the dashboard after logging out, without logging back in again, which is a fruitless effort as the database does not have any usernames.  If I add a username to a record in the database, I get an error when trying to login saying that the username and password combination did not match.

I must be missing a step somewhere but I’m not sure where as I have a clean install of CI and followed the installation instructions in the user guide.

Profile
 
 
Posted: 11 August 2009 08:41 AM   [ Ignore ]   [ # 20 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  374
Joined  05-04-2008

I do not know why the username or email address is not being added to the database. I will take a look into it but I need to know what version of PP you are running as everything works fine for me in PHP5.

Thanks,
Adam

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

Profile
 
 
   
2 of 14
2