• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

cms/modules/newsletter/importContacts.php

Go to the documentation of this file.
00001 <?php
00002 if(!defined('__PRAGYAN_CMS'))
00003 { 
00004         header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
00005         echo "<h1>403 Forbidden<h1><h4>You are not authorized to access the page.</h4>";
00006         echo '<hr/>'.$_SERVER['SERVER_SIGNATURE'];
00007         exit(1);
00008 }
00016  /*
00017   *
00018   * This imports the email from pragaynV2_users
00019   * checks if that mail is there in newsletter
00020   * if not then inserts the mail into newsletter.
00021   *
00022   * */
00023  include_once("../../config.inc.php");
00024 include_once("../../common.lib.php");
00025 connect();
00026 
00027 $query="SELECT `user_email` FROM `".MYSQL_DATABASE_PREFIX."users`";
00028 $result=mysql_query($query);
00029 while($temp=mysql_fetch_array($result,MYSQL_NUM))
00030 {
00031 foreach($temp as  $mail)
00032 {
00033 
00034         $query1="SELECT * FROM `newsletter` WHERE `email`='$mail' ";
00035 //      echo $query1."<br>";
00036         $result1=mysql_query($query1);
00037         echo mysql_num_rows($result1).$query1."<br>";
00038 
00039         if(!mysql_num_rows($result1))
00040         {
00041                 $query2="INSERT INTO `newsletter` (`email` ,`sent`)VALUES ('$mail','0')";
00042                 echo $query2."<br>";
00043                 $result2=mysql_query($query2) ;
00044                 if(mysql_affected_rows($result2)>0)echo "$mail inserted into newsletter<br>";
00045                 echo mysql_affected_rows($result2)."<=RES<br>";
00046 
00047 //              echo $query2."<br>";
00048         }
00049 
00050 
00051 }
00052 }
00053 
00054  disconnect();

Generated on Sun Jan 2 2011 04:55:32 for Pragyan CMS by  doxygen 1.7.1