[SOLVED] - APK (Cordova) + NeoPHP & MySQL - Forum

Forum Navigation
You need to log in to create posts and topics.

[SOLVED] - APK (Cordova) + NeoPHP & MySQL

Hi!

I have made and Android app using Cordova and i use neophp also to connect my online mysql database.
but i can't create users no matter how hard i try and read topics and... :(

neoPhpUserInsert "test" "test@test.com" "test" 1 "answer"

My config.php start with this lines:

header("Access-Control-Allow-Origin: *");

//Allow self registration as user
$allowSelfRegistration=true;
$selfRegistrationLevel=2;

Both config.php and neofunction.php uploaded on same directory on my site. and i start app codes with:

neoPhpSetPath "https://mysite/neofunctions.php"

Question:
The "users" table cannot be made automaticaly if database is mysql?
is "users" correct name for table and if i want to make table manualy what are columns?
"id", "username", "password", "email", "level" - i created this and not working.

@noyzen the "users" table is generate automatically. Its name will be "neousers".
It's mandatory to include the "users" database information within the config.php file:

//--------------Users database-------------------------------------------------------
//Database to store and retrieve application users.

//MySQL sample
$usersDb="realDataBaseName";
$usersDbServerName="localhost";
$usersDbUserName="MySQLUserName";
$usersDbPassword="MySQLUserPassword";

//Allow self registration as user
$allowSelfRegistration=true;
$selfRegistrationLevel=2;

Note that the "users" database can be the same (or different) that the "data" database.

Regards.

 

noyzen has reacted to this post.
noyzen

Thanks @luishp very quick response!

Yes i have database info on my config.php of course.

//MySQL sample
$usersDb="realDataBaseName";
$usersDbServerName="localhost";
$usersDbUserName="MySQLUserName";
$usersDbPassword="MySQLUserPassword";

But when i use command:

neoPhpUserInsert "test" "test@test.com" "test" 1 "answer"

Nothing happens. and callback error is empty.

In config.php template we have this:

//--------------Users database-------------------------------------------------------
//Database to store and retrieve application users.
//If it doesn't exist, and it's a SQLite database, it will be created if necessary.

"and it's a SQLite database"

Which is mysql in my app.


i made table manualy, named "neousers" with columns like:
id - username - password - email - level
still no luck.

I changed database to sqlite, it works and creates database and table and user.
there is a problem with mysql...

@noyzen I will try to check it as soon as possible, but it could take time as I'm quite busy.
Any clue regarding the problem you are facing will be welcome.
No error message? Even as a parameter in the callback subroutine?

Regards.

 

noyzen has reacted to this post.
noyzen

OK that was my bad. @luishp

In config.php file i just set info for "Alias" databases i found that there is 2 parts, one for users and one for alias.

Now everything work perfectly - auto table creation add user and...

:)

This is correct Config.php which is working:

<?php
header("Access-Control-Allow-Origin: *");

//Allow self registration as user
$allowSelfRegistration=true;
$selfRegistrationLevel=1;

//SQLite Info
//$usersDb="users.db";

//SQLite Alias
//$dbAlias[0]="dbname";
//$dbNames[0]="neophp.db";

//MySQL Info
$usersDb="dbname";
$usersDbServerName="localhost";
$usersDbUserName="dbname";
$usersDbPassword="dbpass";

//MySQL Alias
$dbAlias[1]="dbname";
$dbNames[1]="dbname";
$dbServerNames[1]="localhost";
$dbUserNames[1]="dbname";
$dbPasswords[1]="dbpass";

//SQL Queries

?>

 

luishp has reacted to this post.
luishp

@noyzen Great! :) I know this is a bit confusing, but I thought that was the best possible setup. This way you can offer many applications with a single user management system and database, if you want. Note that neoCms could be very useful too.

Regards.

noyzen has reacted to this post.
noyzen

Yes i look NeoCMS too i just did it today again, but what i need for my app is direct database.

Ah another thing, i installed Cockpit CMS but there wasnt any "UserGroups". (from here https://getcockpit.com/)

I may use NeoCMS for my Next App i waited for it so long :D

@noyzen neoCms includes a preinstalled addon to manage groups.
Regards.

Uploaded files:
  • You need to login to have access to uploads.
noyzen has reacted to this post.
noyzen

I don't have it maybe i have to install "ADD-ON" :)

I will try when I'm done with current app.

Cool thing about cockpit cms is that based on Sqlite! so works on cheapest hosts without mysql also...

@noyzen download it from here. Our version has some preinstalled plugins and an optimized configuration.
Yes, it's very powerful :)

noyzen has reacted to this post.
noyzen

Installed, yes i see groups now. i have to learn it soon because i dont know concept well yet... is it database? i mean it replace databse? in what ways its better than usual beloved neophp? :D

I work on it soon...

Uploaded files:
  • You need to login to have access to uploads.