WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : PHP / FTP Web Authentication Scrip! Please visit WWW.FLACCESS.COM
Categories : Apache, Ecommerce, FTP, Linux, Sockets Click here to Update Your Picture
John Jolly
Date : Oct 23rd 2001
Grade : 2 of 5 (graded 2 times)
Viewed : 10281
File : ftplogin.doc
Images : No Images for this code example.
Search : More code by John Jolly
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

First you need to create a file called ftplogin.php. Note in order to run this
script you must
have an ftp server with a valid account.

Paste the following in ftplogin.php
-------------------------------------------------------------------------------------
----
<?
function checkftplogin($server, $user, $pass) {
$sck = fsockopen($server, 21);
if ($sck) {
$data = fgets($sck, 1024);
fputs($sck, "USER $user\n");
$data = fgets($sck, 1024);
fputs($sck, "PASS $pass\n");
$data = fgets($sck, 1024);
if (ereg("230", $data)) {
# User logged in
return 1;
} else {
# Login failed
return 0;
}
fclose($sck);
} else {
return 0;
}
}
function authenticate() {
Header("WWW-Authenticate: Basic realm=\"Secure Login\"");
echo "Authentication Failed!";
exit();
}
if(!isset($PHP_AUTH_USER)) {
authenticate();
exit;
echo "Authorisation Failed\n";
} else {

$tmp = checkftplogin("localhost", "$PHP_AUTH_USER", "$PHP_AUTH_PW");
if ($tmp != "1") {
authenticate();
}
}
?>

-------------------------------------------------------------------------------------
---------

Now you should have a file called ftplogin.php with a few lines of code.
Go to the bottom of the script and look for the line that starts with $tmp. You
should see
localhost. This is where you enter your ftp server address. You shouldn't have to
edit anything
else. Now if you want to password a file such as index.php then just paste the
following code
at the top of the file.

------------------------------
<?include"ftplogin.php";?>
------------------------------

Now you should be able to view your index.php and have it pop up the user name and
password box. Enter your user name and password of the account you own on the ftp
server.
It should display your index.php if authenticated.
Here is a index.php sample.

----------------------------------
<?include"ftplogin.php";?>
<html>
<center>Hello there Welcome</center>
</html>
----------------------------------


This should work with any ftp server as long as you have an account and the
webserver's ip is allowed to the ftp server's ip address.


John L. Jolly III
john@flaccess.com
www.flaccess.com



uaa
Categories : Apache, Apache, Browsers, Calendar
Get TemplateMonster data
Categories : Arrays, Ecommerce, PHP, Strings
Moving folder hierarchy b/w server
Categories : PHP, FTP, Filesystem
include php3 files
Categories : Filesystem, PHP, Apache, Web Servers
This is a redirection program which is as good as the come.to v3 url redirection, complete with admin interface all clients stored in mysql
Categories : PHP, MySQL, Ecommerce, HTML and PHP, Complete Programs
accept_connect -- Accepts a connection on a socket
Categories : PHP, PHP Functions, Sockets
phpCMS a content-management-system written in php.
Categories : Content Management, Apache, Complete Programs, Web Servers, PHP
PHP Domain Availability Checker
Categories : PHP, Complete Programs, Regexps, HTTP, Sockets
Using .htaccess files to authenticate with .htpassword files and with MySql (Works with Apache)
Categories : Authentication, MySQL, Apache, Databases, Web Servers
Logging 404 errors in your custom statistics using Apache and a PHP script.
Categories : Apache, Web Servers, PHP, Errors and Logging
Add a linux user from php
Categories : Linux, PHP
WebFTP: This tool can be used to access FTP sites from behind any firewall or proxy.
Categories : PHP, FTP
PHPCatalog
Categories : Ecommerce, PHP, Complete Programs
Easily Grant Temporary SSH Access to yourself when in remote location
Categories : PHP, Linux, Cron, Security
ElfReader: An ELF (Executable and Linking Format) header information in PHP. Shows how to use the UNPACK function to read data.
Categories : PHP, Linux, PHP Classes