-rwxrwxrwx read, write, & execute for owner, group and others mkdir($directoryName, 0777); } // create visitor log file date wise $visitorLogFileName = date('Y-m-d').'.txt'; // get ip address of visitor $visitorIP = $_SERVER['REMOTE_ADDR']; $visitorLogFileFullDirectory = $directoryName.'/'.$visitorLogFileName; $visitorVisitedURL = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $visitorInfoToWrite = ' =========================== IP: '.$visitorIP .' Time: '.date('Y/m/d H:i:s a').' Filename: '.basename($_SERVER['PHP_SELF']).' URL: '.$visitorVisitedURL.' '; // put the file in under visitor directory file_put_contents($visitorLogFileFullDirectory, $visitorInfoToWrite, FILE_APPEND); /** * *********************** END **************************** */ /**Smarty Object */ $smarty = new Smarty(); /**Smarty Templating Related Directories */ $smarty->template_dir = dirname(__FILE__).'/templates'; $smarty->compile_dir = dirname(__FILE__).'/templates_c'; /**Database Object*/ $db_table_tutorial_rifayet = new Tutorial_Rifayet($db); $db_table_tutorial_rifayet_practice_1 = new Tutorial_Rifayet_Practice_1($db); $db_table_tutorial_rifayet_practice_2 = new Tutorial_Rifayet_Practice_2($db); /**Create Data in tutorial_rifayet table */ if(DATA_CREATE_CONTROL == "0") { // data create enabled $rowData = array( "firstName" => "First Name ".rand(50, 56230), "lastName" => "Last Name ".rand(50, 56230), "address" => "Address ".rand(50, 56230), "zip" => "ZIP ".rand(1000, 9999) ); $create_success = $db_table_tutorial_rifayet->create($rowData); /** * asign create_success variable to access this in * index.tpl presentation file * assign: makes available this variable in .tlp file * assign(variableNameToBeAvailableIn_TPL_file, value) */ $smarty->assign("create_success", "ID ".$create_success . " is created."); } else { // data create disabled $message = "[New data creation is disabled for Tutorial_Rifayet.]
But it can be enabled by module's specified define file.
"; $smarty->assign("create_success", $message); } /** */ /**Create Data in tutorial_rifayet_practice_1 table */ if(PRACTICE_1_DATA_CREATE_CONTROL == "0") { // create control enabled $username = "User".rand(1, 10000); $phone = "+8801" . rand(5,9) . rand(10,99) . "-" . rand(100000, 999999); $rowData = array( "username" => $username, "email" => $username . "@uxd.co.jp", "phone" => $phone ); $practice_1_create_success = $db_table_tutorial_rifayet_practice_1->create($rowData); $smarty->assign("practice_1_create_success", "ID ".$practice_1_create_success . " is created."); } else { // data create control disabaled $message = "[New data creation is disabled for Tutorial_Rifayet_Practice_1.]
But it can be enabled by module's specified define file.
"; $smarty->assign("practice_1_create_success", $message); } /** */ /**Create Data in tutorial_rifayet_practice_2 table */ if(PRACTICE_2_DATA_CREATE_CONTROL == "0") { // data create enabled $rowData = array( "companyName" => "Company Name".rand(10, 5623), "description" => "Description".rand(10, 5623), "country" => "Country".rand(10, 5623) ); $practice_2_create_success = $db_table_tutorial_rifayet_practice_2->create($rowData); $smarty->assign("practice_2_create_success", "ID ".$practice_2_create_success . " is created."); } else { // data create disabled $message = "[New data creation is disabled for Tutorial_Rifayet_Practice_2.]
But it can be enabled by module's specified define file.
"; $smarty->assign("practice_2_create_success", $message); } /** */ /**Data display for tutorial_rifayet table */ $read_data = $db_table_tutorial_rifayet->read(); // print_r($read_data); // see raw data $smarty->assign("tutorial_rifayet_data_all", $read_data); /** */ /**Data display for tutorial_rifayet_practice_1 table */ $practice_1_read_data = $db_table_tutorial_rifayet_practice_1->read(); // print_r($practice_1_read_data); $smarty->assign("tutorial_rifayet_practice_1_data_all", $practice_1_read_data); /**Data display for tutorial_rifayet_practice_2 table */ $practice_2_read_data = $db_table_tutorial_rifayet_practice_2->read(); $smarty->assign("tutorial_rifayet_practice_2_data_all", $practice_2_read_data); /**Module Program Start */ $smarty->assign("appName", APP_NAME); $smarty->assign("dbName", DB_NAME); $smarty->assign("dbTableName", TABLE_NAME); $smarty->assign("dbTableNamePractice1", TABLE_NAME_PRACTICE_1); $smarty->assign("dbTableNamePractice2", TABLE_NAME_PRACTICE_2); $smarty->assign("moduleName", MODULE_NAME); $smarty->assign("title", MODULE_HTML_TITLE); $smarty->assign("name", MODULE_HTML_TITLE_NAME); $smarty->display('index.tpl'); /**Module Program End */ ?>