School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #7 Basic To-Do Assignment, post here |
(#12 2003-08-07 16:22:44) Post Reply |
|
TDavid
|
Week #7 Basic To-Do ASSIGNMENT: Write a script to print the IP address if a surfer comes from a bookmark or type-in and show their browser type, and if the person comes from YOUR domain then print a clickable url.
Post this assignment here so that we can offer comment/critique for you, but also post a URL to the working copy of the script and post the complete source code here. scriptname.php <-- script name Good luck to you!
|
(#80 2003-08-21 12:24:34) Post Reply |
|
Sk8rRIMuk
|
A little bit easier than the previous weeks but still a very handy script which I will be sure to put to use in some way on my new website when I have finished it.
Heres the URL to my working script: http://www.katikai.com/ee/assi...0Assignment.php As usual all my past assignments are at: http://www.katikai.com/ee/assignment Heres the source for my page:
I really like this assignment I can't wait to get started on the Advamced version but it shall ahve to wait a little longer seeing as I am gonna be celebrating my GCSE results :) I got 8 c's (including ICT & ART) a D (in english speaking and listening) and a B (in maths). Just incase you wnated to know. |
(#181 2003-09-10 14:03:32) Post Reply |
|
Quicksaver
|
here, easy :)
working url and i made this one to test out the script |
(#182 2003-09-10 14:21:20) Post Reply |
|
Quicksaver
|
and i noticed now that i dont have to hardcode my domain, i can do the same with the envinonmental variables
working url and another redirect |
(#183 2003-09-10 14:24:16) Post Reply |
|
Quicksaver
|
and of course all those could be resumed with the !$HTTP_REFERER way that sk8r used :) |
(#236 2003-09-18 02:31:54) Post Reply |
|
Shrek
|
Here is my Assignment
HTML link to PHP http://members.lycos.co.uk/jef...wan/class07.htm The PHP File http://members.lycos.co.uk/jef...wan/class07.php |
(#443 2003-12-31 02:06:15) Post Reply |
|
PureGrain
|
Here is week 7:
Working URL: http://members.lycos.co.uk/xko...on7/lesson7.php Redirect:http://members.lycos.co.uk/xkoremaster/lesson7/redirect.php Thanks for the redirect idea Quik :D |
(#444 2003-12-31 02:07:10) Post Reply |
|
PureGrain
|
oops.. did not space between the last url
redirect: http://members.lycos.co.uk/xko...n7/redirect.php Sorry for double post. |
(#449 2004-01-03 16:33:30) Post Reply |
|
Ahkorahil
|
// This code has an error and unfortunately I don't find the mistake so could U help me very little? // Browser tells that error is on the 11th row [if(strlen($ip) < 6)..... ] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> 7. home assignment </TITLE> </HEAD> <BODY> <!-- (basic) TO-DO ASSIGNMENT: Write a script to print the IP address if a surfer comes from a bookmark or type-in and show their browser type, and if the person comes from YOUR domain then print a clickable url. --> <?php $minudomeen= "http://www.zone.ee/test003/php.php3"; if(eregi("minudomeen", $http_referer)){ if(strlen($ip) < 6) OR (strlen($ip) > 15) { print("All was correct!"); } else { print("I don't think that you have such an IP address"); } } else { print("GO to back to the shadow!") } ?> <form method = "post" action = "php.php3"> <input type = "hidden" value = "k" name = "action"><BR><BR><BR> Your IP plz: <center><font colour = "#669933"><input type= "text" name = "ip" size = "30"></font></center> </form> </BODY> </HTML> |
(#451 2004-01-04 06:43:54) Post Reply |
|
Quicksaver
|
ahkorahil: first, why did you add the hidden value if you're not using it??
anyways, the problem with that line is that you shouldnt close the parenthises unless its the end of the if() statement, like so: if(strlen($ip) < 6 OR strlen($ip) > 15) { second, you missed a ; in the end of the print() command, just after that if :) |
(#453 2004-01-05 13:29:32) Post Reply |
|
Ahkorahil
|
<HTML>
<HEAD> <TITLE> 7. assignment</TITLE> </HEAD> <BODY> <?php $mydomain = "http://www.neti.ee"; if(eregi("$mydomain",$http_referer)) { print("<a href=\$mydomain\">NETI</a>"); }else{ print("Your IP address is: $REMOTE_ADDR <br> And your browser is: $HTTP_USER_AGENT"); } ?> </BODY> </HTML> // :P I should read assignments more careful, btw tnx to Quicksaver again :D |
(#718 2004-10-25 14:09:49) Post Reply |
|
lestat
|
This is going well. I did NOT look at this forum 1 time :-)
Working URL: http://www.timslan.com/scripts...k7/wk7basic.php
<pre> </pre> <br> <iframe src='wk7basicsrc.php' width='100%' height='300'></iframe> <br> <a href='../index.html'>BACK</a> </body> </html> |
(#738 2004-11-12 17:48:27) Post Reply |
|
Viat
|
Hey - I'm having a weird problem with HTTP_REFERER.
give me an error message like Notice: Undefined index: HTTP_REFERER in phptry.php on line 2. Ideas anyone? |
(#783 2005-03-06 11:01:15) Post Reply |
|
zman
|
My basic assignment #7"
|
(#831 2005-06-12 09:38:59) Post Reply |
|
vegyta2004
|
My week 7 assignment:
<? //week 7 basic assignment echo"hello","<br>"; if($HTTP_REFERER=="") {echo"you are not coming from my domain or you are using a bookmark";} elseif($HTTP_REFERER=="http://www.vegyta.3x.ro") {ECHO"welcome:","http://www.vegyta.3x.ro";} else{echo"YOUR IP ADRESS IS:","$REMOTE_ADDR","<br>"; echo"YOUR BROWSER TYPE IS:"$HTTP_USER_AGENT";} ?> |
(#832 2005-06-13 09:36:16) Post Reply |
|
vegyta2004
|
MY assignment reviewed |
(#833 2005-06-13 09:36:42) Post Reply |
|
vegyta2004
|
MY assignment reviewed
<? //week 7 basic assignment echo"hello","<br>"; if($HTTP_REFERER=="") {echo"YOUR IP ADRESS IS:","$REMOTE_ADDR","<br>"; echo"YOUR BROWSER TYPE IS:","$HTTP_USER_AGENT";} elseif($HTTP_REFERER=="http://www.vegyta.3x.ro") {ECHO"welcome:","http://www.vegyta.3x.ro";} ?> |
(#917 2005-12-31 02:42:58) Post Reply |
|
Dylan
|
http://www.algore.org/~admin/week7.php
|
(#971 2006-03-20 22:10:54) Post Reply |
|
Russell
|
i think that $HTTP_REFERER does not = http://www.yourdomain.com or even www.yourdomain.com, but rather www.yourdomain.com/pagename.php. and !$HTTP_REFERER only prevents bookmarkers and type-ins from accessing the page and allows other domains. because coming from another domain doesnt leave it blank.
so... heres what i came up with. if this is not correct please let me know
this allows http://mydomain.com and http://www.mydomain but doesnt allow any other domain or bookmarkers and type-ins. |
(#972 2006-03-20 22:34:40) Post Reply |
|
Russell
|
sorry, was so excited that i figured it out i didnt take the time to make it 100% (or my version of 100% anyways). and i dont have any non-adult domains so i wont be posting any working urls for now.
thanks rl |
(#1000 2006-05-26 12:01:24) Post Reply |
|
Andrius2a
|
<html>
<head> <title>7 week Assignment</title> </head> <body> <?php //Geting domain value $domain = 'http://$SERVER_NAME'; //Checking and access if(eregi($domain, $HTTP_REFERER)) { echo ("<a href='http://www.google.com'> www.google.com</a>"); } else { echo ("You are not from my domain, your IP is: <b>".$_SERVER['REMOTE_ADDR']."</b></br>"); echo ("And your are using: <b>".$_SERVER['HTTP_USER_AGENT']."</b>");} ?> |
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission