La cuestion es que tengo un script en PHP, el cual muestra los contactos de hotmail de aquel usuario que introduzca su login y pass de hotmail... (Un Hotmail Contacts importer)
Queria probarlo, ya que con varios amigos funciona, pero con 2 personas no funciono...
demoform.php:
Código PHP:
<table>
<tr>
<td><a href="index.php"><img src="images/logo_hotmail.gif" width="88" height="24" border="0" /></a></td>
</tr>
</table>
<p>Introduce tu nombre de usuario y contraseña de hotmail </p>
<form action="index.php" method="post">
<table width="700">
<tr>
<td width="62">Usuario</td>
<td width="626"><input type="text" name="username" />
@hotmail.com</td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input name="submit" type="submit" value="Enviar" /></td>
</tr>
</table>
<br>
<br>
</form>
Código PHP:
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
-->
</style><?php
#Copyright Free
$disclaimer = "";
if ($_POST)
{
$login = $_POST['username'];
$password = $_POST['password'];
#you should call get_contacts like this:
$resultarray = get_contacts($login, $password);
#if contacts were retreived successfully:
if(is_array($resultarray))
{
#the first array_shift of the result will give you the names in an array
$names = array_shift($resultarray);
#the second array_shift of the result will give you the emails
$emails = array_shift($resultarray);
$maxin = count($names);
echo '<table border="1">';
$mails_luis = "";
for ($i=0; $i<$maxin; ++$i)
{
$mails_luis .= $emails[$i].'; ';
echo '<tr><td>'.($i+1).'</td><td>'.$names[$i].'</td><td>'.$emails[$i].'</td></tr>';
}
echo "</table>";
}
}
else
{
$action = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . ((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']!="")? "?$_SERVER[QUERY_STRING]" : "");
$formname = "Hotmail";
include("demoform.php");
}
function get_contacts($login, $password)
{
global $formname;
global $formheading;
global $disclaimer;
global $usrtxt;
if(!eregi("@", $login))
{
$login .= "@hotmail.com";
}
if (trim($login)=="" || trim($password)=="")
{
$action = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . ((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']!="")? "?$_SERVER[QUERY_STRING]" : ""); $disclaimer = "<br><b style=\"color:red\">Enter Your Username and Password</b><br>";
$formname = "Hotmail";
include("demoform.php");
return 0;
}
$url = $_SERVER['PHP_SELF'];
$querystr = (isset($_SERVER['QUERY_STRING'])?"?" . $_SERVER['QUERY_STRING']:"");
$url .= $querystr;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://svetlozar.net/nukemodule/hotmaildemo.php");
curl_setopt($ch, CURLOPT_REFERER, $_SERVER['HTTP_HOST'] . $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "email=$login&password=$password");
$html = curl_exec($ch);
if(eregi("###invalid###", $html))
{
$action = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . ((isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']!="")? "?$_SERVER[QUERY_STRING]" : ""); $disclaimer = "<br><b style=\"color:red\">Invalid Login</b><br>";
$formname = "Hotmail";
include("demoform.php");
return 0;
}
else if(eregi("###warning###", $html))
{
echo $html;
return 0;
}
$html = explode("\n", $html);
if (count($html) == 2)
{
$names = explode("#", $html[0]);
$emails = explode("#", $html[1]);
}
return array($names, $emails);
}
echo $emails[$i].'; ';
?>