PDA

View Full Version : how to start php/html coding



gsquare567
04-15-2007, 04:20 AM
ok, i need to know how to make a simple auth system with username and password, and if those match my list then check if they match the IP, if all is true it returns the word 'ACCEPTED' on an empty page. this leads me to 3 questions:
1. is any1 willing to do this for me
2. if not 1, then what topics do you siggest i learn and how should i format this... also relevant, how do i make a real website, one of those free ones, and inject php/html code into it?

N00b1
04-15-2007, 03:38 PM
well it seems easy i assume that you have a php server set up on your pc and have a editor

step one make a html form with a password box and a username box and a submit button next point it to a .php page

step to google getting ip's with php then make a script (if this auth is just for you) that will get the ip then echo it out get your ip address and store it then make your php script get the username and password and the ip then use some if else statements to se if they match if they do redirect to the pass protected page you must req the auth page on the top of the pass pro page

ive said it like this and not done it for you because you sound like you want to actually do it

gsquare567
04-16-2007, 05:22 PM
ok, i did the html part and made it active to to .php but i dont understand how to get the ip address. i dont want my ip address, i want to post this on a free site and get the local pc's ip, like whoever goes to the site.

~alex~
04-18-2007, 07:22 AM
Similar to ipchicken or whatismyip.com? Only with logging in kinda.

Night
04-19-2007, 02:21 AM
$ip = $_SERVER['REMOTE_ADDR'];


that will give you the ip of the person viewing the site...
(for people with dhcp servers meaning routers, their external ips change ever so often)
(for people with dialup, each time they connect, they get a new ip)

I thought id let you know =p

If you need anymore help with relevant stuff, dont hesitate to ask =p.

http://w3schools.com

Its a really good site for tutorials on webdevelopment, (php is one of them).

Ranger135xp
04-22-2007, 05:22 PM
if you want to log it, look in my post. try looking at the other post titles before you post a new thread about it. but yes, this is possible. =]

arti
04-25-2007, 03:40 AM
Use the way to get the ip above

$ip = $_SERVER['REMOVE_ADDR'];

to Log do something like this :

$fo = fopen('filename.txt', 'a'); //http://us2.php.net/manual/en/function.fopen.php
fwrite($fo, $ip); //http://us2.php.net/manual/en/function.fwrite.php
fclose($fo); //http://us2.php.net/manual/en/function.fclose.php

That'll add the IP to the end of the text file. Google 'File writing php' ... also, may I recommend, http://pixel2life.com/ for a massive amount of tutorials.