Current location: Hot Scripts Forums » Programming Languages » PHP » Needed to modify a Hotmail Address Book Importer


Needed to modify a Hotmail Address Book Importer

Closed Thread
  #1 (permalink)  
Old 03-23-06, 10:43 AM
FireStorm~ FireStorm~ is offline
New Member
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Needed to modify a Hotmail Address Book Importer

Hello ,
I am not very good at PHP , i have a Hotmail Address Book Importer , this script can retrieve all contacts from hotmail when someone puts his login details ..

I would like some help to make a modification in the script , like making the script send an email to all the contacts retrieved .. The script will then function like the invite script in myspace or hi5 etc

If anyone can help me , plz reply here or PM me .

thx

Index.php
PHP Code:

*/

set_time_limit(600);///Set time limit for script
error_reporting(0);
if(!function_exists('curl_init'))
{
echo ("CURL Library is not installed. Please install it to let this application execute properly.");
exit();
}
if(isset($user_id))
{

include("includes/"."$type.php");

}
ob_implicit_flush();
?>
<html>
<head>
<title>Hotmail/Yahoo/Gmail Address Book</title>
<script language="JavaScript" type="text/JavaScript">
<!--

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

//-->

<!-- Begin

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.tdbcolor {
    background-color: #cccccc;
}
.bordcol {
    border:1px solid black;
}
.style3 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">
  <br>
  <table width="46%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#F2F1F0">
    <tr>
      <td width="100%"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
          <tr align="center" bgcolor="#99FFFF">
            <td colspan="2"><font color="#006699" size="2" face="Arial, Helvetica, sans-serif"><strong>Grab
              Address Book</strong></font></td>
          </tr>
          <tr>
            <td width="27%" align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">User id:</font></td>
            <td width="73%"><input name="user_id" type="text" id="User Id" value="<?=!isset($user_id) ? "":$user_id?>" size="20">              <span class="style3">@</span>              <select name="type" id="type">
              <option value="hotmail" <?=($type=='hotmail') ? "selected":""?>>hotmail.com</option>
              <option value="yahoo" <?=($type=='yahoo') ? "selected":""?>>yahoo.com</option>
              <option value="gmail" <?=($type=='gmail') ? "selected":""?>>gmail.com</option>

              </select></td>
          </tr>
          <tr>
            <td align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">              Password:</font></td>
            <td><input name="password" type="password" id="Password" size="20"></td>
          </tr>
          <tr align="center" bgcolor="#99FFFF">
            <td colspan="2"><input name="Submit" type="submit" onClick="MM_validateForm('User Id','','R','Password','','R');return document.MM_returnValue" value="Get address book">
              <input type="reset" name="Submit2" value="Reset"></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form></div>

<br>
<?php
if(isset($_POST['user_id']))
{
    
$name_array=array();///global variable contains all name found in address book
    /// $logged_in=true on successfull login
   
$logged_in=login($_POST['user_id']."@".$_POST['type'].".com",$_POST['password']);




if(
$logged_in)
{
    
///Get address page
    
$str=get_address_page();
//Parse Address page and get all name and address in name_array and contact_array
    
parser($str);
?>
<script language="javascript">
function submitter2(which){

if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="chk_emai") {

if(which.checkboxed.checked==false)
tempobj.checked=false;
else
tempobj.checked=true;

                                              }
}
}

}
function validation(which)
{

selected=0;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="chk_emai") {

if(tempobj.checked==true)

  return true;


                                              }
                            }
                    }
if(selected==0)
  {
  alert('Select atleast one email address to send invitation.');
  return false;
  }
}
        </script>
