PHP ver gevorderde |
|
Hoi ik gebruik dit script om hotmailadressen op te halen:
<?php
$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>";
for ($i=0; $i<$maxin; ++$i)
{
$emails[$i] = trim($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);
}
?>
<?php $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: { #the first array_shift of the result will give you the names in an array #the second array_shift of the result will give you the emails for ($i=0; $i<$maxin; ++$i) { $emails[$i] = trim($emails[$i]); echo "<tr><td>" . ($i+1) . "</td><td>$names[$i]</td><td>$emails[$i]</td></tr>"; } } } 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) { { $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)) { return 0; } { } return array($names, $emails); } ?>
Alleen nu zet die het resultaat in 1 lange kolom met een cijfertje ervoor.
Hoe zorg ik ervoor dat die ze in een mailform zet en dat als ik op verzenden klik dat die het mailtje NAAR alle opgehaalde adressen stuurd..
|