PHP

Questions about programming languages and debugging
Post Reply
User avatar
visser
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 472
Joined: 03 Apr 2007, 16:00
17
Location: online
Contact:

PHP

Post by visser »

ok so i know absolutely nothing about php. ive been trying to learn c++ and vb. but ive been really really busy. so i had an idea. i wanted to set up a server on my computer (apache) and have it so that i could get the music off of it that way. but i also wanted to be able to access the music from outside of my network. no i know how to connect to my computer using apache outside of my house and such. but i was just curious if there was a way that rather than connecting to my comp. i wanted to do some sort of login. i know thats its php. but i dont want to use like a login and register type of deal.

my idea was to create a cookie. that if you have it then you see all the files that i want to share. but if you dont have it then it jsut says "hey blah blah blah not your computer. go away" would that be doable. rather than a login use a cookie??? (suck-o does it lol after you log in though)

User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

Post by ayu »

Yeah it would be doable, but wouldn't it just be easier to just make a very secure login? =/

And then if you use a cookie like that then if someone would gain access to it they would be able to directly access everything, well i guess it depends a little on how the cookie is handled and maybe how it is built =/

Also, do you already know PHP or are you going to learn it? (just out of curiosity)
"The best place to hide a tree, is in a forest"

User avatar
visser
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 472
Joined: 03 Apr 2007, 16:00
17
Location: online
Contact:

Post by visser »

i know nothing of php. but i wanted someway to completely secure my server. and i thought of the cookie idea. and i was like hey. i like it. cause i have no idea about making a secure login. obviously you cant just get it off the net. i just want something easy and safe. and liked the cookie idea. so i figured i would ask around a bit.

User avatar
Gogeta70
^_^
^_^
Posts: 3275
Joined: 25 Jun 2005, 16:00
18

Post by Gogeta70 »

The best way to block access to your server is using HTACCESS, however, if you want to use PHP, do something like this:

Code: Select all

$pwd = $_POST['pass'];

if($pwd != "your password")
{
die("This is not your computer. Go away.");
} else {
$files = scandir("/");

for($a = 0; $a < count($files); $a++)
{
echo "<a href='" . $files[$a] . "'>". $files[$a] ."</a><br/>";
}
unset($files);
}
¯\_(ツ)_/¯ It works on my machine...

User avatar
visser
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 472
Joined: 03 Apr 2007, 16:00
17
Location: online
Contact:

Post by visser »

well hey guys thank you for everything. i guess ill just have to learn some basic php. thanks for everything!!!!

User avatar
computathug
Administrator
Administrator
Posts: 2693
Joined: 29 Mar 2007, 16:00
17
Location: UK
Contact:

Post by computathug »

here is a good place to start

Code: Select all

http://www.phpvideotutorials.com
hope this helps get ya started
:wink:

Post Reply