<form name="form2" method="post" action="index2.php" onsubmit="javascript:return validation(this)">
<table width="68%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#F2F1F0">
  <tr>
    <td width="100%"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
        <tr align="center" bgcolor="#99FFFF">
          <td colspan="3"><font color="#006699" size="2" face="Arial, Helvetica, sans-serif"><strong><?=ucwords($type)?>
            Address Book<br>
            </strong> <font face="Verdana, Arial, Helvetica, sans-serif">
            <input name="from" type="hidden" id="from" value="<?=$_POST['user_id']."@".$_POST['type'].".com"?>">
            Total
            Address found
            <?=($type=='hotmail' && sizeof($name_array)!=0) ? (sizeof($name_array)-1):sizeof($name_array)?>
            </font></font></td>
        </tr>
        <tr align="center" bgcolor="#99CCFF">
          <td width="6%" align="left" bgcolor="#99CCFF" style="PADDING-LEFT: 12px"><input name="checkboxed" type="checkbox" id="checkboxed" value="checkbox" checked onClick="submitter2(document.form2)"></td>
          <td width="43%" align="left" style="PADDING-LEFT: 12px"><font color="#000066" size="2" face="Arial, Helvetica, sans-serif"><strong>Display
            Name </strong></font></td>
          <td width="51%" align="left" bgcolor="#99CCFF" style="PADDING-LEFT: 12px"><font color="#000066" size="2" face="Arial, Helvetica, sans-serif"><strong>Email
            ID</strong></font></td>
        </tr>
        <?
foreach($name_array as $key=>$val)
{
    if(
$type=='hotmail' && $key==0)
    continue;
    if(
$type=='hotmail')
    if(!
ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email_array[$key]))
    
$email_array[$key]=$emarray[($key-1)];

?>
        <tr>
          <td align="left" style="PADDING-LEFT: 12px">
<?if(!ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email_array[$key])){?>
          <input name="xx" type="checkbox" id="members2" value="<?=$email_array[$key]?>"  disabled="true" >
<?
}
else
{
?>
          <input name="chk_email[]" type="checkbox" id="members2" value="<?=$email_array[$key]?>" checked >
<?
}
?>
          </td>
          <td align="left" style="PADDING-LEFT: 12px"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
            <?=($val=="") ? "NA":$val?>
            </font></td>
          <td style="PADDING-LEFT: 12px"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
            <?=$email_array[$key]?>
            </font></td>
        </tr>
        <?
}
$size=($type=='hotmail' && sizeof($name_array)!=0) ? (sizeof($name_array)-1):sizeof($name_array);
if(
$size==0)
{
?>
        <tr align="center">
          <td colspan="3" style="PADDING-LEFT: 12px"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
            <em>No Address found.</em></font></td>
        </tr>
        <?
}
?>
        <tr align="center" bgcolor="#99FFFF">
          <td colspan="3">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
<div align="center"><br>
  <br>
</div>
</form>
<?
}
else
echo 
"<p align=\"center\"><b><font face=\"Arial\" color=\"#FF0000\">Invalid login.</font></b></p>";
}

?>
</body>
</html>
Includes / hotmail.php
-->
PHP Code:

<?

//---------**** Functions required to run index.php****------------//
mt_srand((double)microtime()*100000);
$test=mt_rand(65,90);
$test3=mt_rand(97,122);
$test1=mt_rand(65,90);
$test4=mt_rand(48,57);
$test5=mt_rand(48,57);
$test6=mt_rand(65,90);
$test7=mt_rand(97,122);
$test8=mt_rand(97,122);
$ram1=chr($test);
$ram2=chr($test3);
$ram3=chr($test4);
$ram4=chr($test1);
$ram5=chr($test5);
$ram6=chr($test6);
$ram7=chr($test7);
$ram8=chr($test8);
$fname="$ram1$ram2$ram3$ram4$ram5"///Random string for unique file name

