Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-31-2009, 07:34 PM Block File
Novice Talker

Posts: 7
Trades: 0
How would I make it where someone has to be a member of my site to download a file?
tecno40 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-31-2009, 07:49 PM Re: Block File
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Well, you have to authorize who they are, and if there account matches a row in the data base then there allowed the files, if not they are given an error.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 01-31-2009, 09:32 PM Re: Block File
Novice Talker

Posts: 7
Trades: 0
Can I do this with PHP or do I have to configure my server?
tecno40 is offline
Reply With Quote
View Public Profile
 
Old 01-31-2009, 09:36 PM Re: Block File
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
It would be done with php yes and you may have to configure your server. There are tons of content management systems available.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-01-2009, 12:02 AM Re: Block File
Novice Talker

Posts: 7
Trades: 0
All the CMS I've seen so far are for text only. Does anyone know how to create one for .exe files?
tecno40 is offline
Reply With Quote
View Public Profile
 
Old 02-02-2009, 08:56 AM Re: Block File
Novice Talker

Posts: 7
Trades: 0
After a lot of searching I found this code:
Code:
// define some variables
$local_file = 'test.zip';
$server_file = 'test.zip';
// set up basic connection
//$ftp_server= "ftp://elfcommunity.com/";
$conn_id = ftp_connect($ftp_server);
// login with username and password
$ftp_use_name= "my username";
$ftp_user_pass= "my password";
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
    echo "Successfully written to $local_file\n";
} else {
    echo "There was a problem\n";
}
// close the connection
ftp_close($conn_id);
But every time i test it it echos there was a problem.
tecno40 is offline
Reply With Quote
View Public Profile
 
Old 02-02-2009, 10:57 AM Re: Block File
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
ftp_get is to get a file (or files) from a remote location to your server
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-02-2009, 06:19 PM Re: Block File
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
Quote:
Originally Posted by tecno40 View Post
All the CMS I've seen so far are for text only. Does anyone know how to create one for .exe files?
I'm pretty sure that some open source CMS (Content Management Systems) will suit your needs.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 02-02-2009, 08:22 PM Re: Block File
Novice Talker

Posts: 7
Trades: 0
I fixed the problem !!! What I did was save the file in a folder locked with a password and used this code:
Code:
    
   header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
tecno40 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Block File
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27962 seconds with 12 queries