public function handleRequests()
 {
     //add sections to allowed_sections
     $sections = tdb::getInstance()->getAll('sections', 'section_level', '1', 'order_num', 'asc');
     foreach ($sections as $k => $v) {
         $this->allowed_sections[] = $v['section_name'];
     }
     array_pop($this->allowed_sections);
     //remove empty last item
     //add hidden sections to allowed_sections
     $hidden = tdb::getInstance()->getAll('sections', 'section_level', '-1', 'order_num', 'asc');
     array_pop($hidden);
     //remove empty last item
     foreach ($hidden as $k => $v) {
         $this->allowed_sections[] = $v['section_name'];
     }
     //check GET [0]
     if ($_GET['g0'] == 'ajax') {
         //do nothing so url can use .getjson
         $this->section['section_name'] = 'ajax';
     } elseif ($_GET['g0'] == 'cron' || $_GET[1] == 'cron') {
         //$_SERVER ['argv'] [0] is the script that calls the cron job
         //when running a CRON job, $_GET [ 1 ], , $_GET [ 2 ], , $_GET [ 3 ] are set from $argv via definitions.php
         $g1 = isset($_GET['g1']) ? $_GET['g1'] : $_GET[2];
         $g2 = isset($_GET['g2']) ? $_GET['g2'] : $_GET[3];
         $this->section['section_name'] = 'cron';
         if ($g1 == 'batch' && $g2 == CRON_BATCH_PASSWORD) {
             $this->section['action'] = 'batch';
         } elseif ($g1 == 'updateDbImageSizes') {
             $this->section['action'] = 'updateDbImageSizes';
         }
     } elseif (!isset($_GET['g0'])) {
         $this->section['section_name'] = 'home';
         $this->is_faulty_getvar = false;
     } else {
         if (in_array($_GET['g0'], $this->allowed_sections)) {
             //      genFuncs::getInstance()->spit ( 'sub name: ' + $this->s [ 'subsect' ] [ 'section_name' ] );
             $this->section = tdb::getInstance()->getRow('sections', 'section_name', $_GET['g0']);
         }
         if ($_GET['g1']) {
             //only allow the subsects for the current section
             $result = tdb::getInstance()->getAll('sections', 'parent_id', $this->section['section_id']);
             foreach ($result as $k => $v) {
                 $this->allowed_subsects[] = $v['section_name'];
                 if ($_GET['g1'] == $v['section_name']) {
                     $this->section['subsect'] = tdb::getInstance()->getRow('sections', 'section_id', $v['section_id']);
                 }
             }
         }
     }
     if (isset($_GET['g2'])) {
         $this->section['2'] = $_GET['g2'];
     }
     if (isset($_GET['g3'])) {
         $this->section['3'] = $_GET['g3'];
     }
     if (isset($_GET['g4'])) {
         $this->section['4'] = $_GET['g4'];
     }
 }
Esempio n. 2
0
 public function goCron()
 {
     $this->allImages = tdb::getInstance()->getAll('images');
     array_pop($this->allImages);
     genFuncs::getInstance()->spit('sizeOf: ' . sizeOf($this->allImages));
     if ($this->s['action'] == 'batch') {
         $this->batchPhotos();
     } elseif ($this->s['action'] == 'updateDbImageSizes') {
         $this->updateDbImageSizes();
     }
 }