function login($hotmail_user_id,$hotmail_user_password)
{

    global 
$cookie_file_path,$acurmbox,$str,$fname;
    
$file="./$fname".".txt";
    @
unlink($file);

    
// 1-Get First Login Page http://www.hotmail.com
    // This page will set some cookies and later we will use these cookies to access inside pages .

    
$cookie_file_path ="./temp/".$fname.".txt";  // Please set your cookie domain
    
$LOGINURL "http://www.hotmail.com";
    
$result get_curl($LOGINURL,$cookie_file_path,"","");
    
$action=substr($result,strpos($result,'action="')+strlen("action=\""));
    
$action1=substr($action,0,strpos($action,'"'));
        
$value=substr($result,strpos($result,'value="')+strlen("value=\""));
    
$value=substr($value,0,strpos($value,'"'));
    
    
    
$POSTFIELDS 'mspppostint='.urlencode($value);

    
$resultget_curl($action1,$cookie_file_path,$POSTFIELDS,"http://www.hotmail.com");        
        


    
$action=substr($result,strpos($result,'action="')+strlen("action=\""));
    
$action=substr($action,0,strpos($action,'"'));
    
$value=substr($result,strpos($result,'id="i0327" value="')+strlen("id=\"i0327\" value=\""));
    
$value=substr($value,0,strpos($value,'"'));
  
$RsPass = (get_magic_quotes_gpc()) ? stripslashes($hotmail_user_password) : $hotmail_user_password;
  
$RsLogin = (get_magic_quotes_gpc()) ? stripslashes($hotmail_user_id) : $hotmail_user_id;
    
$POSTFIELDS "PPFT=$value&PPSX=Passport&PwdPad=&LoginOptions=3&notinframe=1&SI=    Sign In    &passwd=".urlencode($RsPass)."&login=".urlencode($RsLogin);

    
$reffer $action1;

    
// 2- Post Login Data to Page https://login.passport.com/ppsecure/post.srf.... to login to hotmail
    
$strget_curl($action,$cookie_file_path,$POSTFIELDS,$reffer);    
//echo htmlspecialchars($str);
    
$str1=substr($str,strpos($str,"http://"));
    
$str2=substr($str1,0,strpos($str1,"\");"));

    
$result get_curl($str2,$cookie_file_path,"","");
    
//write_to_file($str);
    
if(strpos($result,"curmbox")===false)

    return 
false;
//Get 'curmbox' and 'a' variable's value from a page's source code
///and embed those value at the end of a url
    
$str1=substr($result,strpos($result,"curmbox"));
    
$str1=$acurmbox=substr($str1,0,strpos($str1,"\""));
    if(
$str1=="")
    
$invalid=true;

    if(isset(
$invalid))
    return 
false;
    else
    return 
true;
}
function 
get_address_page()
{    

    global 
$cookie_file_path,$acurmbox,$prarray,$emarray;
    
$additional_parameter=$acurmbox;
    
///Address page url    
    
$str="http://by16fd.bay16.hotmail.msn.com/cgi-bin/addresses?&$additional_parameter";
    
//Address page's print preview page url
    
$prview="http://by16fd.bay16.hotmail.msn.com/cgi-bin/addresses?&$additional_parameter&strUsrFltr=&strUsrView=&strAlphNav=&PrintView=1";
   
     
///Get the print preview page and save Name and password in temp array
    
$prvstr=get_curl($prview,$cookie_file_path,"","");
    
$tbst='<table border=0 cellpadding=0 cellspacing=0 width=100% class="Contact">';
    
$table=substr($prvstr,strpos($prvstr,$tbst));
    
$table=substr($table,0,strpos($table,"</table>"));
    
//echo $table;
    
$rows=explode("<tr>",$table);
    
//echo sizeof($rows);
    
$emarray=array();
    
$nmarray=array();
    for(
$i=2;$i<sizeof($rows);$i++)
    {
    
$colums=explode("</td>",$rows[$i]);
    
$emarray[]=strip_tags(substr($colums[1],0,strpos($colums[1],'</span>')));
    }
    
//Get the address page and return contents of address page
    
$str=get_curl($str,$cookie_file_path,"","");
    
    return 
$str;
}

function 
get_curl($url,$cookie_path="",$postfileds="",$referrer="")
{
    
$agent "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
    
$ch curl_init(); 
    
curl_setopt($chCURLOPT_URL,$url);
    
curl_setopt($chCURLOPT_USERAGENT$agent);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1); 
    
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
    
curl_setopt($chCURLOPT_SSL_VERIFYPEERFALSE);
    if(
$referrer!="")    
        
curl_setopt($chCURLOPT_REFERER$referrer);
        
    if(
$cookie_path!="")
        {
            
curl_setopt($chCURLOPT_COOKIEFILE$cookie_path);
            
curl_setopt($chCURLOPT_COOKIEJAR$cookie_path);
        }
    if(
$postfileds!="")
        {
        
curl_setopt($chCURLOPT_POST1); 
        
curl_setopt($chCURLOPT_POSTFIELDS,$postfileds); 
        }

    
$result curl_exec ($ch);
    
curl_close ($ch);
    
    return 
