ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

PHP login script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP login script

    Hello All,

    I was recently granted access to PHP on the Iseries (using ZEND SERVER). However, the manager overseeing the Iseries, won't open PHP to all to use unless we have adequate security when accessing the PHP script.

    Does anyone have example of a logon script that prompts for a user id and password, verifying against an Iseries file (something to insert at beginning of a php script but prompting only first time running a php script for the day?

    Thanks in advance.

    Pag

  • #2
    Re: PHP login script

    This should get you started...

    PHP Code:
    <?php
    Session_Start
    ();

    $_Session'i5_UName' ] = $_POST'i5_UName' ];
    $_Session'i5_PassW' ] = $_POST'i5_PassW' ];
    $_Session'ServerIP' ] = "LocalHost";

    $conn i5_connect$_Session'ServerIP' ],
                        
    $_Session'i5_UName' ],
                        
    $_Session'i5_PassW' ] );
                    
    if ( 
    $conn === false ) {
    ?>
       <table border='1'>
         <tr valign = 'middle'>
            <th>** ERROR **</th>
           <th>Failed to Connect to Server!</th>
         </tr>
         <tr>
            <td> Server </td>
            <td> <? Echo $_Session[ 'ServerIP' ]; ?> </td>
         </tr>
         <tr>
            <td> UserName </td>
            <td> <? Echo $_Session[ 'i5_UName' ]; ?> </td>
         </tr>
         <tr>
            <td> Password </td>
            <td> <? echo Str_Repeat( "*", StrLen( $_Session[ 'i5_PassW' ] ) ); ?> </td>
         </tr>
         <tr>
            <td> Message </td>
            <td> <? Echo i5_error(). ": " .i5_errormsg(); ?> </td>
         </tr>
       </table>
    <?
       Echo "<br> Press the BACK button to re-enter your UserID / Password combination <br>";

       die();

    }  Else {
       Echo "Connection was made!";
    }

    i5_Close( $conn );
    ?>

    Comment


    • #3
      Re: PHP login script

      Thanks Rick, will try the script...

      Pag

      Comment

      Working...
      X