Previous login failed

Please report bugs and any annoyances here. Kindly include all possible details: steps to reproduce, expected result, actual result, screenshots, ... etc.
kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Previous login failed

Post by kanklovitch » 2021-05-13 11:17

Hi Guys
Back to an old annoying problem I have had for over a year and never got resolved on the forum. After a couple of hours AG logs out on the web server and asks me to login in with my username and password. I always get this "previous login failed" message. The only way I can log back in is by deleting the config.php file in which case I have to go through the setup routine to log back in.

I need to do this several times a day.
Attachments
login failed.jpg
login failed.jpg (28.56 KiB) Viewed 8140 times
After deleting config.php.jpg
After deleting config.php.jpg (49.1 KiB) Viewed 8140 times
setup data.jpg
setup data.jpg (68.34 KiB) Viewed 8140 times

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-14 05:54

Hi

this sounds very strange.
First I considered a new IP address, but this would not solve the question why you need to delete the config.php file each time.
What about the config.php file: Does it still exist on the server? Did you compare your config.php that does NOT allow you to login with the config.php that you (re)create? Did you also check permissions (chmod) on that file?
Maybe some code (your code) messes around with the file?
Maybe some other software (or even your AG application) has too many connections to the database which makes attempts to connect unsuccsessful?
I had this problem - too many users and too many concurrent connections. I solved this by adding the following code to the footer-extras.php directly before the file ends(!) (just ignore my comments in the code):

Code: Select all

	//START Close DB
	$con = db_link();
	if (db_close(db_link())) {
		//echo "94 close ok";
	} else {
		echo "db_close failed";
	}
	//echo "<h1>DONE</h1>";
	//END Close DB
Olaf

SkayyHH
Veteran Member
Posts: 425
Joined: 2015-04-27 21:18

Re: Previous login failed

Post by SkayyHH » 2021-05-14 06:35

Hi, in config.php adminconfig has changed within the time. Try to change that. depending on the version you need one or the other:

$adminConfig = [
'adminUsername' => "admin",
....
);
or

$adminConfig = array(
'adminUsername' => "admin",
....
];

Maybe that will help you.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-14 07:44

Hi SkayHH,

this would not explain why it suddenly does not work anymore.

@kanklovitch:
please take care that opening and closing brackets are the same
( and )
or
[ and ]



Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-14 13:24

I just tried adding the code to my footers-extra file. There was no code in it at all when I opened it. I will know in a couple of hours if it works.

Here is my code in config

$adminConfig = array(
'adminUsername' => "wildwalker",
'adminPassword' => "\$2y\$10\$/Fv1m/pSTmBWNxlg1bOel.PjE8dEAFugS3kiy8dFauYvrwXWNjEiC",

I noticed that the 'adminPassword' changes in various config files that I looked at. Is that normal?

Thanks super helpful guys!

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-14 15:11

Hi,

if your footr-extras.php was empty, that's ok. It simply means, you are not "injecting" any other code into ALL of your pages in the bottom area of a page.
So you should just be able to paste the code I provided. BUT: You should look into your pages right away (immediately) as the code WILL most likely show (a lot of) errors! Use those for debugging the problem and remove the code as soon as possible ...
I would also suggest NOT to use that at a busy live-site (as your visitors will also see the error messages).

Yes, it's ok, that the admin pw changes - even if you always use the same password.
The most important thing is, that the database credentials are still correct. The admin password (btw: you should not post "real" credentials here) is only for the admin to log in the application - not for the access to the database.
You should determine, if that database access still works, or if these credentials break.

Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-15 14:25

Hi
Yesterday was not a good test as I had to leave my shop unexpectedly. I pasted your code into footers extra and when I log in it displays on my home page like this. Is that what it is supposed to do to show any errors? Anyways after my computer did a reboot last night and I tried to login to my application this morning I still get the same old previous login failed message and I had to delete my config file again. I will let you know if AG logs out during the day without a computer reboot.

Thanks very much Olaf

Ken
Attachments
Footer extra code.jpg
Footer extra code.jpg (57.77 KiB) Viewed 8038 times

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-15 14:37

Hi,

well, the code should not show this message, but errors.
Try this (add PHP tags):

Code: Select all

<?php
	//START Close DB
	$con = db_link();
	if (db_close(db_link())) {
		//echo "94 close ok";
	} else {
		echo "db_close failed";
	}
	//echo "<h1>DONE</h1>";
	//END Close DB
	?>
This should not show ANY message!
IF you see "db_close failed" a) on your page or b) in your source code that you can make visible in your browser once the page has loaded, the closing of the db connection has failed.

Why did your computer reboot? Does this mean your computer is a Windows system? What type of server are you running (xamp, uniformserver? - which versions) ?
Maybe these questions lead a way to the solution why your config if gone every day / after some hours.

Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-15 18:10

