Osirose II registration script issue

Welcome in the osiRose emulator Project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Re: Osirose II registration script issue

Postby aerocoke on Wed May 02, 2018 9:54 pm

lazypenguin wrote:Does it work when you use the stored procedure ?

  1.  
  2. if (isset($_POST['username']) && isset($_POST['password'])){    
  3.         $username= $_POST['username'] ;
  4.         $password = $_POST['password'];
  5.  
  6.         $sql = "call create_account(${username}, ${password})";
  7.         $query = mysqli_query($connection, $sql) ;
  8.  


I don't know PHP so YMMV...


I tried
  1. $sql = $connection->query("call create_account"(${username}, ${password}));
but gives me the 'Call to undefined function' error.
aerocoke
Jelly Bean
Jelly Bean
 
Posts: 16
Joined: Wed Feb 24, 2016 2:31 am

Re: Osirose II registration script issue

Postby lazypenguin on Wed May 02, 2018 10:46 pm

The function is defined here: https://github.com/dev-osrose/osIROSE-n ... e.sql#L393

You might want to try rebuilding your database if that stored procedure is not working. You can also see how the stored procedure creates an account. Basically:

  1.  
  2. SET @salt = create_salt();
  3. INSERT INTO accounts(username, password, salt) VALUES(_user, SHA2( CONCAT(_pass,@salt), 256), @salt);
  4. SET @salt = NULL;
  5.  
lazypenguin
Smoulie
Smoulie
 
Posts: 68
Joined: Mon Aug 10, 2009 6:51 am

Re: Osirose II registration script issue

Postby L3nn0x on Thu May 03, 2018 6:24 pm

The order you are doing things is wrong.

You need to first concatenate the password and the salt and then call sha256 on it. Store the result in the database.

But you should use the stored procedure. We created it so you wouldn't have to worry about salts and the such :)
L3nn0x
osiRose dev
osiRose dev
 
Posts: 110
Joined: Wed Oct 21, 2015 8:22 pm

Re: Osirose II registration script issue

Postby XxXshidoXxX on Thu May 03, 2018 11:05 pm

aerocoke wrote:
lazypenguin wrote:Does it work when you use the stored procedure ?

  1.  
  2. if (isset($_POST['username']) && isset($_POST['password'])){    
  3.         $username= $_POST['username'] ;
  4.         $password = $_POST['password'];
  5.  
  6.         $sql = "call create_account(${username}, ${password})";
  7.         $query = mysqli_query($connection, $sql) ;
  8.  


I don't know PHP so YMMV...


I tried
  1. $sql = $connection->query("call create_account"(${username}, ${password}));
but gives me the 'Call to undefined function' error.

The issue here is i believe the php syntax.
Try

  1. $query = $connection->query("CALL create_account('$username','$password')") ;
My collection ( Tools, clients sources...)
https://mega.nz/#F!AdcFnQDL!sKp3O9tWGGdWvLEj_EYfwA
osrose mobile project
viewtopic.php?f=34&t=5787
OsRose Mobile development + Titan Rose redesign
https://github.com/shid0x
XxXshidoXxX
osiRose dev
osiRose dev
 
Posts: 445
Joined: Mon Aug 27, 2007 11:44 am

Re: Osirose II registration script issue

Postby L3nn0x on Fri May 04, 2018 4:14 pm

Oh nice catch, I didn't see that the parenthesis are outside the string.
I second that answer
L3nn0x
osiRose dev
osiRose dev
 
Posts: 110
Joined: Wed Oct 21, 2015 8:22 pm

Re: Osirose II registration script issue

Postby Raven0123 on Sat May 12, 2018 10:28 pm

FYI The create_account stored procedure expects that you are passing it a MD5 hashed password. It will not hash it for you.
User avatar
Raven0123
osiRose dev
osiRose dev
 
Posts: 377
Joined: Tue Sep 11, 2007 11:06 pm
Location: USA, NJ

Re: Osirose II registration script issue

Postby XxXshidoXxX on Sat May 12, 2018 10:49 pm

Raven0123 wrote:FYI The create_account stored procedure expects that you are passing it a MD5 hashed password. It will not hash it for you.


That explains why mine didn't work either, was too embarrassed to post about it lol.
My collection ( Tools, clients sources...)
https://mega.nz/#F!AdcFnQDL!sKp3O9tWGGdWvLEj_EYfwA
osrose mobile project
viewtopic.php?f=34&t=5787
OsRose Mobile development + Titan Rose redesign
https://github.com/shid0x
XxXshidoXxX
osiRose dev
osiRose dev
 
Posts: 445
Joined: Mon Aug 27, 2007 11:44 am

Re: Osirose II registration script issue

Postby L3nn0x on Sun May 13, 2018 1:34 pm

Oups, totally forgot about that. It's been so long since I last added an account from outside the server.
L3nn0x
osiRose dev
osiRose dev
 
Posts: 110
Joined: Wed Oct 21, 2015 8:22 pm

Previous

Return to Support - OsiRose Emulator

Who is online

Users browsing this forum: No registered users and 3 guests

cron