facebook

My Login With PHP

  1. MobiOne Archive
  2.  > 
  3. Examples, HOW-TOs
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #335217 Reply

    Brandon
    Member

    As promised here is my Login how to using PHP.

    First the PHP File:
    It wouldnt let me attach a file or use the php code, so here is the php file:
    http://cincyplanet.com/php/myLogin.php

    Upload the php file to your server.

    In Mobione make your screen and make it a form.
    Set the Form Action Type to URL and the Form Action URL to the file you uploaded.
    Also set the form method to POST
    On the form you will need two Text boxes and a button.
    The username text box needs to be named myUsername
    The password text box needs to be named myPassword
    In the action for the button set it to Submit Form

    For the next steps you will need to run you project in the Test Center and use the Tools, Source Code, <appname>_custom.js file

    Find your phoneui.postSubmitForm_m1_<screenname> = function
    And add this code:

    
     if (isSuccess) 
    {
        // process data
            if (data == "Login Correct")
        {
          result = true;   //I am setting a variable to true so I know, in other parts of the app, that the user has logged in already.
       //Here you can process anything else you need to after the correct login
    
        }else{
            alert("Login Not Authorized"); //alert the user that the login was incorrect
            result = false;  //set our login variable to false
    }
        
      } else {
        // submit failed - for some reason, like pointing to the wrong file, the submission failed.
        // data = error msg 
       
      }
    
    

    Enjoy!

    EDIT: Here is the project file: http://cincyplanet.com/php/loginSample.zip

    #335509 Reply

    Rabah
    Member

    Hi ,

    I tried to use your method but it doesn’t work.
    The php file is opened with “Not autorised” message and I can’t open the file to see the code inside.

    Please can you send me to my email mailto:contact@pariseguides.com the example of the two mobi files with the MyLogin php file which cn be opened and insert my custom login passwords.

    I need really urgently a login page and a welcome page if password is correct using any sample method.

    Regards

    #335510 Reply

    Rabah
    Member

    Hi ,

    I tried to use your method but it doesn’t work.
    The php file is opened with “Not autorised” message and I can’t open the file to see the code inside.

    Please can you send me to my email mailto:contact@pariseguides.com the example of the two mobi files with the MyLogin php file which cn be opened and insert my custom login passwords.

    I need really urgently a login page and a welcome page if password is correct using any sample method.

    Regards

    #335514 Reply

    Brandon
    Member

    If you can not open the php this is why you are getting the not authorized return.

    You need to download the file and open it in a text editor. This is the file that stores the usernames and passwords so you need to be able to edit it.

    If it is returning not authorized you are probably doing everything right, just the wrong username and password.

    For the sample login.php if you have not edited it the username is: username and the password is: password

    Try using this in your sample, if it still does not work let me know. Either way you will still need to be able to open and edit the php file.

    #335539 Reply

    Rabah
    Member

    Hi octavio

    Thanks for your reply.
    The problem ios that I can’t open the file with any text editor.
    The only message shown is Not autorised.

    Please can you check the file with your text editor and send it to me to mailto:contact@pariseguides.com ?

    If you can send the two .mobi files (login form and welcome pages), it will help me very much.

    I need to publish my app and I’m blocked since two weeks because of this problem.

    Thanks again.

    Rabah

    #335546 Reply

    Brandon
    Member

    I will upload a project zip file tonight when I get home with the required files.

    #335547 Reply

    Rabah
    Member

    Thanks.

    Remember that I need a login page form and a welcom page is password success (for any user name).

    In the welcome page, I’ll a button to access to a paid package of video files.

    The goal is that the users will ue the password to get to the the welcome page. If the password is wrong, a message will tell him to check the password and try again.
    if the user is logged once, he will not need to insert the password again from the app.

    Kind regards

    #335548 Reply

    Brandon
    Member

    In my version you can do anything you want after the login, it only process the username and login, so there is only one screen. You can easily add the code to dynamically go to the next screen, run a function or anything else.

    #335551 Reply

    Rabah
    Member

    yes of course.
    I need to go to the welcome page after the insertion of the right password.

    In the welcome page I’ll add link to the videos to be streamed vrom the server.

    Kind regards

    Rabah

    #335552 Reply

    Brandon
    Member

    I will include that code in the form processing for you.

    Just out of curiosity, how are you generating the password? Are they different for each user or the same?
    If you dont need a very secure you could do a javascript variable that is stored in a separate file. Easy to do without any php worries, just not the most secure way.

    #335578 Reply

    Rabah
    Member

    No , the password will be the same for many users and the login can be neutral or unique.

    It’s difficult to manage too many differents users with different login and passwords.

    My idea is to to set one password or some in the login form and if it’s correct the welcome page will be displayed.

    I’ll give the password to the user by email after the order of the videos package.
    Then the user can access to the videos after login success with the right password.

    I don’t know how to set more passwords in a text file or inside the script of the login page.

    For sampe way, I can start with a sample login password form even if it works only one password and not very secure.

    Regards

    #335579 Reply

    Rabah
    Member

    Yes octavio. You are right. Don’t need really php for such needs.

    I jest need sample methode to go to the welcome page with static password that I will give to the user by email after the order of the videos package. Then he will use the password in the app to access to the welcome page to view the videos from the app.

    Please test the login+welcome pages in mobione test center and let me know how to change the login and password in the script.

    I need also to a pdf file inside the app to be show with zoom function. So how to choose the pdf file like an image instead of the url which is an exertnal file.

    At the moment, I tested a pdf file to be displayed from my web site in a pop window. It works with iphone bu not with android 4 which doesn’t like the pop window.

    Thanks a lot for any help.

    Kind regards

    #335580 Reply

    Brandon
    Member

    Here is the sample login and files. After login it will take you to the welcome page.

    http://cincyplanet.com/php/loginSample.zip

    #335586 Reply

    Rabah
    Member

    Hello octavio.

    Thank you very much for your support.
    I tested the two files and I canged the password in myLogin.php

    Now the welcome page works fine after using the correct password.

    I need to fincish the app PARIS VISITE and publish it in AppStore and Android market.

    I have just to resolve other proble with pdf files in android platform where pdf file from a web page is not loaded in a window (no control).
    May be with a local pdf file it will work. I have to make tests again…

    Kind regards.

    #335587 Reply

    Rabah
    Member

    Hello octavio.
    Thank you very much for your support.
    I tested the two files and I changed the password in myLogin.php

    Now the welcome page works fine after using the correct password.
    I need to finish the app PARIS VISITE and publish it in AppStore and Android market tomorrow.

    I have just to resolve other problem with pdf files in android platform where pdf file from a web page is not loaded in a window (no control).
    May be with a local pdf file it will work. I have to make tests again…

    Kind regards.

Viewing 15 posts - 1 through 15 (of 21 total)
Reply To: My Login With PHP

You must be logged in to post in the forum log in