Esempio n. 3
0
 public function startup()
 {
     require_once 'classloader.php';
     smartClassMapper::getInstance();
     spl_autoload_register(array('smartClassMapper', 'autoloadClass'));
     sectionsOb::getInstance()->handleRequests();
     $this->s = sectionsOb::getInstance()->section;
     browser::getInstance();
     require_once T_CLASS_DIR . '/Mobile_Detect.php';
     $this->detect = new Mobile_Detect();
     $this->deviceType = $this->detect->isMobile() ? $this->detect->isTablet() ? 'tablet' : 'phone' : 'computer';
     $this->scriptVersion = $this->detect->getScriptVersion();
     if (T_USE_DB) {
         tdb::getInstance();
     }
     if ($this->s['section_name'] == 'login' || $this->s['section_name'] == 'logout') {
         $this->login = new loginOb();
         $this->login->checkLogin();
     } elseif ($this->s['section_name'] == 'cron') {
         $this->cron = new cron();
     } elseif ($this->s['section_name'] == 'cms') {
         if ($_SESSION['user']['access'] == '2') {
             $this->cms = new cms();
             $this->cms->showCms();
         } else {
             header('Location: ' . T_HOME_URL . 'login');
         }
     } elseif ($this->s['section_name'] == 'ajax') {
         $this->ajax = new ajax();
         $this->ajax->deviceType = $this->deviceType;
         $this->ajax->processRequest();
     } else {
         if (!DISABLE_FRONT_END) {
             $this->site = new site();
             $this->site->navCase = 'upper';
             $this->site->detect = $this->detect;
             $this->site->deviceType = $this->deviceType;
             $this->site->scriptVersion = $this->scriptVersion;
             $this->site->showSite();
         }
     }
 }
 public function showGallery()
 {
     //          genFuncs::getInstance()->spit ( $this->imageIds );
     //    $subsectVerbose = genFuncs::getInstance()->makeurl ( $this->s [ 'subsect' ], false );
     $this->galleryRow = tdb::getInstance()->getRow('sections', 'section_name', $this->s['subsect']['section_name']);
     $this->images = tdb::getInstance()->getAll('images', 'section_id', $this->galleryRow['section_id'], 'order_num', 'asc', 0, 9999, 'active_status', '1');
     array_pop($this->images);
     foreach ($this->images as $k => $v) {
         $this->imageIds[] = array($v['image_id'], $v['image_orig_width'], $v['image_orig_height'], $v['image_has_sizes']);
     }
     $this->numTotalImages = sizeOf($this->imageIds);
     //tdb::getInstance()->getRows ( 'images', 'section_id', $this->galleryRow [ 'section_id' ] );
     //    genFuncs::getInstance()->spit ( 'imageIds: ' . $this->imageIds );
     //    $this->totalPages = ceil ( $this->numTotalImages  / GALLERY_THUMBS_PER_PAGE );
     $this->heroId = -1;
     if ($this->s['2'] > 0) {
         $this->heroId = $this->s['2'];
     } else {
         $this->heroId = $this->images[0]['image_id'];
     }
     $this->switch_link = '<a href="' . DEFAULT_CMS_PAGE . '/' . $this->s['subsect']['section_name'] . '/' . $this->heroId . '">Edit Site &gt;</a>';
     $ratios = unserialize(SCREEN_HERO_RATIOS);
     //mark //set assumed desiredheight for js too
     //genFuncs::getInstance()->spit ( 'size of ratios: ' . sizeOf($ratios) );
     $i = 0;
     $targetScreenDimension = $_SESSION['screen']['targetScreenDimension'] ? $_SESSION['screen']['targetScreenDimension'] : ASSUMED_SCREEN_HEIGHT;
     foreach ($ratios as $k => $v) {
         $this->screenHeroRatios[$i] = array();
         $this->screenHeroRatios[$i][0] = $k;
         $this->screenHeroRatios[$i][1] = (int) $v;
         $i++;
         if ($k >= $targetScreenDimension) {
             $desired_height = $v;
             break;
         }
     }
     //allow for no match
     $this->targetHeroHeight = $desired_height;
     //this is only for server loaded heros: not used currently
     //$this->hero = img::getInstance()->getImage ( $this->heroId, false, $desired_height, false,  'array' );
 }
Esempio n. 5
0
 private function processForm()
 {
     $hash_predb = tdb::getInstance()->getHash($_POST['password']);
     $row = tdb::getInstance()->getRow('user', 'email', $_POST['email']);
     //echo $hash_predb . '<br>vs:<br>' . $row [ 'password' ];
     //pasted the returned hash value in phpmyadmin - needed strip slashes in the tdb class
     if ($hash_predb == $row['password']) {
         //        genFuncs::getInstance()->spit ( 'match' );
         session_regenerate_id(true);
         $_SESSION['user'] = $row;
         unset($_SESSION['user']['password']);
         if ($_SESSION['user']['access'] == '2') {
             unset($_POST);
             header('Location: ' . DEFAULT_CMS_PAGE);
         }
     } else {
         genFuncs::getInstance()->spit('unmatch');
         foreach ($this->fdata['elements'] as $k => $v) {
             $this->fdata['elements'][$k]['error'] = true;
             $this->fdata['elements'][$k]['class'] = 'error';
         }
         $this->showForm();
     }
 }