$result;
}
function 
parser($str)
{
    global 
$id_str,$id_array,$name_array,$email_array,$phone_array,$call_more,$call_array,$cookie_file_path;
    
///get the table body which containing email address and names
    
$a='<table border=0 cellpadding=0 cellspacing=0 width=100% class="EE" id="ListTable">';
    
$b="<td colspan=5>&nbsp;</td>";
    
$str=substr($str,strpos($str,$a));
    
$str=substr($str,0,strpos($str,$b)+strlen($b));

    
///Parse the html data and bring out name and addresses
    
$rows=explode("</tr>",$str);
    for(
$i=2;$i<sizeof($rows);$i++)
     {
       
$tr_name=substr($rows[$i],strlen("<tr name='"));
       
$tr_name=substr($tr_name,0,strpos($tr_name,"'"));
        
$rows[$i]=substr($rows[$i],strpos("$rows[$i]","<td")-1);
        
        
        
$colums=explode("</td>",$rows[$i]);
        
$call_more=false;
        
            for(
$j=0;$j<sizeof($colums);$j++)
            {
            if(
sizeof($colums)==6)
             {

                switch(
$j)
                 {
                    case 
0:
                    
$id_str=substr($colums[$j],strpos($colums[$j],"name=")+6);
                    
$id_str=$id_array[]=substr($id_str,0,strpos($id_str,"\""));
                    break;
                
                
                    case 
2:
                    
$name_str=substr($colums[$j],strpos($colums[$j],"return false;\">")+strlen("return false;\">"));
                    
$name_str=$name_array[]=substr($name_str,0,strpos($name_str,"</a>"));
                    break;
                
                    case 
3:
                    
$email_str=substr($colums[$j],strpos($colums[$j],"return false;\">")+strlen("return false;\">"));
                    
$email_str=substr($email_str,0,strpos($email_str,"</a>"));
                    if(!
ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email_str))
                        
$email_array[]=$tr_name;
                    else
                        
$email_array[]=$email_str;
                    if(
strpos($colums[$j],"more"))
                    
$call_more=true;
                    break;
                
                    
                
                    default:
                    break;
                    
                
                 }
                 
                }
                else
                {
                
                switch(
$j)
                 {
                    case 
0:
                    
$id_str=substr($colums[$j],strpos($colums[$j],"name=")+6);
                    
$id_str=$id_array[]=substr($id_str,0,strpos($id_str,"\""));
                    break;
                
                
                    case 
3:
                    
$name_str=substr($colums[$j],strpos($colums[$j],"return false;\">")+strlen("return false;\">"));
                    
$name_str=$name_array[]=substr($name_str,0,strpos($name_str,"</a>"));
                    break;
                
                    case 
4:
                    
$email_str=substr($colums[$j],strpos($colums[$j],"return false;\">")+strlen("return false;\">"));

                    
$email_str=substr($email_str,0,strpos($email_str,"</a>"));
                    if(!
ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email_str))
                        
$email_array[]=$tr_name;
                    else
                        
$email_array[]=$email_str;
                        
                    if(
strpos($colums[$j],"more"))
                    
$call_more=true;
                    break;
                



                
                    default:
                    break;
                    
                
                 }
                
                }
            }
    }
@
unlink($cookie_file_path);
}


?>

Last edited by FireStorm~; 03-23-06 at 10:56 AM.
  #2 (permalink)  
Old 04-25-06, 12:13 AM
robinabac robinabac is offline
New Member
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
i can help

i can hepl u . i have all that code contact with me robinabac@yahoo.com
  #3 (permalink)  
Old 11-03-06, 08:54 AM
dsfasdfasd3w4534dfgdsf dsfasdfasd3w4534dfgdsf is offline
New Member
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Help me

Could you please send it to me, I have sent you many emails but there was no reply from you, I realy need it, please could you send it to my email.
passworld1@hotmail.com

Best Regards,
  #4 (permalink)  
Old 02-11-11, 04:18 AM
manoj dharani manoj dharani is offline
New Member
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
hello dear i want this code...can u please send me manoj_dharani2005@hotmail.com
  #5 (permalink)  
Old 02-11-11, 11:26 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
I dont think the OP is still interested in the script since the topic is nearly 6 years old...


Topic closed
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Closed Thread

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom php script needed alley Job Offers & Assistance 5 06-30-10 02:14 AM
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 10:17 AM
Artist pages script needed SR_Ben Script Requests 0 07-09-04 02:30 PM
New script needed PoliticalGateway Script Requests 0 09-22-03 12:57 PM


All times are GMT -5. The time now is 07:05 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.