Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter redirect to localhost after online migration
#11

(This post was last modified: 11-27-2015, 12:49 PM by JackIlpazzo.)

(11-27-2015, 12:14 PM)arma7x Wrote: The problem occur when redirect to login page which mean your auth system? Did you use community auth or tank auth? Or using your own auth system?

Now for example if you try to access the link do not get the localhost, maybe it's something related to the server hostinger? I see that sometimes it does, I restarted my PC for some reasons and now I felt the problem does not occur, you can try?
However, the login system uses models of CodeIgniter, through features that allow you to see if the user exists in the database I execute an ajax request. The ajax request will delay the url we are discussing if the privileges are only for the customer, otherwise will send back to the backend that corresponds to this:

http://primodebug.esy.es/Calendario/backend

I repeat, in local with Bitnami all works. But online there is some problem. I really can not understand what can be, I developed this CodeIgniter 2.1.4 and I used the library EasyAppointments you can find here:

http://easyappointments.org/

I also tried to install the library without my changes and I get the same results but others not. If you can help me to come out I'd be really grateful I do not know what it is.

UPDATE:

In the index function are checked che permission of the user:

PHP Code:
$this->session->set_userdata('dest_url'$this->config->item('base_url') . 'backend');
 
       if (!$this->hasPrivileges(PRIV_APPOINTMENTS)) return; 

UPDATE:


I understand what causes the redirect to localhost, practically if the user is logged on with these credentials:

Username: Test
Password: 123456789

and put this url:

http://primodebug.esy.es/Calendario/

is restored to localhost, on the contrary if the user has not logged in and attempt to access the url above, you will be redirected to the localhost. Probably the problem is in the function index. I'm investigating the cause.
Reply
#12

(This post was last modified: 11-27-2015, 12:55 PM by arma7x. Edit Reason: Typo and question detail... )

Yes, it will work on Bitnami xampp because in your pc, localhost is your HTTP SERVER and will redirect to localhost. Have you try fire up your web apps using php development server and using port other than 80??Are you on Linux or windows??
Keep calm.
Reply
#13

(This post was last modified: 11-27-2015, 01:12 PM by JackIlpazzo.)

(11-27-2015, 12:52 PM)arma7x Wrote: Yes, it will work on Bitnami xampp because in your pc, localhost is your HTTP SERVER and will redirect to localhost. Have you try fire up your web apps using php development server and using port other than 80??Are you on Linux or windows??

I'm on Windows, I've fixed the bug, in the past I missing to put $base_url that containt the base variable configuration, if you try now working good. (Without credentials). Thanks for the support I really appreciated, but now there's another bug that interested the library too, if you execute the login the page doesn't load the backend and in the network tab you can see failed to load response data by clicking on backend. This happean also when you try the official library also hostend on my hosting: http://primodebug.esy.es/Debug/
same credentials. Which are the problem now?

User that have fixed: https://github.com/alextselegidis/easyap.../issues/71

probably the same issue.
Reply
#14

Yes, I can login now and the redirect issue to localhost is solve. New problem is login page can be access if the user already login. Your auth have users roles. And I believe only user with level admin can access the backend page. And Test user only can access frontend page. Try login with admin credential. I'm on GMT 8 already 4a.m now, hope other member will helps you solve the problem. Will continue tomorrow..
Keep calm.
Reply
#15

(This post was last modified: 11-27-2015, 01:51 PM by JackIlpazzo.)

(11-27-2015, 01:20 PM)arma7x Wrote: Yes, I can login now and the redirect issue to localhost is solve. New problem is login page can be access if the user already login. Your auth have users roles. And I believe only user with level admin can access the backend page. And Test user only can access frontend page. Try login with admin credential. I'm on GMT 8 already 4a.m now, hope other member will helps you solve the problem. Will continue tomorrow..

The credentials that I give you is admin credentials..
The problem is on this line:

PHP Code:
$user_id $this->session->userdata('user_id');
 
       if ($user_id == FALSE) { // User not logged in, display the login view.
 
           if ($redirect) {
 
               header('Location: ' $this->config->item('base_url') . 'user/login');
 
           }
 
           return FALSE;
 
       

on localhost working but seems that the session cause some problem here and $user_id return false. Any idea?
Just used: print_r($this->session->all_userdata());
and user_id is 0 uhm...

UPDATE:

The bug is related on the id table when the admin is creating... tomorrow I'll investigate on the cause. The problem now is that if you enter in the system you can see that some library like moment.js and other isn't loaded, probably this is a problem of .htaccess? Could you see?

UPDATE:

I've fixed the bug, wrong js folder in the CI
Reply
#16

(This post was last modified: 11-27-2015, 02:01 PM by arma7x.)

Hard to fix based on piece of code. Can you send me compressed file of your webapp and sql dump via PM box.
Keep calm.
Reply
#17

(11-27-2015, 01:58 PM)arma7x Wrote: Hard to fix based on piece of code. Can you send me compressed file of your webapp and sql dump via PM box.

Thank you but I've fixed all the problems, have a nice day Smile
Reply
#18

Just add the following lines to your config.php file and problem solved

$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']);
Reply
#19

Come on, this is almost 6 years old...
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#20

for sake of god move to ci4 its sable ready to production
Enlightenment  Is  Freedom
Reply




Theme © iAndrew 2016 - Forum software by © MyBB