Welcome Guest, Not a member yet? Register   Sign In
The Authentication Library 1.0.6
#11

[eluser]Pxlfusion[/eluser]
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:

Code:
RewriteEngine on
RewriteCond $1 !^(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:

Code:
$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
#12

[eluser]Adam Griffiths[/eluser]
[quote author="Pxlfusion" date="1248822877"]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:

Code:
RewriteEngine on
RewriteCond $1 !^(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:

Code:
$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[/quote]

Hi,


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


Thanks,
Adam
#13

[eluser]Pxlfusion[/eluser]
Ah! Simple solution - Thanks very much Adam.
#14

[eluser]2think[/eluser]
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
#15

[eluser]Unknown[/eluser]
Hi,

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

Code:
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:-

Code:
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.
#16

[eluser]Daniel H[/eluser]
DELETE
#17

[eluser]Adam Griffiths[/eluser]
[quote author="RottenSod" date="1249302768"]Hi,

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

Code:
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:-

Code:
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.[/quote]

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

[quote author="Daniel H" date="1249315199"]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...[/quote]

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
#18

[eluser]InsiteFX[/eluser]
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
#19

[eluser]rdjs[/eluser]
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://ellislab.com/forums/viewthread/97399/

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

Code:
A PHP Error was encountered

Severity: Warning

Message: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name 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

Filename: libraries/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:

Code:
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);
        }

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...

Code:
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);
        }

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:

Code:
$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.
#20

[eluser]ToddyBoy[/eluser]
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.




Theme © iAndrew 2016 - Forum software by © MyBB