General discussions : Non mobile discussion : a few more new webside coding questions
>
New Topic
>
Reply<
Esato Forum Index
>
General discussions >
Non mobile discussion
> a few more new webside coding questions
Bookmark topic
EastCoastStar Posts: > 500
okay, i have a few new coding questions. i want a page where users can load songs and stuff to a folder on my site. so i have a folder named "anything", i want users, from the web, to be able to load songs, pictures, whatever they want. ALSO IF POSSIABLE, i want them to have to have a username and password. if not, thats fine. i can always create a password protected page.
ANOTHER THING...
im looking for a code for people to play music on their myspace page. I am charging people (unless some esato users want to do it, it will be free), where they can load a few songs, and have a choice of a few players for their myspace page (or their own if they wish). I want it to have my website name in it and all, adn say the song name if possiable. If anyone can help with that, or even just point me in the right direction, it would be greatly appreciated. (btw, im not computer dumb, i knwo alot

) thanks all.
--
Posted: 2006-04-09 10:40:32
Edit :
Quote
Use the mkdir function in php to make a folder when people sign up and in the same time create a .htaccess file (I'm sure it's possible in php but don't know the function) wich will have the username and password of the member and of course your info also so you will have access at every folder.
Example for mkdir: mkdir ("/home/www/files/$username", 0744);
Edit: I'm not sure if .htaccess and md5 use the same way to code a password but it's worth a shot
Edit2: yeah I was correct, htpasswd use a modified md5 so you need the crypt() function
Here is an
ugly example with a form but it works (tested it out):
Quote:
$password = $_POST['password'];
$username = $_POST['username'];
$md5password = md5($password); ---> use for mysql
$cryptpassword = crypt($password); ---> use for .htpasswd
mkdir ("/home/www/files/$username", 0777); (change the 0777)
$myFile = "files/$r_username/.htaccess";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "AuthUserFile /home/www/files/$username/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require user $username";
fwrite($fh, $stringData);
$myFile2 = "files/$username/.htpasswd";
$fh2 = fopen($myFile2, 'w') or die("can't open file");
$stringData2 = "$username:$cryptpassword";
fwrite($fh2, $stringData2);
[ This Message was edited by: Jim on 2006-04-09 14:29 ]
--
Posted: 2006-04-09 14:22:13
Edit :
Quote
Allways my pleasure
Pfffff
--
Posted: 2006-04-12 10:12:31
Edit :
Quote
gave me an error....
--
Posted: 2006-04-12 12:19:55
Edit :
Quote
Of course, it miss the form and some other variables but as he said he knows things then I suppose I don't need to make him the full script

.
--
Posted: 2006-04-12 13:08:55
Edit :
Quote
ok
--
Posted: 2006-04-12 15:51:43
Edit :
Quote
EastCoastStar Posts: > 500
i completley didnt even see a response for this!
i will try it when i get home (im at work) it actually looks liek it will work. and seems pretty basic, idk why i didnt think of it. but, i will definatley try it. thank you much!! we will see how it goes
--
Posted: 2006-04-12 15:54:24
Edit :
Quote
Use the database!
Make a simple login and logout with sessions, then make a simple file lister.
--
Posted: 2006-04-12 18:44:01
Edit :
Quote
Isn't their a risk of sql injection ?
--
Posted: 2006-04-12 18:48:19
Edit :
Quote
Not if you do it right

You need to use strip_tags() or some custom method.
--
Posted: 2006-04-12 18:55:38
Edit :
Quote
New Topic
Reply