Hi Guys,
I have a table that has a field “mod_user_permissions”. Currently it posts the all the textboxes, I want it as follow :
If the value = 1 post as follow :
[php]
$output = “<form name=“main” method=“post”>”;//Output is set as a POST function
$output = $output . “
User Id | ” . $user->get_airtime_user_id () . “ | ||||||||||
CDR Download permission | |||||||||||
SIM Summary download permission | |||||||||||
Allow user management | |||||||||||
Allow permission management | |||||||||||
Allow access to custom reports | |||||||||||
Allow access to interactive reports | |||||||||||
Username | |||||||||||
Password | |||||||||||
Parent User | |||||||||||
<a href=“javascript:saveUser(” . $user->get_airtime_user_id () . “);”>Save User”;
[/php] If that value = 0 I want to post the following : [php]
[/php] Here is my login class, what can I add to do this whole procedure… [php] <?php error_reporting(E_ERROR); require_once ('config.php'); require_once('Class.MySQL.Lite.php'); class EvoAirtime { private $db; public function EvoAirtime() { global $site; //initialize DB logic $this->db = new MySQL_Lite_ABS($site['db']); } public function Login($username, $password) { $cmd = "select airtime_user_id, passwd_change_flag, mod_download_cdr, mod_download_sim_summary, mod_user_add, mod_user_permissions, mod_custom_reports, logo_file, mod_interactive_report, is_admin, mod_admin_tools FROM airtime_users where username = '" . $this->CheckInjection($username) . "' and passwd = '" . md5($password) . "'"; if(!$result = $this->db->RetrieveCommandExec($cmd)) { echo($this->db->GetError()); return false; } else { session_start(); $_SESSION['auth']['user'] = $this->CheckInjection($username); $_SESSION['auth']['user-id'] = $result[0]['airtime_user_id']; $_SESSION['auth']['passwd-change'] = $result[0]['passwd_change_flag']; $_SESSION['auth']['mod-download-cdr'] = $result[0]['mod_download_cdr']; $_SESSION['auth']['mod-download-sim-summary'] = $result[0]['mod_download_sim_summary']; $_SESSION['auth']['mod-user-add'] = $result[0]['mod_user_add']; $_SESSION['auth']['mod-user-permissions'] = $result[0]['mod_user_permissions']; $_SESSION['auth']['mod-custom-reports'] = $result[0]['mod_custom_reports']; $_SESSION['auth']['mod-interactive-reports'] = $result[0]['mod_interactive_report']; $_SESSION['auth']['is-admin'] = $result[0]['is_admin']; $_SESSION['auth']['mod-support-tools'] = $result[0]['mod_admin_tools']; $_SESSION['auth']['logo-file'] = $result[0]['logo_file']; return true; } return false; } //Function added by chris to check mod_user_permission public function CheckPermission() { $cmd = "SELECT airtime_users.mod_user_permissions FROM airtime_users where airtime_users.mod_user_permissions = " .$this->Login('mod_user_permissions'); return $this->db->RetrieveCommandExec($cmd); } public function LoadStandardAirtimeReport($user, $period, $endPeriod="") { $billing_period = $this->CheckInjection($period); $billing_period_end = $this->CheckInjection($endPeriod); $user = $this->CheckInjection($user); $cmd = "SELECT rated_eventsdata.imsi AS 'IMSI' , rated_eventsdata.msisdn as 'MSISDN' , rated_eventsdata.call_type AS 'Call Type' , ROUND(CASE rated_eventsdata.label WHEN 'bytes' THEN SUM(rated_eventsdata.units)/1000000 ELSE SUM(rated_eventsdata.units)/60 END, 2) AS 'Total Units' , CASE rated_eventsdata.label WHEN 'bytes' THEN 'MB' ELSE 'Minutes' END AS 'Unit Type' FROM evobilling.airtime_user_sims INNER JOIN evobilling.packages ON (airtime_user_sims.package_id = packages.package_id) INNER JOIN evobilling.rated_eventsdata ON (packages.imsi = rated_eventsdata.imsi)"; /* Append the where clause based on the date values provided */ if($endPeriod != "") { /* The start and end dates for this is a Hack - need to calculate acurate start and end dates based on billing periods using date functions. */ $dtStart = $billing_period . "-01"; $dtEnd = $billing_period_end . "-31"; $cmd = $cmd . " WHERE airtime_user_sims.airtime_user_id = $user AND rated_eventsdata.event_id < 1999 AND call_date between '$dtStart' and '$dtEnd'"; } else { $cmd = $cmd . " WHERE airtime_user_sims.airtime_user_id = $user AND rated_eventsdata.event_id < 1999 AND SUBSTRING(call_date FROM 1 FOR 7) = '$billing_period'"; } $cmd = $cmd . " GROUP BY rated_eventsdata.imsi,rated_eventsdata.msisdn, packages.note, rated_eventsdata.call_type"; /* Retrieve the results now */ if(!$result = $this->db->RetrieveCommandExec($cmd)) { return "Unable to locate any data for the Billing period selected. If you believe in error, please contact technical support and provide the following information
| |||||||||||
" . $this->KeyName($arr, $i) . " | "; } $ret .= "|||||||||||
"; } else { $ret .= " | " . $fld . " | "; } } $ret .= "