Hi guys!

I have made some little PHP code that check the owner of a photo on Facebook that the user inputs.
I'm not sure that it works, but I can't see it a reason why it shouldn't haha. I have no option to run it at the moment, so feel free to test it and fix it in case it doesn't work (will be mainly dumb mistakes ).
I commented everything, so I hope it helps someone who tries to study PHP. It's VERY basic, but cute.

Here is the HTML front page:
PHP Code:
<html>
<
body>

<
form action="data.php" method="post">
http://www.<input type="text" name="address">
<input type="submit">
</
form>

</
body>
</
html
And here is the data.php
PHP Code:
<html>
<body>
<?php
$address 
$_POST["address"]; //getting the address
$start strrpos($address,"."); //last dot in the address, the ID starts there
$start $start++; //we don't need the dot, so we are moving forward
if(!strpos($address,"&type=1&theater")) //sometimes the user will put it too, so if he didn't do it (and the output will be FALSE), this will run
{
    
$id substr($address,$start); //the substring starts where the $start is, and goes until the end
}
else 
//in case he didn't put the whole type and theater thing
{
    
$end strpos($address,"&type=1&theater"); //this will be the end of the id
    
$id substr($address,$start,$end $start); //starts in $start and the length equals the position of the end minus the position of the start
}
$url "http://www.facebook.com/profile.php?id=" $id//putting up the url
$str file_get_contents($url); //getting the page source
$name_start strpos($str,'<title id="pageTitle">'); //name starts here
$name_end strpos($str,'</title>'); //name ends here
$name substr($str,$name_start,$name_end-$name_start); //this will be the name
$name str_replace('<title id="pageTitle">',"",$name); //we don't need the tag in the name, so we are deleting it
?>
The photo belongs to the user/page named <?php echo $name?>.<br>
The url to his profile is <?php echo $url?>
</body>
</html>