Esempio n. 6
0
 public function updateDbWithAllSizesForOneImage()
 {
     $has_sizes_string = '';
     foreach ($this->imageData['has_sizes'] as $k => $v) {
         $has_sizes_string .= $v[0] . ':' . $v[1] . ':' . $v[2] . '.';
     }
     $has_sizes_string = substr($has_sizes_string, 0, strlen($has_sizes_string) - 1);
     $q = 'update images set image_has_sizes = "' . $has_sizes_string . '" where image_id="' . $this->imageId . '"';
     $result = tdb::getInstance()->queryNoResult($q);
 }
Esempio n. 7
0
 public function getSiteData()
 {
     //get the SECTIONS (parent id of -1 is not specified and 11 is for the CMS )
     //sections selected in order with all top level sections ordered first, then all 2nd level sections next
     $q = 'SELECT section_id, section_name, section_level, section_id, parent_id, order_num, active FROM sections where page_type_id="1" or page_type_id="2" order by section_level, order_num';
     $sections = tdb::getInstance()->getFromQ($q);
     array_pop($sections);
     $sections_hierachy = array();
     //$sectionIndexById is an associative array where you can find the index of a section in the $secions array by using the section_id as the array key
     $sectionIndexById = array();
     foreach ($sections as $k => $v) {
         //if this is a top level section / menu item
         if ($v['section_level'] == '1') {
             //store its index in $sections_hierachy so it can be called using it's section_id as a key
             $sectionIndexById[$v['section_id']] = $k;
             //this section goes straight in the final array
             $sections_hierachy[$k] = $v;
         } elseif ($v['section_level'] == '2') {
             //get the index of this sections parent in $sections_hierachy by using this sections PARENT_ID (corresponds to the section_id stored above)
             $parent_index = $sectionIndexById[$v['parent_id']];
             if (!$sections_hierachy[$parent_index]['subsections']) {
                 //create the array if it doesn't exists
                 $sections_hierachy[$parent_index]['subsections'] = array();
             }
             //store the subsection
             $sections_hierachy[$parent_index]['subsections'][] = $v;
         }
     }
     $this->jsonSend['sections'] = $sections_hierachy;
     //get the IMAGE DATA
     $q = 'select images.image_id, images.section_id, images.order_num, images.image_orig_width, images.image_orig_height, images.image_has_sizes, sections.section_name from images inner join sections on sections.section_id=images.section_id where active_status="1" order by section_name, images.order_num limit 0,9999';
     $images = tdb::getInstance()->getFromQ($q);
     array_pop($images);
     $this->jsonSend['image_ids'] = array();
     foreach ($images as $k => $v) {
         //$this->jsonSend [] = array ( $v [ 'image_id'], $v ['image_orig_width'], $v ['image_orig_height'], $v [ 'image_has_sizes'], $v [ 'section_name'] );
         $this->jsonSend['image_ids'][] = array($v['image_id'], $v['image_has_sizes'], $v['section_name']);
     }
     $this->sendJson();
 }
 private function processUpload()
 {
     $this->upload_error = false;
     $right_type = false;
     $types = preg_split('/:/', IMG_ALLOWED_TYPES, -1, PREG_SPLIT_NO_EMPTY);
     echo '<br>sizeOf: ' . sizeOf($_FILES['images']);
     foreach ($_FILES["images"] as $k => $v) {
         echo '<br>images: ' . $k . ': ' . $v;
     }
     foreach ($types as $k => $v) {
         if ($_FILES["image0"]["type"] == $v) {
             $right_type = true;
             break;
         }
     }
     if (!$right_type) {
         $this->upload_error = 'Error - That image is the wrong type of file';
     }
     $sizeKb = $_FILES["image0"]["size"] / 1024;
     if ($sizeKb > IMG_MAX_SIZE) {
         $this->upload_error = 'Error: That image larger than the maximum size of ' . $sizeKb . ' Kb';
     }
     if ($_FILES["image0"]["error"] > 0) {
         if ($_FILES["image0"]["error"] == 4) {
             $this->upload_error = 'Error: no file submitted.';
         } else {
             $this->upload_error = 'Error: ' . $_FILES["image0"]["error"];
         }
     }
     if ($this->upload_error == false) {
         $q = 'insert into images set active_status="1", section_id="' . $_POST['gallery_id'] . '"';
         tdb::getInstance()->queryNoResult($q);
         //genFuncs::getInstance()->spit ( 'post q: ' . $q);
         if (move_uploaded_file($_FILES["image0"]["tmp_name"], IMG_UPLOAD_DIR . '/' . tdb::getInstance()->ob->insert_id . '.jpg')) {
             $this->confirm_msg = 'Image uploaded successfully';
         } else {
             $this->upload_error = 'There was a problem uploading your image. Please try again.';
         }
     }
     //    echo "Upload: " . $_FILES["image0"]["name"] . "<br />";
 }
