d.jobinraj 0 Newbie Poster
the problem is town and user values is not adding to the database,other than this feilds,other thuings are working down.......
please,give me your suggestions.

//database.php//

<?
/* The Database class is meant to simplify the task of accessing information from the website's database */

include("constants.php");

class MySQLDB    
{
   var $connection;         //The MySQL database connection
   var $num_active_users;   //Number of active users viewing site
   var $num_active_guests;  //Number of active guests viewing site
   var $num_members;        //Number of signed-up users
   /* Note: call getNumMembers() to access $num_members! */

   /* Class constructor */
   function MySQLDB(){

      /* Make connection to database */
      $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
      mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());

      /* Only query database to find out number of members when getNumMembers() is called for
         the first time, until then, default value set */
      $this->num_members = -1;

      if(TRACK_VISITORS){

         /* Calculate number of users at site */
         $this->calcNumActiveUsers();

         /* Calculate number of guests at site */
         $this->calcNumActiveGuests();
      }
   }

   /* confirmUserPass - Checks whether or not the given username is in the database, if so it checks
      if the given password is the same password in the database for that user. If the user doesn't exist
      or if the passwords don't match up, it returns an error code (1 or 2). On success it returns userid */
   function confirmUserPass($username, $password){

      /* Add slashes if necessary (for query) */
      if(!get_magic_quotes_gpc()) {
          $username = addslashes($username);
      } 

      /* Verify that user is in database */
      $q = "SELECT password,userid FROM ".TBL_USERS." WHERE username = '$username'";
      $result = mysql_query($q, $this->connection);
      if(!$result || (mysql_numrows($result) < 1)){
         return 1; //Indicates username failure
      }

      /* Retrieve password from result, strip slashes */
      $dbarray = mysql_fetch_array($result);
      //$dbarray['password'] = stripslashes($dbarray['password']);
      //$password = stripslashes($password);

      /* Validate that password is correct */
      if($password == $dbarray['password']){
         return 0; //Success! Username and password confirmed
      }
      else{
         return 2; //Indicates password failure
      }
   }

   /* confirmUserID - Checks whether or not the given username is in the database, if so it checks if the
      given userid is the same userid in the database for that user. If the user doesn't exist or if the
      userids don't match up, it returns an error code (1 or 2). On success it returns 0 */
   function confirmUserID($username, $userid){

      /* Add slashes if necessary (for query) */
          $username = addslashes($username);

      /* Verify that user is in database */
      $q = "SELECT userid FROM ".TBL_USERS." WHERE username = '$username'";
      $result = mysql_query($q, $this->connection);
      if(!$result || (mysql_numrows($result) < 1)){
         return 1; //Indicates username failure
      }

      /* Retrieve userid from result, strip slashes */
      $dbarray = mysql_fetch_array($result);
      //$dbarray['userid'] = stripslashes($dbarray['userid']);
      //$userid = stripslashes($userid);

      /* Validate that userid is correct */
      if($userid == $dbarray['userid']){
         return 0; //Success! Username and userid confirmed
      }
      else{
         return 2; //Indicates userid invalid
      }
   }

   /* usernameTaken - Returns true if the username has been taken by another user, false otherwise */
   function usernameTaken($username){
      $username = addslashes($username);
      $q = "SELECT username FROM ".TBL_USERS." WHERE username = '$username'";
      $result = mysql_query($q, $this->connection);
      return (mysql_numrows($result) > 0);
   }

   /* usernameTaken - Returns true if the userid has been taken by another user, false otherwise */
   function useridTaken($userid){
      if(!get_magic_quotes_gpc()){
         $userid = addslashes($userid);
      }
      $q = "SELECT userid FROM ".TBL_USERS." WHERE userid = '$userid'";
      $result = mysql_query($q, $this->connection);
      return (mysql_numrows($result) > 0);
   }

   /* usernameBanned - Returns true if the username has been banned by the administrator */
   function usernameBanned($username){
      $username = addslashes($username);
      $q = "SELECT username FROM ".TBL_USERS." WHERE username = '$username' AND banuser = 1";
      $result = mysql_query($q, $this->connection);
      return (mysql_numrows($result) > 0);
   }

   /* addNewUser - Inserts the given user info into the database.
      Appropriate user level is set. Returns true on success, false otherwise */
   function addNewUser($username, $password, $firstname, $lastname, $gender, $dob,
                       $home, $work, $mobile, $fax, $pager, $homeno, $address1, $address2, $address3, 
                       $state, $pincode, $country, $whomeno, $waddress1, $waddress2, $waddress3, 
                       $wcity, $wpincode, $wcountry, $email, $plist , $langflag){
      if(!get_magic_quotes_gpc()){
          $username  = addslashes($username);
          $firstname = addslashes($firstname);
          $lastname  = addslashes($lastname);
          $address1  = addslashes($address1);
          $address2  = addslashes($address2);
          $address3  = addslashes($address3);
          $city     = addslashes($city);
          $country   = addslashes($country);
          $waddress1 = addslashes($waddress1);
          $waddress2 = addslashes($waddress2);
          $waddress3 = addslashes($waddress3);
          $wcity    = addslashes($wcity);
          $wcountry  = addslashes($wcountry);
          $langflag  = addslashes($langflag);


      }   
      $date = getDate();
      foreach($date as $item=>$value) {
           if ($value < 10)
               $date[$item] = "0".$value;
      }
      $time = $date['year']."-".$date['mon']."-".$date['mday']." ".$date['hours'].":".$date['minutes'].":".$date['seconds'];

      /* If admin sign up, give admin user level */
      if(strcasecmp($username, ADMIN_NAME) == 0){
         $ulevel = ADMIN_LEVEL;
      }else{
         $ulevel = USER_LEVEL;
      }
      $n = $firstname." ".$lastname;
      $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '', $ulevel, '$firstname', '$lastname', '$gender', '$dob', '$email', '$time', '$plist', '0','$langflag')";
      $res = mysql_query($q, $this->connection);
      $id = mysql_insert_id($this->connection);
      $q1 = "INSERT INTO ".TBL_USERS_ADDRS." VALUES ('', '$id', '$n', '1', '$homeno', '$address1', '$address2', '$address3', '$city', '$pincode', '$country', '$langflag','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')";
      $res1 = mysql_query($q1, $this->connection);
       $q2 = "INSERT INTO ".TBL_USERS_ADDRS." VALUES ('', '$id', '$n', '2', '$whomeno', '$waddress1', '$waddress2', '$waddress3', '$wcity', '$wpincode', '$wcountry', '$langflag','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')";
      $res2 = mysql_query($q2, $this->connection);
      $q3 = "INSERT INTO ".TBL_USERS_PHONE." VALUES ('$id','$home', '$work', '$mobile', '$fax', '$pager')";
      $res3 = mysql_query($q3, $this->connection);
      return $res3; 
   }

   /* add contact messages to contact table */
   function addMesg($msgtype, $uname, $uemail, $message){
    if(!get_magic_quotes_gpc()){
        $msgtype = addslashes($msgtype);
        $uname   = addslashes($uname);
        $uemail  = addslashes($uemail);
        $message = addslashes($message);
    }
    $date = getDate();
    foreach($date as $item=>$value) {
           if ($value < 10)
               $date[$item] = "0".$value;
    }
    $time = $date['year']."-".$date['mon']."-".$date['mday']." ".$date['hours'].":".$date['minutes'].":".$date['seconds'];


    $q = "INSERT INTO ".TBL_CONTACT." VALUES ('0','$time','$msgtype','$uname','$uemail','$message')";
    $res = mysql_query($q, $this->connection);
    return $res;
   }

   /* add bulletin messages to bulletin table */
   function addBulletin($msgtype, $uname, $udob, $uhour, $umin, $place, $sname, $uemail, $message,$subphotoname){
    if(!get_magic_quotes_gpc()){
        $msgtype = addslashes($msgtype);
        $uname   = addslashes($uname);
        $udob    = addslashes($udob);
        $uhour    = addslashes($uhour);
        $umin     = addslashes($umin);
        $place   = addslashes($place);
        $sname   = addslashes($sname);
        $uemail  = addslashes($uemail);
        $message = addslashes($message);
        $subphoto   = addslashes($subphotoname); 
    }
    $date = getDate();
    foreach($date as $item=>$value) {
           if ($value < 10)
               $date[$item] = "0".$value;
    }
    $time = $date['year']."-".$date['mon']."-".$date['mday']." ".$date['hours'].":".$date['minutes'].":".$date['seconds'];


    $q = "INSERT INTO ".TBL_BULLETIN." VALUES ('0', '$time', '0', '$msgtype', '$uname', '$udob', '$uhour', '$umin', '$place', '$sname', '$uemail', '$message','$subphotoname')";
    $res = mysql_query($q, $this->connection);
    $id = mysql_insert_id($this->connection);
    return $id;
   }


   /* updateUserField - Updates a field, specified by the field parameter, in the user's row of the database */
   function updateUserField($userid, $field, $value){
      if(!get_magic_quotes_gpc()){
          $field = addslashes($field);  
      }
      $q = "UPDATE ".TBL_USERS." SET ".$field." = '$value' WHERE userid = '$userid'";
      return mysql_query($q, $this->connection);
   }

   /*updateUser - Updates the user data given in edit form*/
    function updateUser($userid, $firstname, $lastname, $gender, $dob,$dob1,$dob2,$dob3,$dob4,$dob5,$dob6,$dob7,$dob8,$dob9,$dob10,
                    $home, $work, $mobile, $fax, $pager, $homeno, $address1, $address2, $address3,
                    $city, $pincode, $country, $whomeno, $waddress1, $waddress2, $waddress3,
                    $wcity, $wpincode, $wcountry, $email,$fname,$mname,$wname, $child1, $child2,$child3,$child4,$child5,$child6,$child7,$child8, $plist,$fdob,$bmdob,$wdob,$c1dob,$c3dob,$c4dob,$c5dob,$c6dob,$c7dob,$c8dob){
      if(!get_magic_quotes_gpc()){
          $firstname = addslashes($firstname);
          $lastname  = addslashes($lastname);
          $address1  = addslashes($address1);
          $address2  = addslashes($address2);
          $address3  = addslashes($address3);
          $city     = addslashes($city);
          $country   = addslashes($country);
          $waddress1 = addslashes($waddress1);
          $waddress2 = addslashes($waddress2);
          $waddress3 = addslashes($waddress3);
          $wcity    = addslashes($wcity);
          $wcountry  = addslashes($wcountry);
          $fname    = addslashes($fname);
          $mname    = addslashes($mname);
          $wname    = addslashes($wname);
          $child1   = addslashes($child1);
          $child2   = addslashes($child2);
          $child3   = addslashes($child3);
          $child4   = addslashes($child4);
          $child5   = addslashes($child5);
          $child6   = addslashes($child6);
          $child7   = addslashes($child7);
          $child8   = addslashes($child8);
          $fdob    = addslashes($fdob);
          $mdob    = addslashes($mdob);
          $wdob    = addslashes($wdob);
          $c1dob   = addslashes($c1dob);
          $c3dob   = addslashes($c3dob);
          $c4dob   = addslashes($c4dob);
          $c5dob   = addslashes($c5dob);
         $c6dob   = addslashes($c6dob);
         $c7dob   = addslashes($c7dob);
          $c8dob   = addslashes($c8dob);
      }
     $q = "UPDATE ".TBL_USERS." SET firstname = '$firstname',
            lastname = '$lastname', gender = '$gender', dob = '$dob', dob1 = '$dob1',dob2 = '$dob2',dob3 = '$dob3',dob4 = '$dob4',dob5 = '$dob5',dob6 = '$dob6',dob7 = '$dob7',dob8 = '$dob8',dob9 = '$dob9',dob10 = '$dob10',email = '$email', plist ='$plist'
            WHERE userid = '$userid'";
      $res = mysql_query($q, $this->connection);
      $n = $firstname." ".$lastname;
      $q1 = "UPDATE ".TBL_USERS_ADDRS." SET name = '$n', type = '1', homeno = '$homeno', address1 = '$address1', address2 = '$address2',
             address3 = '$address3', city = '$city', pincode = '$pincode', country = '$country' , fname = '$fname', mname = '$mname', wname = '$wname', child1 = '$child1', child2 = '$child2', child3 = '$child3', child4 = '$child4', child5 = '$child5' , child6 = '$child6',child7 = '$child7',child8 = '$child8',
             fdob = '$fdob', mdob = '$mdob', wdob = '$wdob', c1dob = '$c1dob', c3dob = '$c3dob', c4dob = '$c4dob', c5dob = '$c5dob', c6dob = '$c6dob' , c7dob = '$c7dob',c8dob = '$c8dob'
            WHERE userid = '$userid' AND type='1'";
      $res1 = mysql_query($q1, $this->connection);
      $q2 = "UPDATE ".TBL_USERS_ADDRS." SET name = '$n', type = '2', homeno = '$whomeno', address1 = '$waddress1', address2 = '$waddress2',
             address3 = '$waddress3', city = '$wcity', pincode = '$wpincode', country = '$wcountry' 
             WHERE userid = '$userid' AND type='2'";
      $res2 = mysql_query($q2, $this->connection);
      $q3 = "UPDATE ".TBL_USERS_PHONE." SET home = '$home', work = '$work', mobile = '$mobile',
             fax = '$fax', pager = '$pager' WHERE userid = '$userid'";
      return mysql_query($q3, $this->connection);
   }



   /* getUserInfo - Returns the result array from a mysql query asking for all information stored regarding
      the given username. If query fails, NULL is returned */
   function getUserInfo($username){
      $username = addslashes($username);
      $q = "SELECT username, password, userid, userlevel, firstname, lastname, gender,
            month(dob) dmonth, dayofmonth(dob) dday, year(dob) dyear, email, plist
            FROM ".TBL_USERS." WHERE username = '$username'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }

   /* getUserHomeAddress - Returns the result array from a mysql query asking for home address information stored regarding
      the given userid. If query fails, NULL is returned */
   function getUserHomeAddress($userid){
      $q = "SELECT * FROM ".TBL_USERS_ADDRS." WHERE userid = '$userid' and type='1' and langflag ='T'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }
   //english address
   function getUserEnglishAddress($userid){
      $q = "SELECT * FROM ".TBL_USERS_ADDRS." WHERE userid = '$userid' and type='1'and langflag ='E'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }
   //english address
   function getUserEnglishAddress1($userid){
      $q = "SELECT * FROM ".TBL_USERS_ADDRS." WHERE userid = '$userid' and  type='2' and langflag ='E'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }

   /* getUserWorkAddress - Returns the result array from a mysql query asking for work address information stored regarding
      the given userid. If query fails, NULL is returned */
   function getUserWorkAddress($userid){
      $q = "SELECT * FROM ".TBL_USERS_ADDRS." WHERE userid = '$userid' and type='2' and langflag ='T'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }
//   Testing....address city wise......
     function getUserWorkcity($userid){
      $q = "SELECT * FROM ".TBL_USERS_ADDRS." WHERE userid = '$userid' and type='1' and pincode ='614616' and langflag ='T'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }

      /* getUserPhone - Returns the result array from a mysql query asking for users phone information stored regarding
      the given userid. If query fails, NULL is returned */
   function getUserPhone($userid){
      $q = "SELECT * FROM ".TBL_USERS_PHONE." WHERE userid = '$userid'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given name by default */
      if(!$result || (mysql_numrows($result) < 1)){
         return NULL;
      }
      /* Return result array */
      $dbarray = mysql_fetch_array($result);
      return $dbarray;
   }


    /* getNumMembers - Returns the number of signed-up users of the website, banned members not included.
      The first time the function is called on page load, the database is queried, on subsequent calls,
      the stored result is returned. This is to improve efficiency, effectively not querying the database
      when no call is made */
   function getNumMembers(){
      if($this->num_members < 0){
         $q = "SELECT * FROM ".TBL_USERS;
         $result = mysql_query($q, $this->connection);
         $this->num_members = mysql_numrows($result);
      }
      return $this->num_members;
   }
   /* calcNumActiveUsers - Finds out how many active users are viewing site and sets class variable accordingly */
   function calcNumActiveUsers(){

      /* Calculate number of users at site */
      $q = "SELECT * FROM ".TBL_ACTIVE_USERS;
      $result = mysql_query($q, $this->connection);
      $this->num_active_users = mysql_numrows($result);
   }

   /* calcNumActiveGuests - Finds out how many active guests are viewing site and sets class variable accordingly */
   function calcNumActiveGuests(){

      /* Calculate number of guests at site */
      $q = "SELECT * FROM ".TBL_ACTIVE_GUESTS;
      $result = mysql_query($q, $this->connection);
      $this->num_active_guests = mysql_numrows($result);
   }

   /* addActiveUser - Updates username's last active timestamp in the database, and also adds him to the
      table of active users, or updates timestamp if already there */
   function addActiveUser($username, $time){
      $q = "UPDATE ".TBL_USERS." SET timestamp = '$time' WHERE username = '$username'";
      mysql_query($q, $this->connection);

      if(!TRACK_VISITORS) return;
      $q = "REPLACE INTO ".TBL_ACTIVE_USERS." VALUES ('$username', '$time')";
      mysql_query($q, $this->connection);
      $this->calcNumActiveUsers();
   }

   /* addActiveGuest - Adds guest to active guests table */
   function addActiveGuest($ip, $time){
      if(!TRACK_VISITORS) return;
      $q = "REPLACE INTO ".TBL_ACTIVE_GUESTS." VALUES ('$ip', '$time')";
      mysql_query($q, $this->connection);
      $this->calcNumActiveGuests();
   }

   /* removeActiveUser */
   function removeActiveUser($username){
      if(!TRACK_VISITORS) return;
      $q = "DELETE FROM ".TBL_ACTIVE_USERS." WHERE username = '$username'";
      mysql_query($q, $this->connection);
      $this->calcNumActiveUsers();
   }

   /* removeActiveGuest */
   function removeActiveGuest($ip){
      if(!TRACK_VISITORS) return;
      $q = "DELETE FROM ".TBL_ACTIVE_GUESTS." WHERE ip = '$ip'";
      mysql_query($q, $this->connection);
      $this->calcNumActiveGuests();
   }

   /* removeInactiveUsers */
   function removeInactiveUsers(){
      if(!TRACK_VISITORS) return;
      $timeout = time()-USER_TIMEOUT*60;
      $q = "DELETE FROM ".TBL_ACTIVE_USERS." WHERE timestamp < $timeout";
      mysql_query($q, $this->connection);
      $this->calcNumActiveUsers();
   }

   function removeInactiveGuests(){
      if(!TRACK_VISITORS) return;
      $timeout = time()-GUEST_TIMEOUT*60;
      $q = "DELETE FROM ".TBL_ACTIVE_GUESTS." WHERE timestamp < $timeout";
      mysql_query($q, $this->connection);
      $this->calcNumActiveGuests();
   }

   /* checkDOB - Checks whether the given Dob is correct for the user.*/
   function checkBirth($userid,$dob){
      $q = "SELECT * FROM ".TBL_USERS." WHERE userid = '$userid' AND dob = '$dob'";
      $result = mysql_query($q, $this->connection);

      /* Error occurred, return given 0 */
      if(!$result || (mysql_numrows($result) < 1)){
         return 0;
      }

      /* dob match */
      return mysql_numrows($result);
   }

   function addReceipe($resname,$restype,$rescatg,$resing,$resmethod){
      if(!get_magic_quotes_gpc()){
        $resname   = addslashes($resname);
        $restype   = addslashes($restype);
        $rescatg   = addslashes($rescatg);
        $resing    = addslashes($resing);
        $resmethod = addslashes($resmethod);
      }
      $q = "INSERT INTO ".TBL_RECEIPE."(rescp_name,rescp_type,rescp_catg,rescp_ing,rescp_method) VALUES ('$resname','$restype', '$rescatg', '$resing', '$resmethod')";
      return mysql_query($q, $this->connection);
   }

   function addTown($townname,$pincode){
      if(!get_magic_quotes_gpc()){
        $townname   = addslashes($townname);
        $pincode   = addslashes($pincode);

      }
      $q = "INSERT INTO ".poovai_townlist."(townname,pincode) VALUES ('$townname','$pincode') ";
      return mysql_query($q, $this->connection);

   }

   function addUser($name,$homeno,$address1,$address2,$address3,$city,$pincode){
      if(!get_magic_quotes_gpc()){
            $name       = addslashes($name);
            $homeno     = addslashes($homeno);
            $address1   = addslashes($address1);
            $address2   = addslashes($address2);
            $address3   = addslashes($address3);
            $city       = addslashes($city);
            $pincode    = addslashes($pincode);
   }
   $q = "INSERT INTO ".Cust_Address."(name,townid,city,homeno,address1,address2,address3,pincode) VALUES ('$name',(select townid from poovai_townlist where townname='$city'),'$city','$homeno','$address1','$address2','$address3','$pincode')";
   return mysql_query($q, $this->connection);
   }

   function addNews($date1,$newsflag,$newsname,$newscatg,$newsdetail,$imgname,$iwidth,$iheight){
      if(!get_magic_quotes_gpc()){
        $newsflag   = addslashes($newsflag);
        $date1   = addslashes($date1);
        $newsname   = addslashes($newsname);
        $newscatg   = addslashes($newscatg);
        $newsdetail = addslashes($newsdetail);
        $imgname = addslashes($imgname);
        $iheight    = addslashes($iheight);
        $iwidth     = addslashes($iwidth);
      }
      $date = getDate();
      $newsdate = $date['year']."-".$date['mon']."-".$date['mday'];
      $q = "INSERT INTO ".TBL_NEWS."(news_date,news_head,news_catg,news_detail,flag,date,image,image_width,image_height) VALUES ('$newsdate', '$newsname', '$newscatg', '$newsdetail', '$newsflag','$date1', '$imgname', '$iwidth', '$iheight')";
      return mysql_query($q, $this->connection);
   }

   function addResTips($restips){
      if(!get_magic_quotes_gpc()){
        $restips = addslashes($restips);
      }
      $q = "INSERT INTO ".TBL_RECEIPE_TIPS."(restips_desc) VALUES ('$restips')";
      return mysql_query($q, $this->connection);
   }

   function addNewWed($subname, $subgender, $subwdob, $subage, $submtongue, $subweight, $subheight, $submstatus, $subreligion,  $subsign, $substar, $suboccupation, $subeducation, $subhobby, $subcountry, $subaddress, $subemail, $subtelno, $subphotoname){
      if(!get_magic_quotes_gpc()){
        $subname       = addslashes($subname);
        $subgender     = addslashes($subgender);
        $subwdob       = addslashes($subwdob);
        $subage       = addslashes($subage);
        $submtongue    = addslashes($submtongue);
        $subweight     = addslashes($subweight);
        $subheight     = addslashes($subheight);
        $submstatus    = addslashes($submstatus);
        $subreligion   = addslashes($subreligion);
        $subsign       = addslashes($subsign);
        $substar       = addslashes($substar);
        $suboccupation = addslashes($suboccupation);
        $subeducation  = addslashes($subeducation);
        $subhobby      = addslashes($subhobby);
        $subcountry    = addslashes($subcountry);
        $subaddress    = addslashes($subaddress);
        $subemail      = addslashes($subemail);
        $subtelno      = addslashes($subtelno);
        $subphotoname  = addslashes($subphotoname);
      }

      $q = "INSERT INTO ".TBL_WED." VALUES ('', '$subname', '$subgender', '$subwdob', '$subage', '$submtongue', '$subweight', '$subheight', '$submstatus', '$subreligion',  '$subsign', '$substar', '$suboccupation', '$subeducation', '$subhobby', '$subcountry', '$subaddress', '$subemail', '$subtelno', '$subphotoname')";
      return mysql_query($q, $this->connection);
   }

   function addNewWedInvit($submfirst,$submname,$subwfirst, $subwname, $subwdob, $subhour, $submin, $subaddress, $subemail, $subtelno, $subphotoname){
      if(!get_magic_quotes_gpc()){
        $submfirst   = addslashes($submfirst);
        $submname   = addslashes($submname);
        $subwfirst   = addslashes($subwfirst);
        $subwname   = addslashes($subwname);
        $subwdob    = addslashes($subwdob);
        $subhour    = addslashes($subhour);
        $submin     = addslashes($submin);
        $subaddress = addslashes($subaddress);
        $subemail   = addslashes($subemail);
        $subtelno   = addslashes($subtelno);
        $subphoto   = addslashes($subphotoname);
      }
      $q = "INSERT INTO ".TBL_WED_INVIT." VALUES ('', '$submfirst', '$submname', '$subwfirst','$subwname', '$subwdob', '$subhour', '$submin', '$subaddress', '$subemail', '$subtelno', '$subphotoname')";
      return mysql_query($q, $this->connection);
   }

   /* query - Performs the given query on the database and returns the result, which may be false,
      true or a resource identifier */
   function query($query){
      return mysql_query($query, $this->connection);
   }
};

/* Create database connection */
$database = new MySQLDB;

?>

//the form of the above database is adminprocess.php//

<?
/* The AdminProcess class is meant to simplify the task of processing various actions from the
   admin center, these deal with member system adjustments */
include("../include/session.php");

class AdminProcess
{
   /* Class constructor */
   function AdminProcess(){
      global $session;

      /* Make sure administrator is accessing page */
     // if(!$session->isAdmin()){
         //header("Location: ../index.php");
        // header("Location: ../login.php");
         //return;
     // }

      /* Admin submitted to give user - user level */
      if(isset($_POST['userlvl'])){
         $this->procUpdateUserLevel();
      }

      /* Admin submitted to give user - Admin level */
      else if(isset($_POST['adminlvl'])){
         $this->procUpdateAdminLevel();
      }

      /* Admin submitted Add user to poovai list form */
      else if(isset($_POST['addpl'])){
         $this->procAddUserPL();
      }

      /* Admin submitted remove user from poovai list form */
      else if(isset($_POST['removepl'])){
         $this->procRemoveUserPL();
      }

      /* Admin submitted ban user form */
      else if(isset($_POST['ban'])){
         $this->procBanUser();
      }

      /* Admin submitted delete banned user form */
      else if(isset($_POST['delbu'])){
         $this->procDeleteBannedUser();
      }

      /* Admin submitted to add receipe */
      else if(isset($_POST['addrescp'])){
         $this->procAddReceipe();
      }

      /* Admin submitted to add news */
      else if(isset($_POST['addnews'])){
         $this->procAddNews();
      }

/* Admin submitted to update news */
       else if(isset($_POST['getnews'])){
         $this->procGetNews();
      }

      /* Admin submitted to add receipe tips */
      else if(isset($_POST['addrestips'])){
         $this->procAddResTips();
      }

      /* Admin submitted to upload photos into photo gallery */
      else if(isset($_POST['addphoto'])){
         $this->procAddPhoto();
      }
      /*admin submitted to insert new user syed added */
      else  if(isset($_POST['addTown'])){
         $this->procAddTown();
     }

     /*users added in the Cust_address list syed added*/
      else if(isset($_POST['adduser'])){
        $this->procAddUser();
      }

      /* Poovai user asked to print selected members */
      else if(isset($_POST['printsel'])){
        $this->procPrintSel();
      }

      /* Poovai user asked to print all the members */
      else if(isset($_POST['printall']) || ($_GET['p'] == 1)){
        $this->procPrintAll();
      }
      /* Poovai user asked to print all the Home members */
      else if(isset($_POST['printall']) || ($_GET['p'] == 2)){
        $this->procPrintAllHome();
      }
       /* Poovai user asked to print all the Home members */
      else if(isset($_POST['printall']) || ($_GET['p'] == 3)){
        $this->procPrintAllEnglish();
      }
       /* Poovai user asked to print all the Home members */
      else if(isset($_POST['printall']) || ($_GET['p'] == 4)){
        $this->procPrintAllcity();
      }

      /* Should not get here, redirect to home page */
      else{
         //header("Location: ../index.php");
         header("Location: ../login.php");
      }
   }

   /* procUpdateLevel - the selected users are given admin level*/
   function procUpdateUserLevel(){
   global $session, $database;

   foreach ($_POST['chkbox'] as $row_id){ 
       $database->updateUserField($row_id, "userlevel", 1);
   }
      header("Location: ".$session->referrer);
   }

   function procUpdateAdminLevel(){
   global $session, $database;

   foreach ($_POST['chkbox'] as $row_id){ 
       $database->updateUserField($row_id, "userlevel", 9);
   }
       header("Location: ".$session->referrer);
   }

   function procAddUserPL(){
      global $session, $database;

      foreach ($_POST['chkbox'] as $row_id) { 
         $database->updateUserField($row_id, "plist", 1);
      }
      header("Location: ".$session->referrer);
   }

   function procRemoveUserPL(){
      global $session, $database;

      foreach ($_POST['chkbox'] as $row_id) { 
        $database->updateUserField($row_id, "plist", 0);
      }
      header("Location: ".$session->referrer);
   }

   /* procDeleteInactive - All inactive users are deleted from the database, not including
      administrators. Inactivity is defined by the number of days specified that have gone
      by that the user has not logged in */
   function procDeleteInactive(){
      global $session, $database;
      $inact_time = $session->time - $_POST['inactdays']*24*60*60;
      $q = "DELETE FROM ".TBL_USERS." WHERE timestamp < $inact_time "
          ."AND userlevel != ".ADMIN_LEVEL;
      $database->query($q);
      header("Location: ".$session->referrer);
   }

   /* procBanUser - If the submitted username is correct, the user is banned from the member system,
      whic       ls removing the username from the users table and adding it to the banned users table */
   function procBanUser(){
      global $session, $database;
      foreach ($_POST['chkbox'] as $row_id) { 
         $database->updateUserField($row_id, "banuser", 1);
         $database->query($q);
     }
         header("Location: ".$session->referrer);
   }

   /* procDeleteBannedUser - If the submitted username is correct, the user is deleted from the banned
      users table, which enables someone to register with that username again */
   function procDeleteBannedUser(){
      global $session, $database;

      /* Delete user from BANNED_USERS database table */
     foreach ($_POST['chkbox'] as $row_id) { 
        $q = "DELETE FROM ".TBL_USERS." WHERE userid = '$row_id'";
        $database->query($q);
        $q = "DELETE FROM ".TBL_USERS_ADDRS." WHERE userid = '$row_id'";
        $database->query($q);
        $q = "DELETE FROM ".TBL_USERS_PHONE." WHERE userid = '$row_id'";
        $database->query($q);
   }
         header("Location: ".$session->referrer);
   }

   /* procAddReceipe - Adds the given receipe to the receipe table */
   function procAddReceipe(){
        global $session, $database;
        $s = $database->addReceipe($_POST['resname'], $_POST['restype'], $_POST['rescatg'], $_POST['resing'], $_POST['resmethod']);
        header("Location: ".$session->referrer);
   }
   /* procAddtown  - Adds the townname to the townlist table */
     procAddtown  - Adds the townname, pincode to the townlist table and sub-town name and pincode to the subtownlist table  */
     function  procAddTown(){
     global $session,$database;
     $s = $database->addTown($_POST['townname'] , $_POST['pincode']);

     if(isset($_POST['subtownname'])){
         if($_POST['subtownname']){
        $st = $database->addSubTown($_POST['pincode'] , $_POST['subtownname'], $_POST['subtownpincode']);
     }
     else{
         $st=2;
     }
     }
     header("Location:".$session->referrer."?tbl=13&queryR=".$s."&queryRR=".$st);
   }



   /*procAddUser - Adds the user history in Cust_Address table*/
     function  procAddUser(){
     global $session, $database;
     $s = $database->addUser($_POST['name'], $_POST['homeno'], $_POST['address1'], $_POST['address2'], $_POST['address3'], $_POST['city'], $_POST['pincode']);
     header("Location:".$session->referrer);
     }
   /* Add News*/
   function procAddNews(){
        global $session, $database;

    /*  echo $_FILES['Image']['tmp_name'];
        echo "===========";
        echo $_FILES['Image']['name'];
        echo "========"; */

        if($_FILES['Image']['tmp_name'] != "")
            copy ($_FILES['Image']['tmp_name'], "../news/images/".$_FILES['Image']['name']) or die ('Could not upload'); 
        $s = $database->addNews($_POST['date1'],$_POST['newsflag'], $_POST['newsname'], $_POST['newscatg'], $_POST['newsdetail'], $_FILES['Image']['name'], $_POST['iwidth'], $_POST['iheight']);
        header("Location: ".$session->referrer);
   }


 /* Update News*/
   function procGetNews(){
        global $session, $database;

    /*  echo $_FILES['Image']['tmp_name'];
        echo "===========";
        echo $_FILES['Image']['name'];
        echo "========"; */
        /*modification 3 done below*/
        foreach($_POST['newsIdno'] as $news_id) { 
        $q = "SELECT * FROM ".TBL_NEWS." WHERE newsIdno = '$news_id'";
        $database->query($q);
        }
        header("Location: ".$session->referrer);
   }




   function procAddPhoto(){
        $userfile = $_FILES['userfile']['tmp_name'];
        $userfile_name = $_FILES['userfile']['name'];
        $userfile_type = $_FILES['userfile']['type'];
        $add="../gallery/images/big/$userfile_name"; // the path with the file name where the file will be stored, upload is the directory name. 
        if(move_uploaded_file ($userfile, $add)){
        echo "Successfully uploaded the image";
        chmod("$add",0777);

        /******* Add the original photo name to the image_order.txt in images/big directory ********/

         $file = "../gallery/images/big/image_order.txt";
         $fp = fopen($file, "a");
         $buf = "\n".$userfile_name;
         fwrite($fp, $buf, strlen($buf));
         fclose($fp);

        /******* Add the thumbnail photo name to the image_order.txt in images directory********/

         $file = "../gallery/images/image_order.txt";
         $fp = fopen($file, "a");
         $buf = "\n".$userfile_name;
         fwrite($fp, $buf, strlen($buf));
         fclose($fp);
        }else{echo "Failed to upload file";
        exit;}

        ///////// Start the thumbnail generation//////////////

        $n_width=150;          // Fix the width of the thumb nail image
        $n_height=100;         // Fix the height of the thumb nail image

        $tsrc="../gallery/images/$userfile_name";   // Path where thumb nail image will be stored
        echo $tsrc;

        if (!($userfile_type =="image/pjpeg" OR $userfile_type=="image/gif")){echo "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>";

        exit;}

        /////////////////////////////////////////////// Starting of GIF thumb nail creation///////////

        if (@$userfile_type=="image/gif")
        {
        $im=ImageCreateFromGIF($add);
        $width=ImageSx($im);              // Original picture width is stored
        $height=ImageSy($im);                  // Original picture height is stored
        $newimage=imagecreatetruecolor($n_width,$n_height);
        imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
        if (function_exists("imagegif")) {
        Header("Content-type: image/gif");
        ImageGIF($newimage,$tsrc);
        }

        elseif (function_exists("imagejpeg")) {
        Header("Content-type: image/jpeg");
        ImageJPEG($newimage,$tsrc);
        }
        chmod("$tsrc",0777);
        }////////// end of gif file thumb nail creation//////////

        ////////////// starting of JPG thumb nail creation//////////

        if($userfile_type=="image/pjpeg"){
        $im=ImageCreateFromJPEG($add); 
        $width=ImageSx($im);              // Original picture width is stored
        $height=ImageSy($im);             // Original picture height is stored
        $newimage=imagecreatetruecolor($n_width,$n_height);                 
        imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
        ImageJpeg($newimage,$tsrc);
        chmod("$tsrc",0777);
        }
        ////////////////  End of JPG thumb nail creation //////////
   }

   /* Add Receipe Tips*/
   function procAddResTips(){
        global $session, $database;
        $s = $database->addResTips($_POST['restips']);
        header("Location: ".$session->referrer);
   }

   /* Print all the selected users */
   function procPrintSel(){
        global $session, $database;
        ?>
        <table cellpadding="0" cellspacing="0" width="75%" border="0">
            <tr>
                <td><b>Poovai Community List</b></td>
                <td align="right"><a onClick="print()" style="cursor:hand "><img src="../images/printer.jpg" border="0" alt="PRINT THIS LIST">&nbsp;<font face="verdana" size="-1">Print</font></a></td>
            </tr>
        </table>
        <br>
        <?
        foreach ($_POST['chkbox'] as $row_id){ 
            $q = "SELECT  distinct  firstname, lastname FROM ".TBL_USERS." WHERE userid = '$row_id'";
            $result = $database->query($q);
            $row = mysql_fetch_object($result);
            $a1 = $database->getUserHomeAddress($row_id);
            $a3 = $database->getUserPhone($row_id);
            $a2 = $database->getUserWorkAddress($row_id); ?> 
            <script language="JavaScript" type="text/JavaScript">
            <!--
            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>

            <table cellpadding="0" cellspacing="0" width="85%" border="0">
                <tr>
                    <td align="center"><img src="../images/home.gif"></td>
                    <td>&nbsp;</td>
                    <td align="center"><img src="../images/work.gif"></td>
                </tr>
                <tr>
                    <td align="left" width="35%">
                        <table cellpadding="0" cellspacing="0" width="100%">
                            <tr>
                                <td valign="top"><img src="../images/lt1.gif" width="5" height="5" border="0" alt=""></td>
                                <td valign="top" width="70%" style="border-top:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                                <td valign="top"><img src="../images/rt1.gif" width="5" height="5" border="0" alt=""></td>
                            </tr>
                            <tr>
                                <td valign="bottom" width="1" style="border-left:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                                <td align="center"><table cellpadding="0" cellspacing="0" width="90%" align="center" border="0">
                                        <tr><td>&nbsp;</td></tr>
                                        <tr><td><b><? print($row->lastname); ?><font face="Amudham"><? print ("  " . $row->firstname); ?></font></b></td></tr>
                                        <tr><td><? print($a1['homeno']." ");?><font face="Amudham"><? print ($a1['address1']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a1['address2']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a1['address3']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a1['city']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a1['city'] ."  ". $al['pincode']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a1['country']); ?></font></td></tr>
                                        <tr><td align="right"><img src="addresslogo1.gif"></td></tr>
                                    </table>
                                </td>
                                <td valign="bottom" width="1" style="border-right:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                            </tr>
                            <tr>
                                <td><img src="../images/bl1.gif" width="5" height="5" border="0" alt=""></td>
                                <td width="100%" style="border-bottom:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                                <td><img src="../images/br1.gif" width="5" height="5" border="0" alt=""></td>
                            </tr>
                        </table>
                    </td>
                    <td width="2%">&nbsp;</td>
                    <td align="left" width="35%">
                        <table cellpadding="0" cellspacing="0" align="center" width="100%">
                             <tr>
                                <td valign="top"><img src="../images/lt1.gif" width="5" height="5" border="0" alt=""></td>
                                <td valign="top" width="70%" style="border-top:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                                <td valign="top"><img src="../images/rt1.gif" width="5" height="5" border="0" alt=""></td>
                            </tr>
                            <tr>
                                <td valign="bottom" width="1" style="border-left:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                                <td align="center">
                                    <table cellpadding="0" cellspacing="0" width="90%" align="center" border="0">
                                        <tr><td>&nbsp;</td></tr>
                                        <tr><td><b><? print($row->lastname); ?><font face="Amudham"><? print ("  " . $row->firstname); ?></font></b></td></tr>
                                        <tr><td><? print($a2['homeno'])." ";?><font face="Amudham"><? print ($a2['address1']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a2['address2']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a2['address3']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a2['city']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a2['city'] ."  ". $a2['pincode']); ?></font></td></tr>
                                        <tr><td><font face="Amudham"><? print ($a2['country']); ?></font></td></tr>
                                        <tr><td align="right"><img src="addresslogo1.gif"></td></tr>
                                    </table>
                                </td>
                                <td valign="bottom" width="1" style="border-right:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                            </tr>
                            <tr>
                                <td><img src="../images/bl1.gif" width="5" height="5" border="0" alt=""></td>
                                <td width="100%" style="border-bottom:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                                <td><img src="../images/br1.gif" width="5" height="5" border="0" alt=""></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            <br>
    <?   }
   }

   /* Print all the Poovai Community List Members */
   function procPrintAll(){
        global $session, $database;
        $q = "SELECT * FROM ".TBL_USERS." WHERE plist = 1 and langflag ='T' order by userid";
        $result = mysql_query($q); ?>
        <STYLE>
            P.breakhere { page-break-after: always }
        </STYLE>
        <table cellpadding="0" cellspacing="0" width="75%" border="0">
        <tr>

    <td colspan="2"><b><a href="../admin/adminprocess.php?p=2"><img src="../images/h1.gif" border="0"></a>&nbsp;&nbsp;<a href="../admin/adminprocess.php?p=4"><img src="../images/h3.gif" border="0"></a>&nbsp;&nbsp;</b></td>
            <td align="right"><a onClick="print()" style="cursor:hand "><img src="../images/printer.jpg" border="0" alt="PRINT THIS LIST">&nbsp;<font face="verdana" size="-1">Print</font></a></td>
        </tr>
        </table>
        <?
        $count = 0;
        //$actual = 32;
        $count1 = 7; ?>
        <?
            while($row = mysql_fetch_object($result))
            {
                $a1 = $database->getUserHomeAddress($row->userid);
                $a3 = $database->getUserPhone($row->userid);
                $a2 = $database->getUserWorkAddress($row->userid); ?>
                <? if($count > 4) { ?>
                <p CLASS="breakhere">        
                <? 
                    $count = 0;     
                } 
                else ?>
                <p>
                    <? $count++; ?>
<table cellpadding="0" cellspacing="0" width="85%" border="0">
  <tr>
                    <td align="center"><img src="../images/home.gif"></td>
                    <td>&nbsp;</td>
                    <td align="center"><img src="../images/work.gif"></td>
                </tr>
                <tr>
                    <td align="left" width="35%">
            <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
                    <td valign="top"><img src="../images/lt1.gif" width="5" height="5" border="0" alt=""></td>

          <td width="70%" valign="top"  style="border-top:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td valign="top"><img src="../images/rt1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
                <tr>
                    <td valign="bottom" width="5" style="border-left:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>

          <td align="center"> 
            <table width="90%" height="0%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="10%" colspan="2"><strong><? print($row->lastname); ?><font face="Amudham"><? print ("  " . $row->firstname); ?><? print (" mth;fs;"); ?></font></strong></td>
              </tr>
              <tr> 
                <td height="10%" colspan="2"><? print($a1['homeno']." ");?><font face="Amudham"><? print ($a1['address1']); ?></font></td>
              </tr>
              <tr> 
                <td height="10%" colspan="2"><font face="Amudham"><? print ($a1['address2']); ?></font></td>
              </tr>
              <tr> 
                <td height="10%" colspan="2"><font face="Amudham"><? print ($a1['address3']); ?></font></td>
              </tr>
              <tr> 
                <td height="10%"><font face="Amudham"><? print ($a1['city'] ."  ". $a1['pincode']); ?></font>Phone:<? print ($a3['home']); ?></td>
                <td align="right"><img src="addresslogo1.gif"></td>
              </tr>
              <tr>
                <td height="10%" colspan="2">Mobile:<? print ($a3['mobile']); ?> 
                </td>
              </tr>
              <? 

              if($a1['address1'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } ?>
              <? 

              if($a1['address2'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } ?>
              <? if($a1['address3'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              }?>
              <? 




              if($a1['city'] == null)
              {
              ?>
              <tr> 
                <td height="10%">&nbsp;</td>
                <td height="10%">&nbsp;</td>
              </tr>
              <?
              }  ?>
              <? $count1 = $count1+12; ?>
            </table>
          </td>
                    <td valign="bottom" width="10" style="border-right:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                </tr>
                <tr>
                    <td><img src="../images/bl1.gif" width="5" height="5" border="0" alt=""></td>

          <td width="100%"  style="border-bottom:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td><img src="../images/br1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
            </table>
            </td>
            <td width="2%">&nbsp;</td>
            <td align="left" width="35%">
            <table width="100%" align="center" cellpadding="0" cellspacing="0">
        <tr>
                    <td valign="top"><img src="../images/lt1.gif" width="5" height="5" border="0" alt=""></td>
                    <td valign="top" width="70%" style="border-top:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td valign="top"><img src="../images/rt1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
                <tr>
                    <td valign="bottom" width="5" style="border-left:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td align="center"><table cellpadding="0" cellspacing="0" width="90%" align="center" border="0">
              <tr> 
                <td colspan="2"><strong><? print($row->lastname); ?><font face="Amudham"><? print ("  " . $row->firstname); ?><? print (" mth;fs;"); ?></font></strong></td>
              </tr>
              <tr> 
                <td colspan="2"><? print($a2['homeno'])." ";?><font face="Amudham"><? print ($a2['address1']); ?></font></td>
              </tr>
              <tr> 
                <td colspan="2"><font face="Amudham"><? print ($a2['address2']); ?></font></td>
              </tr>
              <tr> 
                <td colspan="2"><font face="Amudham"><? print ($a2['address3']); ?></font></td>
              </tr>
              <tr> 
                <td><font face="Amudham"><? print ($a2['city'] ."  ". $a2['pincode']); ?></font>Phone:<? print ($a3['home']); ?></td>
                <td align="right"><img src="addresslogo1.gif"></td>
              </tr>
              <tr>
                <td height="10%" colspan="2">Mobile:<? print ($a3['mobile']); ?></td>
              </tr>
              <? if($a1['address1'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } 


              if($a1['address2'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } ?>
              <? if($a1['address3'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } ?>
              <? 




              if($a1['city'] == null)
              {
              ?>
              <tr> 
                <td width="75%" height="10%">&nbsp;</td>
                <td width="25%">&nbsp;</td>
              </tr>
              <?
              } ?>
            </table>
                    </td>
                    <td valign="bottom" width="10" style="border-right:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                </tr>
                <tr>
                    <td><img src="../images/bl1.gif" width="5" height="5" border="0" alt=""></td>
                    <td width="100%" style="border-bottom:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td><img src="../images/br1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
            </table>
            </td>
                </tr>
            </table>

            <? if($count == 4) ?>
</p>


<br>
  <? }
   }

   function procPrintAllEnglish(){
        global $session, $database;
        $q = "SELECT * FROM ".TBL_USERS." WHERE plist = 1 and langflag ='E' order by userid";
        $result = mysql_query($q); ?>
        <STYLE>
            P.breakhere { page-break-after: always }
        </STYLE>
        <table cellpadding="0" cellspacing="0" width="75%" border="0">
        <tr>

    <td colspan="2"><b><a href="../admin/adminprocess.php?p=2"><img src="../images/h1.gif" border="0"></a>&nbsp;&nbsp;<a href="../admin/adminprocess.php?p=3"><img src="../images/h3.gif" border="0"></a>&nbsp;&nbsp;</b></td>
            <td align="right"><a onClick="print()" style="cursor:hand "><img src="../images/printer.jpg" border="0" alt="PRINT THIS LIST">&nbsp;<font face="verdana" size="-1">Print</font></a></td>
        </tr>
        </table>
        <?
        $count = 0;
        //$actual = 32;
        $count1 = 7; ?>
        <?
            while($row = mysql_fetch_object($result))
            {
                $a1 = $database->getUserEnglishAddress($row->userid);
                $a2 = $database->getUserEnglishAddress($row->userid); ?>
                <? if($count > 4) { ?>
                <p CLASS="breakhere">        
                <? 
                    $count = 0;     
                } 
                else ?>
                <p>
                    <? $count++; ?>
<table cellpadding="0" cellspacing="0" width="85%" border="0">
  <tr>
                    <td align="center"><img src="../images/home.gif"></td>
                    <td>&nbsp;</td>
                    <td align="center"><img src="../images/work.gif"></td>
                </tr>
                <tr>
                    <td align="left" width="35%">
            <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
                    <td valign="top"><img src="../images/lt1.gif" width="5" height="5" border="0" alt=""></td>

          <td width="70%" valign="top"  style="border-top:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td valign="top"><img src="../images/rt1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
                <tr>
                    <td valign="bottom" width="5" style="border-left:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>

          <td align="center"> 
            <table width="90%" height="0%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="10%" colspan="2"><strong><? print($row->lastname); ?><? print ("  " . $row->firstname); ?></font></strong></td>
              </tr>
              <tr> 
                <td height="10%" colspan="2"><? print($a1['homeno']." ");?><? print ($a1['address1']); ?></font></td>
              </tr>
              <tr> 
                <td height="10%" colspan="2"><? print ($a1['address2']); ?></font></td>
              </tr>
              <tr> 
                <td height="10%" colspan="2"><? print ($a1['address3']); ?></font></td>
              </tr>
              <tr> 
                <td height="10%"><? print ($a1['city'] ."  ". $a1['pincode']); ?></font></td>
                <td align="right"><img src="addresslogo1.gif"></td>
              </tr>
              <? 

              if($a1['address1'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } ?>
              <? 

              if($a1['address2'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              } ?>
              <? if($a1['address3'] == null)
              {
              ?>
              <tr> 
                <td height="10%" colspan="2">&nbsp;</td>
              </tr>
              <?
              }?>
              <? 




              if($a1['city'] == null)
              {
              ?>
              <tr> 
                <td height="10%">&nbsp;</td>
                <td height="10%">&nbsp;</td>
              </tr>
              <?
              }  ?>
              <? $count1 = $count1+12; ?>
            </table>
          </td>
                    <td valign="bottom" width="10" style="border-right:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                </tr>
                <tr>
                    <td><img src="../images/bl1.gif" width="5" height="5" border="0" alt=""></td>

          <td width="100%"  style="border-bottom:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td><img src="../images/br1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
            </table>
            </td>
            <td width="2%">&nbsp;</td>
            <td align="left" width="35%">
            <table width="100%" align="center" cellpadding="0" cellspacing="0">
        <tr>
                    <td valign="top"><img src="../images/lt1.gif" width="5" height="5" border="0" alt=""></td>
                    <td valign="top" width="70%" style="border-top:1px solid #000000;"><img src="../images/spacer.gif" width="1" height="1" border="0"></td>
                    <td valign="top"><img src="../images/rt1.gif" width="5" height="5" border="0" alt=""></td>
                </tr>
                <tr>
                    <td valign="bottom" width="5" style="border-left:1px solid #0000
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.