Hello
My humble apologies, I should have know that footers-extras is a php page. I just logged in and the message is gone. I will see what the day brings today.

I have a Windows 10 system, I didn't get any messages but I assumed it was a Windows reboot.
Host Papa is my web server, I don't know if they use xamp or uniformserver, I will try and find out.

By the way no one else is using my system besides me, I am building on the web so I can manage my business where ever I go.

Thanks for you incredible patience.

Ken

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-16 06:13

Hi Ken,

no worries. We will try to solve your problem.

I still do not understand your setting: Where is your application run on?
Do you run it on a PC "in your room" - on windows?
Or:
Is it hosted online with Host Papa. If so, I would surely assume, they are using a linux system (see https://www.hostpapa.de/webhosting-plan/ ).

This turns up the question: Where do you need to delete the config.php?

Also: You wrote, your systems config.php has different admin passwords - is that the only difference "before deleting" and after creating the new file?

There comes an idea in mind:
Please inquire at Host Papa if they do something to your webspace which could result in loosing access to the database. I would suggest calling/writing them and telling them the same "problem story" as you have brought up here in the forum. Maybe there is some script running (like "automated AppGini installation", some sort of database cleanup/protection) which is the cause of your troubles.

Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-17 13:05

Hi Super Determined Super Hero
To be more clear, my desktop business computer that I have Appgini on is a windows machine. Yes Host Papa would be a Linux machine that runs the code. I have had to delete the config file on Host Papa for more than a year after running it for 2 or 3 years without any problem. The only difference in any config that I have ever noticed is the change in the admin passwords.

BUT HERE IS THE GOOD NEWS (so far). I just got out of bed and the first thing I checked was my application and miraculously I am still logged in. Yesterday, the only change I made was the last code you suggested for my footers-extra file. What exactly is the code doing?

Thanks very much Olaf, I should know in a few hours if everything is running normally.

I am totally dependant on AppGini to run my business and keep me "almost" organized.

A happy AppGini-er

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-18 05:31

Hi Ken,
well, if you are talking about this code

Code: Select all

<?php
	//START Close DB
	$con = db_link();
	if (db_close(db_link())) {
		//echo "94 close ok";
	} else {
		echo "db_close failed";
	}
	//echo "<h1>DONE</h1>";
	//END Close DB
	?>
it simply closes the database connection when the page has been loaded. Usually DB connections might stay open for a while (60s) to make following requests faster. This code was useful for me, when I was told the application hangs when there are too many users. Webspace providers set a limit on possible concurrent connections (1&1 for example 18 if I remember correct, even on a root server you might have 50 only). The effect was, that when 18 people at the same time accessed the application, person #19 would wait 1 minute (60s) for his page (and db) request to go through and he would see the page.
In your setting this however, it sounds to me you are the only user of your application, this code would not make much sense - for solving your problem anyways. Still: If this indeed worked, please confirm in a couple of days :-)

You wrote you are using xampp. If the problem stays, it would be good to know, which PHP version and which MySQL/MariaDB version you are using in xampp.

Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-18 14:15

Hi Olaf
It is with deep regret that I have to inform you that I have been logged out again every few hours the last while again. I will talk to Host Papa later today to see if I can get some help.
I haven't been using Xamp but here is the code. It says I am not running with administration rights but I did click on run with administration rights when I installed it. When I get time I will reinstall the latest Xamp and try running my AG application locally.
Initializing Control Panel
8:04:34 AM [main] Windows Version: Enterprise 64-bit
8:04:34 AM [main] XAMPP Version: 7.2.34
8:04:34 AM [main] Control Panel Version: 3.2.4 [ Compiled: Jun 5th 2019 ]
8:04:34 AM [main] You are not running with administrator rights! This will work for
8:04:34 AM [main] most application stuff but whenever you do something with services
8:04:34 AM [main] there will be a security dialogue or things will break! So think
8:04:34 AM [main] about running this application with administrator rights!
8:04:34 AM [main] XAMPP Installation Directory: "e:\xamp\"
8:04:34 AM [main] Checking for prerequisites
8:04:34 AM [main] All prerequisites found
8:04:34 AM [main] Initializing Modules
8:04:34 AM [main] Starting Check-Timer
8:04:34 AM [main] Control Panel Ready
8:04:46 AM [Apache] Attempting to start Apache app...
8:04:46 AM [Apache] Status change detected: running
8:04:49 AM [mysql] Attempting to start MySQL app...
8:04:50 AM [mysql] Status change detected: running

I will let you know as soon as I am able to get useful information.

Thank you
Ken

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-19 06:15

Hi Ken,

we need to localize the problem: The problem occurs on the live installation which is hosted on "Host Papa" - correct?
If so, we should not start mixing local with live installation at this time.

