Login   Register  
PHP Classes
elePHPant
Icontem

File: ftp.basic.realm.auth.cls.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Md. Shahadat Hossain Khan Razon  >  Basic Realm Authentication Controller  >  ftp.basic.realm.auth.cls.php  >  Download  
File: ftp.basic.realm.auth.cls.php
Role: Example script
Content type: text/plain
Description: Example: Authentication by FTP server
Class: Basic Realm Authentication Controller
Authenticate users with HTTP basic mechanism
Author: By
Last change: fix session hijacking & fixation
Date: 2013-01-08 20:32
Size: 886 bytes
 

Contents

Class file image Download
<?php
/* basic realm auth by ftp server */

/**
 * the following myftp.cls.php found at
 * http://www.phpclasses.org/package/3400-PHP-Send-files-to-an-FTP-server.html
 * http://www.phpclasses.org/package/3400/
 */
include_once 'myftp.cls.php';
class 
httpBasicAuthThroughFTP extends myFtpWriter{

    function 
__construct($p_ftpsettings=NULL){ parent::__construct($p_ftpsettings); }

    public function 
isUserAuthorized($p_user$p_pass){
        
$this->ftpInfo['ftpusername']=$p_user;
        
$this->ftpInfo['ftpuserpassword']=$p_pass;
        
$passok=$this->conServer();
        
$this->disconServer();
        return 
$passok;
    }

}

session_start();
include_once 
'http.auth.cls.php';
$ftpuser=new httpBasicAuthThroughFTP(array('ftpserver'=>'www.yourftpserver.tld'));
$httpauth=new HTTPBasicRealmAuth('authentication by ftp users'$ftpuser'isUserAuthorized');

include 
'secure.file.eg.php';