Esempio n. 9
0
 public static function getInstance()
 {
     return is_object(self::$instance) ? self::$instance : (self::$instance = new self::$instance());
 }
Esempio n. 10
0
 public function buildNav($section_level, $table, $order, $base_url, $url_match, $case, $parent_id)
 {
     $case = $this->navCase;
     //change to return an array - do formatting in html
     $nav = array();
     if ($parent_id) {
         $result = tdb::getInstance()->getAll($table, 'section_level', $section_level, 'order_num', $order, false, false, 'parent_id', $parent_id);
     } else {
         $result = tdb::getInstance()->getAll($table, 'section_level', $section_level, 'order_num', $order);
     }
     array_pop($result);
     $singular_table = substr($table, 0, -1);
     foreach ($result as $k => $v) {
         $name = $v[$singular_table . '_name'];
         if (strlen($name) > 0) {
             $nav[$k] = array();
             $nav[$k]['name'] = strtoupper($name);
             if ($case == 'camel') {
                 $nav[$k]['name'] = ucwords($name);
             } elseif ($case == 'lower') {
                 $nav[$k]['name'] = strtolower($name);
             }
             if ($url_match == strtolower($name)) {
                 $nav[$k]['selected'] = 'selected';
                 $nav[$k]['link'] = '';
             } else {
                 $nav[$k]['selected'] = '';
                 $nav[$k]['link'] = $base_url . strtolower($name);
                 //check for default subsect
                 if ($section_level == '1') {
                     $q = 'select * from sections where parent_id = "' . $v['section_id'] . '" order by order_num limit 1';
                     $cur_default_sub = tdb::getInstance()->query($q);
                     if (is_array($cur_default_sub)) {
                         array_pop($cur_default_sub);
                         if ($cur_default_sub['section_name']) {
                             $nav[$k]['link'] .= '/' . $cur_default_sub['section_name'];
                         }
                     }
                 }
             }
         }
         if (empty($nav[$k]['name'])) {
             unset($nav[$k]);
         }
     }
     return $nav;
 }