Please ask Host Papa also, where you can find the server error log. This might contains clues.

Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-20 17:08

Hi Detective Olaf
I talked to Host Papa and the reason why I am getting logged out is because I am on a shared server which I think you already alluded to. In order to stop the logging out I would have to go on a VPS plan. (Virtual personal server) That explains the logging out, but of course it doesn't explain the "previous login failed" and the necessity to delete my config file. Also as soon as I get some time I am going to just set up a very simple test DB to see if it does the same thing.

If this can't be solved I will consider just running my application locally.

Thanks again for your incredible generosity with your time and brain power!

Ken

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-21 09:34

Hi Ken,

well, who am I? I am just a nobody, but ... the suggested solution from HostPapa sounds to me more like "we want to get more money from you".
We need to see what your setting is:
If your IP address does not change, you should definitely stay logged in your AG application for as long, as your cookies stay in your browser. AG does not so any session timeout by itself either. So, AG will not log you out.
Even more strange (to fine polite words for the information you got from HostPapa) is that whatever happens, it does not explain why you need to login via FTP, delete your config.php and set up the application again and again, every day (or was it every few hours). If this happens, you AG application obviously can not a) find the config.php file and following this b) not connect to the server. The main problem seems to be a) already. If your application can not connect to the database (after it has read the db credentials from the config.php file) the error message would be this:
When $dbUsername is wrong:
The server requested authentication method unknown to the client
When $dbPasswort is wrong:

Code: Select all

Access denied for user 'username_here'@'server_here' (using password: YES)
When $dbDatabase is wrong:

Code: Select all

Unknown database 'wrong_db_name_here'
When $dbServer is wrong:

Code: Select all

php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist unbekannt.
Maybe try to recreate your app (for testing) and upload it as well.
Or - ask a friend who is at another host and transfer your complete application to the friend for testing.
Before doing it all local it seems worth trying to find the reason for the problems - at HostPapa.

2cts
Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-21 15:24

This is getting interesting and educational as well.
Here is the last post from Host Papa.

Hello Ken,

Thanks for your patience.

I've increased the values of PHP settings so could you please give it another try?

If this continues to happen, we would need you to list here the IPv4 address which you can find by visiting this page https://hostpapastatus.com/ip/ from the same computer/device/network/web browser.

Just copy/paste it here.

If you are using an IPv6 address, then you would need to reach your ISP (internet service provider) support team to find the IPv4 address.

We are looking forward to your reply.

I will know by the end of the day if this works.

Thanks again Olaf.

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-23 14:03

To keep you informed set up a very simple test database on Host Papa and I am having the same problem. I am working with HP support to determine the issue. I neve used to have this problem at HP, it just started about a year ago.

Thanks again for all your help Olaf and as soon as it gets resolved I will let you know.

Ken

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-24 09:53

Hi Olaf
Support at HostPapa have really been trying to help solve the problem. At first, my simple test db did the same thing as my gravestone DB. Host Papa support then configured the same new .htaccess for both my test and gravestone folders and changed some php settings. My internet just went down and I was able to log back in with my UN and PW normally. Unfortunately I have the same problem with my gravestone DB - "your previous log in failed" etc.

The only thing I have in my footers extra file is the code you gave me, I have nothing in my header extras file. The only thing different that I know of is in my gravestone DB I use the Jan's bizzworxx menu javascript system, other than that, both applications where created with "out of the box" AppGini. I am totally stumped and confused.

Ken

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-24 09:58

Host Papa support pointed out this old thread on the AppGini forum to me. Is there a solution here perhaps?

viewtopic.php?t=2230

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-25 11:29

Hi Ken,

I believe, Ahmeds post ( viewtopic.php?t=2230#p6485 ) in the thread you mentioned might work for you.
If it does - you need to remember, that regeneration of your application will overwrite the lib.php file and you will need to reapply the change.

Olaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-27 15:20

Just to inform you Olaf
I haven't had a chance to try the last fix. I run a very busy one man shop and I have to focus on production. I have to reinitialize my main application about 6 times a day, my test app runs perfectly. Host Papa says both have the same "privileges". If the next "fix" doesn't work I think I will just have to run my application locally because I am so dependant on it to stay organized. Thanks again for you support and I will let you know as soon I find out.

Ken

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-28 10:22

Hi Olaf

Here is the code Ahmed suggested

@ini_set('session.gc_maxlifetime', 28800);
@session_set_cookie_params(28800);

I can't figure where to put it in my lib file.

<?php
// This script and data application were generated by AppGini 5.95
// Download AppGini for free from https://bigprof.com/appgini/download/


error_reporting(E_ERROR /*| E_WARNING*/ | E_PARSE);

if(!defined('datalist_db_encoding')) define('datalist_db_encoding', 'UTF-8');
if(!defined('maxSortBy')) define('maxSortBy', 4);
if(!defined('empty_lookup_value')) define('empty_lookup_value', '{empty_value}');

if(function_exists('date_default_timezone_set')) @date_default_timezone_set('America/Regina');

$GLOBALS['filter_operators'] = array(
'equal-to' => '<=>',
'not-equal-to' => '!=',
'greater-than' => '>',
'greater-than-or-equal-to' => '>=',
'less-than' => '<',
'less-than-or-equal-to' => '<=',
'like' => 'like',
'not-like' => 'not like',
'is-empty' => 'isEmpty',
'is-not-empty' => 'isNotEmpty'
);

$currDir = dirname(__FILE__);
// if hooks/__bootstrap.php is found, it's included before any other files
// to define the very first functions loaded by app. Useful for controlling
// session behavior, ... etc.
@include_once("$currDir/hooks/__bootstrap.php");

include_once("$currDir/settings-manager.php");
detect_config();
migrate_config();

include_once("$currDir/defaultLang.php");
include_once("$currDir/language.php");
$Translation = array_merge($TranslationEn, $Translation);

include_once("$currDir/db.php");
include_once("$currDir/ci_input.php");
include_once("$currDir/datalist.php");
include_once("$currDir/incCommon.php");
include_once("$currDir/admin/incFunctions.php");

checkAppRequirements();

// detecting classes not included above
@spl_autoload_register(function($class) {
$app_dir = dirname(__FILE__);
@include_once("{$app_dir}/resources/lib/{$class}.php");
});

ob_start();


/* trim $_POST, $_GET, $_REQUEST */
if(count($_POST)) $_POST = array_trim($_POST);
if(count($_GET)) $_GET = array_trim($_GET);
if(count($_REQUEST)) $_REQUEST = array_trim($_REQUEST);

initSession();

// check if membership system exists
setupMembership();

// silently apply db changes, if any
@include_once("$currDir/updateDB.php");

// include global hook functions
@include_once("$currDir/hooks/__global.php");

// do we have a login request?
logInMember();

// convert expanded sorting variables, if provided, to SortField and SortDirection
$postedOrderBy = [];
for($i = 0; $i < maxSortBy; $i++) {
if(isset($_REQUEST["OrderByField$i"])) {
$sd = ($_REQUEST["OrderDir$i"] == 'desc' ? 'desc' : 'asc');
if($sfi = intval($_REQUEST["OrderByField$i"])) {
$postedOrderBy[] = array($sfi => $sd);
}
}
}
if(count($postedOrderBy)) {
$_REQUEST['SortField'] = '';
$_REQUEST['SortDirection'] = '';
foreach($postedOrderBy as $obi) {
$sfi = ''; $sd = '';
foreach($obi as $sfi => $sd);
$_REQUEST['SortField'] .= "$sfi $sd,";
}
$_REQUEST['SortField'] = substr($_REQUEST['SortField'], 0, -2 - strlen($sd));
$_REQUEST['SortDirection'] = $sd;
} elseif($_REQUEST['apply_sorting']) {
/* no sorting and came from filters page .. so clear sorting */
$_REQUEST['SortField'] = $_REQUEST['SortDirection'] = '';
}

// include nav menu links
@include_once("$currDir/hooks/links-navmenu.php");

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Previous login failed

Post by onoehring » 2021-05-29 08:31

Hi Ken,

just throw the code in after php opening ... like so:

Code: Select all

<?php
// This script and data application were generated by AppGini 5.95
// Download AppGini for free from https://bigprof.com/appgini/download/

@ini_set('session.gc_maxlifetime', 28800);
@session_set_cookie_params(28800);

error_reporting(E_ERROR /*| E_WARNING*/ | E_PARSE);
....
OLaf

kanklovitch
Veteran Member
Posts: 159
Joined: 2019-02-03 17:26

Re: Previous login failed

Post by kanklovitch » 2021-05-30 11:20

Thanks Olaf
I will give that a try. I hope it works. The entire thing is extremely confusing to me. I love AppGini, I depend on it to manage my business, but to re-initialize my db get's very annoying a half a dozen times in my busy day. I decided to rebuild my main db in the test db I set up and it was working fine until I almost finished with all my data ported over when it suddenly started to do the same thing when I renamed my application to my new business name. In other words instead of test.axp it is called north_country.axp and I renamed my folder on Host Papa to north_country from test. How is it possible it could work just fine for a couple of days and than suddenly say "previous log-in failed and make me start over?

Does anyone else in the forum have the same issue? Is "previous log-in failed and make me start over" an AG error message? Can Ahmed help?

Anyways thanks very much for all your help Olaf.

Ken

Post Reply