Current Path : /var/www/html/
Upload File :
Current File : /var/www/html/connected2.php

<?php session_start(); ?>
<?php $userid=$_SESSION['userid'];
if(isset($_POST['Send_invite']))
{
	include_once "connection/connection.php";
		/******/
	if(count($_POST['dbemail'])>0)
	  {
	     for($ei=0;$ei<count($_POST['dbemail']);$ei++){
			 $demail=$_POST['dbemail'][$ei];
		   $noo=mysql_num_rows(mysql_query("SELECT * FROM `invited_emailids` WHERE `emailid`='".$demail."'"));	
		    if($noo==0){
				mysql_query("INSERT INTO `invited_emailids` SET `emailid`='".$demail."'");
				}
		 }
		}
	/***********/
	$noemails=count($_POST['check']);
	 $emailids=array();
	if($noemails>0)
	   {
		 for($i=0; $i<$noemails; $i++)
		 {
		 array_push($emailids,$_POST['check'][$i]);
		  	$fbid=$_POST['check'][$i];
		  $check_user=mysql_num_rows(mysql_query("SELECT * FROM `hk_invited_friends` WHERE `userid`='".$userid."' AND `email`='".$fbid."' AND `source`='Yahoo'"));
			if($check_user==0){
			  mysql_query("INSERT INTO `hk_invited_friends` SET `userid`='".$userid."',`email`='".$fbid."', `source`='Yahoo', `status`='1'"); 
			  mysql_query("UPDATE `social_userbasicinfo` SET `ivitation_points`=(ivitation_points+1) WHERE `user_id`='".$userid."'");
			          }
		  }
		 }
		$html='<table width="600" style="padding:0px 25px;">
<tr><td><span style="float:none; margin-left:100px;"><img src="http://365hops.com/images/blue_logo365.png" height="91" width="200" /></span><br/><br/>
<p style="font-size:14px; font-family:arial;  text-align:justify;">	
'.ucwords($_SESSION['username']).' has invited you to join <a href="http://www.365hops.com/">365hops.com</a>.</p>		
<p style="font-size:12px; font-family:arial; text-align:justify;">"365hops is an interest and location based platform for sporty and adventurous people. 365hops connects you to the adventure and sports activities happening around you in your interests. Now always be connected to Trekking, Camping, Rafting, Football etc events and the people around you. Select your interest zones, provide your location information and get connected to activites now"</p>		
</td></tr>
</td></tr>
<tr  ><td >
<span style="float:left; "><img src="http://www.365hops.com/searching_files/timthumb.php?src=http://www.365hops.com/social/event_gallery/1400133590.devanarayanadurga.jpg&h=90&w=90&zc=1" /></span>
<span style="float:left; "><img src="http://www.365hops.com/searching_files/timthumb.php?src=http://www.365hops.com/social/event_gallery/1403940731.33.jpg&h=90&w=90&zc=1" /></span>
<span style="float:left; "><img src="http://www.365hops.com/searching_files/timthumb.php?src=http://www.365hops.com/social/event_gallery/1402988879.image_772.jpg&h=90&w=90&zc=1" /></span>
<span style="float:left; "><img src="http://www.365hops.com/searching_files/timthumb.php?src=http://www.365hops.com/social/event_gallery/1400071898.campingramanagaram.jpg&h=90&w=90&zc=1" /></span>
<span style="float:left; "><img src="http://www.365hops.com/searching_files/timthumb.php?src=http://www.365hops.com/social/event_gallery/1405056116.1354603217.JPG&h=90&w=90&zc=1" /></span>
<span style="float:left; "><img src="http://www.365hops.com/searching_files/timthumb.php?src=http://www.365hops.com/social/match_gallery/1403345998_0.jpg&h=90&w=90&zc=1" /></span>

</td>
</tr>
<tr  bgcolor="#999999"><td height="50">
<span style="color:#FFF;  text-align:justify;">Now join and invite your friends to get equivalent discounts on all the events on 365hops.</span></p>
</td></tr>
<tr><td>
<p style="font-size:14px; font-family:arial">
  Hope to see you around :-)
  <br/>
</p>
Thank you,<br/>
<strong>Team 365Hops</strong>
</td></tr>
</table>';

    //
	$cc_arr='';
	$bcc_arr='';
	$text='';
	$subject='365Hops.com invitation';
	send_email_api_invite_out($emailids,$cc_arr,$bcc_arr,$subject,$text,$html);
	}
function send_email_api_invite_out($to_arr,$cc_arr,$bcc_arr,$subject,$text,$html)
     {
	 require_once('php-aws-ses-master/src/SimpleEmailService.php');
     require_once('php-aws-ses-master/src/SimpleEmailServiceMessage.php');
     require_once('php-aws-ses-master/src/SimpleEmailServiceRequest.php');
	 // Creating object of SES//
	 $ses = new SimpleEmailService("AKIAIUSJOX6XIL2GEKXQ", "msBHSfYDY6rdvIQ+RmVJne7h0yjhD0JbtCjCUjtX");
	 // Creat Object of SES Message//
	 $m = new SimpleEmailServiceMessage();
	   if($to_arr!=''){
	      $adresses=implode($to_arr);
	      $m->addTo($to_arr);
	     }
	 if($cc_arr!=''){
	    $m->addCC($cc_arr);
      // $m->addCC(array('kelly@example.com', 'ryan@example.com'));
	 }
	 if($bcc_arr!=''){
	  $m->addBCC($bcc_arr);
	 }
     $m->setFrom('info@365hops.com');
     $m->setSubject($subject);
	 $m->setMessageFromString($text, $html);
     $ses->sendEmail($m);
   	}	
?>
<?php

include_once ('config.php');
require_once ('Yahoo.inc');
$session = YahooSession::requireSession($consumer_key,$consumer_secret,$app_id);


if ($_GET['flag']=='sendMail'){
	foreach($_POST['check'] as $email){
		$to_mail = $email;
		//SEND YOUR MAIL	
	}
}	


?>
<?php include_once('social/__includedFiles/header_top_files_out.php');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Adventure in india </title>
<meta name="description" content="Wide Range events available in 365 Hops. Book your event now to have fun of lifetime." />
<meta name="keywords" content="adventure, event in india, search event 365hops " />
<meta name="robots" content="index, follow"/>
<link rel="canonical" href="http://www.365hops.com/social/event_search.php" />
<link rel="stylesheet" type="text/css" href="responsive.css" />
<meta name="viewport" content="width=device-width initial-scale=1.0 maximum-scale=1.0 user-scalable=yes" />
<?php include_once('social/__includedFiles/dashboard_header_out.php');?>
<?php include_once('social/__includedFiles/dashboard_menu_out.php');?>
<!-- contact page html -->
<script type='text/javascript'>
	function toggleAll(element) 
	{
	var form = document.forms.form1, z = 0;
	for(z=0; z<form.length;z++)
		{
		if(form[z].type == 'checkbox')
			form[z].checked = element.checked;
	   	}
	}
</script>
<div class="clear"></div>
<div class="kafe_detail">
<div  style="background:none !important;">
<div class="kafe_contact" >
  <div class="kafeconthd">
      <h2>Invite Friends</h2>     
  </div>
  
  <div class="abouttcxt">
  <form method="POST" name="form1" action="?flag=sendMail" enctype="multipart/form-data">
<div align="center">

		<?php  dashboard::establishConnection(); 
		$obj_social=new Social;
			if($_GET['msg']==""){
		?>
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td width="100" align="center" bgcolor="#041338" height="28">
				<input type='checkbox' onChange='toggleAll(this)' name='toggle_all' title='Select/Deselect all' checked></td>
				<td bgcolor="#041338" height="28" align="left"><font color="#FFFFFF"><b>Email</b></font></td>
			</tr>
			<?php 
				if (is_object($session)){
					$user = $session->getSessionedUser();
					$profile = $user->getProfile();
					$name = $profile->nickname; // Getting user name
					$guid = $profile->guid; // Getting Yahoo ID
					$contacts=$user->getContacts()->contacts;
				   echo '<pre/>';
				    //print_r($contacts);
				//	echo "Hi! ".$name."<br />";
					$emails_array=array();
					for ($i=0,$k=0;$i<count($contacts->contact);$i++){
						for($j=0;$j<count($contacts->contact[$i]->fields);$j++){
							$type=$contacts->contact[$i]->fields[$j]->type;
							if($type=='name'){
							  $name=$contacts->contact[$i]->fields[$j]->value->givenName;
							 }
							 if($type=='email')
							     {
								 $email=$contacts->contact[$i]->fields[$j]->value;
								 array_push($emails_array,$email);
								 }else{
									 }
					/*		
						//	echo $type.'-'.$name.'-'. $email;
					        $url_data = $contacts->contact[$i]->fields[$j]->uri;
							$url_pie=explode("/user/", $url_data);
							$url_end=substr($url_pie[1], stripos($url_pie[1], "/")+1);
							$data=explode("/", $url_end);
								if ($data[2]==="email"){
									$email_fr[$k]=$user->getDatafrom($url_end)->email->value;
									$k++;
								}*/
							
						     }
							
					}
					//print_r($emails_array); echo '<br/>';
					///echo "You have ".$k." contacts.<br />";
				  if(count($emails_array)>0){
					$emails_array2=array_unique($emails_array);
					foreach($emails_array2 as $usereamail){
					//for($i=0;$i<$k;$i++){			
$no_em_u=mysql_num_rows(mysql_query("SELECT * FROM `hk_invited_friends` WHERE `userid`='".$userid."' AND `email`='".$usereamail."' AND `source`='Yahoo'"));						

if($no_em_u==0){
$email_stat=$obj_social->checkforuserexistence($usereamail);

if($email_stat==0){	
					?>

			<tr>
				<td width="100" align="center" height="26">
				<input name='check[]' value='<?php echo $usereamail; ?>' type='checkbox' checked>
                 <input type="hidden" name="dbemail[]" value="<?php echo $usereamail; ?>" />
                </td>
				<td height="26" align="left"><?php echo $usereamail; ?></td>
			</tr>
			<?php  } }
				//} 
				}}else{ print "No Email Found!"; }
					}
					else
					{
					//header("Location :".$re_url);
					
					print "No Email Found!";
					}
			?>
			<tr>
				<td width="100" align="center" style="padding-top: 10px">&nbsp;</td>
				<td style="padding-top: 10px" align="left"><input type="submit" class="btn btn-yellow" value="Invite Friends" name="Send_invite"> </td>
			</tr>
		</table>
		<?php
		}
		?>
	
</div>
</form>
</div>
  <!--<div class="abotimg"><img src="images/about.png" width="211" height="553" alt="aboutus " /></div>--->
  
  <div class="clear"></div>
</div>
 
    </div></div><div class="clear"></div>
<!--contact page html end -->
<?php include_once('social/__includedFiles/dashboard_footer.php');?>

,