Esempio n. 11
0
 private function processUpload()
 {
     $types = preg_split('/:/', IMG_ALLOWED_TYPES, -1, PREG_SPLIT_NO_EMPTY);
     $images = array();
     foreach ($_FILES['files'] as $key => $value) {
         foreach ($value as $index => $val) {
             $images[$index][$key] = $val;
         }
     }
     foreach ($images as $index => $cur_array) {
         //        echo ( '<br>: ' . $index );
         //$files is one $_FILE array
         // echo ( '<br> array[name]: ' . $cur_array [ 'name' ] );
         // echo ( '<br> array[size]: ' . $cur_array [ 'size' ] );
         //start single image code
         $right_type = false;
         foreach ($types as $tk => $tv) {
             if ($cur_array["type"] == $tv) {
                 $right_type = true;
                 break;
             }
         }
         if (!$right_type) {
             $this->upload_error[$index] = 'Error - ' . $cur_array['name'] . ' is the wrong type of file';
         }
         $sizeKb = $cur_array["size"] / 1024;
         if ($sizeKb > IMG_MAX_SIZE) {
             $this->upload_error[$index] .= 'Error - ' . $cur_array['name'] . ' is larger than the maximum size of ' . $sizeKb . ' Kb';
         }
         if ($cur_array["error"] > 0) {
             if ($cur_array["error"] == 4) {
                 $this->upload_error[$index] .= 'Error: no file submitted';
             } else {
                 $this->upload_error[$index] .= 'Error - ' . $cur_array["name"] . ': ' . $cur_array["error"] . '';
             }
         }
         //$q = 'SELECT MAX( order_num) as order_num FROM images where section_id="' . $_POST['gallery_id'] . '"';
         $q = 'select order_num, section_id from images where section_id="' . $_POST['gallery_id'] . '" order by order_num desc limit 1';
         $max_order_row = tdb::getInstance()->query($q);
         $max_order = $max_order_row['order_num'];
         $new_order = $max_order + 1;
         if ($this->upload_error[$index] == false) {
             $info = getimagesize($cur_array["tmp_name"]);
             $q = 'insert into images set active_status="1", section_id="' . $_POST['gallery_id'] . '", order_num="' . $new_order . '", image_orig_width="' . $info[0] . '", image_orig_height="' . $info[1] . '"';
             //            genFuncs::getInstance()->spit ( 'q: ' . $q );
             tdb::getInstance()->queryNoResult($q);
             if (move_uploaded_file($cur_array["tmp_name"], IMG_UPLOAD_DIR . '/' . tdb::getInstance()->ob->insert_id . '.jpg')) {
                 $this->confirm_msg[$index] = $cur_array['name'] . ' uploaded successfully';
             } else {
                 $this->upload_error[$index] = 'There was a problem uploading image/s. Please try again.';
             }
         }
     }
     //end mutliple images loop
 }
Esempio n. 12
0
 /**
  * Returns $numItems rows starting from the $startIndex row from the 
  * table.
  *
  * Add authorization or any logical checks for secure access to your data 
  *
  * 
  * 
  * @return array
  */
 public function getItem_paged($lang = 'cn', $startIndex, $numItems, $typeId, $club = null)
 {
     if (is_string($lang)) {
         $condition['lang'] = $lang;
     }
     if ($typeId) {
         $condition['typeId'] = $typeId;
     }
     $condition['club'] = $club;
     //	var_dump($club);
     $param = array('condition' => $condition, 'order' => 'id desc', 'limit' => $numItems, 'offset' => $startIndex);
     $result = tdb::select(self::$tablename, $param);
     return $result;
 }
Esempio n. 13
0
<?php

$allow = true;
if ($allow == true) {
    include_once "../classes/tdb.class.php";
    $tdbh = new tdb("root", "", "create new");
    if ($tdbh->connection) {
        $x = mysql_query("CREATE DATABASE charbhar");
        $y = mysql_query("CREATE USER 'fo_user'@'localhost' IDENTIFIED BY 'oct_password'");
        $z = mysql_query("GRANT SELECT, INSERT, UPDATE, DELETE ON charbhar.* TO 'fo_user'@'localhost'");
        $dbh = new tdb("root", "", "charbhar");
        if ($dbh->connection) {
            mysql_query('SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"');
            mysql_query('SET time_zone = "+00:00"');
            mysql_query("CREATE TABLE IF NOT EXISTS `bank` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `payee_name` varchar(100) NOT NULL,\n              `bank_name` varchar(100) NOT NULL,\n              `ac_no` varchar(50) NOT NULL,\n              `ifsc` varchar(50) NOT NULL,\n              `mobile` varchar(10) NOT NULL,\n              `email` varchar(200) NOT NULL,\n              `date` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `billing` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `receipt_no` varchar(10) NOT NULL,\n              `buyer_add` tinytext NOT NULL,\n              `date` varchar(20) NOT NULL,\n              `notes` tinytext NOT NULL,\n              `service_des` varchar(100) NOT NULL,\n              `qt` varchar(10) NOT NULL,\n              `rate` varchar(15) NOT NULL,\n              `st` varchar(10) NOT NULL,\n              `amt` varchar(10) NOT NULL,\n              `amt_word` varchar(50) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10");
            mysql_query("CREATE TABLE IF NOT EXISTS `coupons` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `utt` text NOT NULL,\n              `i1` text NOT NULL,\n              `t2` text NOT NULL,\n              `time` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=94");
            mysql_query("CREATE TABLE IF NOT EXISTS `daily_info` (\n              `id` int(4) NOT NULL AUTO_INCREMENT,\n              `date` datetime NOT NULL,\n              `last_day_regi` int(4) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `notifications` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `its_for` int(11) NOT NULL,\n              `nf_desc` text NOT NULL,\n              `link` tinytext NOT NULL,\n              `its_from` varchar(20) NOT NULL,\n              `nf_time` varchar(15) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=96");
            mysql_query("CREATE TABLE IF NOT EXISTS `recharge` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `user_id` int(11) NOT NULL,\n              `mobile` varchar(12) NOT NULL,\n              `amt` int(5) NOT NULL,\n              `time` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `referral_marketing` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `referrer` varchar(100) NOT NULL,\n              `user_id` int(11) NOT NULL,\n              `time` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `tmp_users` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `first_name` varchar(50) NOT NULL,\n              `last_name` varchar(50) NOT NULL,\n              `dob` date NOT NULL,\n              `gender` enum('male','female') NOT NULL,\n              `mobile` varchar(10) NOT NULL,\n              `email` varchar(100) NOT NULL,\n              `password` varchar(100) NOT NULL,\n              `activation_code` varchar(25) NOT NULL,\n              `reg_time` datetime NOT NULL,\n              `aprv_status` int(1) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `transfer_fund` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `transfer_to` int(11) NOT NULL,\n              `bank_id` int(11) NOT NULL,\n              `amt` int(5) NOT NULL,\n              `request_date` datetime NOT NULL,\n              `status` int(1) NOT NULL,\n              `transfer_date` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `users` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `user_id` int(11) NOT NULL,\n              `fb_id` int(50) NOT NULL,\n              `username` varchar(100) NOT NULL,\n              `password` varchar(25) NOT NULL,\n              `first_name` varchar(50) NOT NULL,\n              `last_name` varchar(100) NOT NULL,\n              `dob` date NOT NULL,\n              `gender` enum('male','female') NOT NULL DEFAULT 'male',\n              `email` varchar(100) NOT NULL,\n              `mobile` varchar(10) NOT NULL,\n              `balance` int(5) NOT NULL,\n              `coupons` varchar(10) NOT NULL,\n              `bank_id` int(11) NOT NULL,\n              `game_status` varchar(5) NOT NULL,\n              `unseen_notification` int(3) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `bank` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `payee_name` varchar(100) NOT NULL,\n              `bank_name` varchar(100) NOT NULL,\n              `ac_no` varchar(50) NOT NULL,\n              `ifsc` varchar(50) NOT NULL,\n              `mobile` varchar(10) NOT NULL,\n              `email` varchar(200) NOT NULL,\n              `date` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `billing` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `receipt_no` varchar(10) NOT NULL,\n              `buyer_add` tinytext NOT NULL,\n              `date` varchar(20) NOT NULL,\n              `notes` tinytext NOT NULL,\n              `service_des` varchar(100) NOT NULL,\n              `qt` varchar(10) NOT NULL,\n              `rate` varchar(15) NOT NULL,\n              `st` varchar(10) NOT NULL,\n              `amt` varchar(10) NOT NULL,\n              `amt_word` varchar(50) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10");
            mysql_query("CREATE TABLE IF NOT EXISTS `coupons` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `utt` text NOT NULL,\n              `i1` text NOT NULL,\n              `t2` text NOT NULL,\n              `time` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=94");
            mysql_query("CREATE TABLE IF NOT EXISTS `daily_info` (\n              `id` int(4) NOT NULL AUTO_INCREMENT,\n              `date` datetime NOT NULL,\n              `last_day_regi` int(4) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `notifications` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `its_for` int(11) NOT NULL,\n              `nf_desc` text NOT NULL,\n              `link` tinytext NOT NULL,\n              `its_from` varchar(20) NOT NULL,\n              `nf_time` varchar(15) NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=96");
            mysql_query("CREATE TABLE IF NOT EXISTS `recharge` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `user_id` int(11) NOT NULL,\n              `mobile` varchar(12) NOT NULL,\n              `amt` int(5) NOT NULL,\n              `time` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ");
            mysql_query("CREATE TABLE IF NOT EXISTS `referral_marketing` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `referrer` varchar(100) NOT NULL,\n              `user_id` int(11) NOT NULL,\n              `time` datetime NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ");