tuxbuddy
Members-
Posts
103 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
tuxbuddy's Achievements
Member (2/5)
0
Reputation
-
I am getting the following error: PHP Notice: Undefined offset: 25 in /var/www/notice.php on line 137, referer: http://10.14.236.192/watch2.php Any idea when does the errror gets display?
-
Can Anyone Help me understanding the code: <? $reportwhat_array = array( 'incidents_small_stat' => text('incidents_small_stat'), 'incidents_extended' => text('incidents_extended'), 'incidents_sla' => text('incidents_sla'), 'incidents_time' => text('incidents_time'), 'incidents_extended_incl_solution' => text('incidents_extended_incl_solution'), 'incidents_per_org_per_building' => text('incidents_per_org_per_building'), 'incidents_per_org_bld_solution' => text('report_incidents_per_org_per_building_incl_solution' ), 'incidents_report_short' => text('incidents_report_short' ) ); /** *Organisatie naam, Incident nummer, Samenvatting, Laatste twee lijnen in, interne notes, status, streefdatum */ function report_incidents_report_short() { global $main_time_where, $where, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; $table = new class_table; $table->table_columns = 4; $table->add_header_row( array( text('loginname'), '#', text('description'), text('notes'), text('status'), text('date_solv $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', i.desc_small AS description, status.name AS status, status.id AS sta users.firstname AS firstname, users.surname AS surname, users.id AS userid, users.loginname as log i.sla_date_solve_before AS solve_before, organisation.name as organisation_name, organisation.id a FROM '.$custom_table.' AS i, status, users LEFT JOIN organisation ON organisation.id = i.organisation_id '.$main_time_where.' '.$where. ' AND i.contact_id=users.id AND i.status_id = status.id '.$incident_limiter . ' ORDER BY organisation.name, loginname, status, i.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { // Get last 2 lines $boom = explode( "\n", $row['notes'] ); if( count($boom) > 2 ) { $notes = $boom[count($boom)-2] . "\n" . $boom[count($boom)-1]; } else { $notes = $row['notes']; } $table->add_row( array( '<img src="'.BASE_URL.'images/user_tiny.gif"><a href="users.php?usersaction=show&usersshowid='. '( <a href="users.php?usersaction=show&usersshowid='.$row['userid'].'">'.$row['loginname'].'</a> ) <b '<img src="'.BASE_URL.'images/organisation_tiny.gif"><a href="organisation.php?organisationaction=sho '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['dbid'].' nl2br($row['description']), nl2br(trim($notes)), '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a>', db_to_human_date( $row['solve_before'] ) ) ); } $GLOBALS['box']->add( text('incidents_report_short'), $table->finish() ); } /** * Show a report with incidents per organisation per building */ function report_incidents_per_org_per_building() { global $main_time_where, $where, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; // Store $orgName = ''; $bldName = ''; // All incidents $table = new class_table; $table->table_columns = 3; $table->add_header_row( array( text('status'), '#', text('description') ) ); $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', i.desc_small AS description, status.name AS status, status.id AS sta organisation.name AS organisation_name, buildings.name AS building_name FROM '.$custom_table.' AS i, status, organisation, buildings '.$main_time_where.' '.$where. ' AND i.organisation_id=organisation.id AND i.building_id=buildings.id AND i.status_id = status.id '.$i ' ORDER BY organisation_name, building_name, status, i.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { // show if new org if( $orgName != $row['organisation_name'] ) { $orgName = $row['organisation_name']; $table->add_header_line( $orgName ); } // Show if new building if( $bldName != $row['building_name'] ) { $bldName = $row['building_name']; $table->add_line( $bldName ); } $table->add_row( array( '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['dbid'].' nl2br($row['description']) ) ); } $GLOBALS['box']->add( text('incidents_per_org_per_building'), $table->finish() ); } /** * Show a report with incidents per organisation per building * * Show incidents with solution grouped by organisation and building */ function report_incidents_per_org_bld_solution() { global $main_time_where, $where, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; // Store $orgName = ''; $bldName = ''; // All incidents $table = new class_table; $table->add_header_row( array( text('status'), '#', text('description'), text('solution') ) ); $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', i.desc_small AS description, i.solution AS solution, status.name AS organisation.name AS organisation_name, buildings.name AS building_name FROM '.$custom_table.' AS i, status, organisation, buildings '.$main_time_where.' '.$where. ' AND i.organisation_id=organisation.id AND i.building_id=buildings.id AND i.status_id = status.id '.$i ' ORDER BY organisation_name, building_name, status, i.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { // show if new org if( $orgName != $row['organisation_name'] ) { $orgName = $row['organisation_name']; $table->add_header_line( $orgName ); } // Show if new building if( $bldName != $row['building_name'] ) { $bldName = $row['building_name']; $table->add_line( $bldName ); } $table->add_row( array( '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['dbid'].' nl2br($row['description']), nl2br($row['solution'] ) ) ); } $GLOBALS['box']->add( text('incidents_per_org_per_building'), $table->finish() ); } /** * Show a report with timeing information for incidents */ function report_incidents_time() { global $main_time_where, $where, $db2, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; $epoch_now = dmy_to_days_from_epoch( date( 'd' ), date( 'm' ), date( 'Y' ) ); $secs_now = ( date( 'H' ) * 3600 ) + ( date( 'i' ) * 60 ) + date( 's' ); // All incidents $table = new class_table; $table->table_columns = 3; $table->add_header_row( array( '#', text('description'), text( 'date_reported' ), text('date_started'), text( 'date_status $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', desc_small, date_started, date_reported, date_laststatuschange FROM '.$custom_table.' AS i'. $main_time_where.' '. $where. ' '. $incident_limiter ); while( $row=$GLOBALS['db']->fetch_array() ) { $date_reported = $row['date_reported']; $date_started = $row['date_started']; $date_laststatuschange = $row['date_laststatuschange']; $ta = db_time_to_array( $row['date_reported'] ); $epoch_reported = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_reported = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; // report -> now $offset = (( $epoch_now - $epoch_reported ) * 86400 ) + ( $secs_now - $secs_reported ); $hour = ( int )( $offset / 3600 ); $min = ( int )( ( $offset - ( $hour * 3600 ) ) / 60 ); if ( $min < 10 ) $min = '0' . $min; $date_reported .= '<br /><em>'.text( 'difference' ) . ' '. text('now') . ': ' . $hour . ':' . $min . ' ' . text( 'hour' $ta = db_time_to_array( $row['date_started'] ); if( ($ta[0]==0) &&($ta[1]==0) &&($ta[2]==0) &&($ta[3]==0) &&($ta[4]==0) &&($ta[5]==0) ) { $table->add_row( array( '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row[ nl2br($row['desc_small']), $date_reported, '-', '-' ) ); continue; } $epoch_started = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_started = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; $ta = db_time_to_array( $row['date_laststatuschange'] ); if( ($ta[0]==0) &&($ta[1]==0) &&($ta[2]==0) &&($ta[3]==0) &&($ta[4]==0) &&($ta[5]==0) ) { $table->add_row( array( '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row[ nl2br($row['desc_small']), $date_reported, '-', '-' ) ); continue; } $epoch_sc = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_sc = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; // Report -> start $offset = (( $epoch_started - $epoch_reported ) * 86400 ) + ( $secs_started - $secs_reported ); $hour = ( int )( $offset / 3600 ); $min = ( int )( ( $offset - ( $hour * 3600 ) ) / 60 ); if ( $min < 10 ) $min = '0' . $min; $date_started .= '<br /><em>'.text( 'difference' ) . ' '. text('date_reported') . ': ' . $hour . ':' . $min . ' ' . tex // started -> now $offset = (( $epoch_now - $epoch_started ) * 86400 ) + ( $secs_now- $secs_started ); $hour = ( int )( $offset / 3600 ); $min = ( int )( ( $offset - ( $hour * 3600 ) ) / 60 ); if ( $min < 10 ) $min = '0' . $min; $date_started .= '<br /><em>'.text( 'difference' ) . ' '. text('now') . ': ' . $hour . ':' . $min . ' ' . text( 'hour' // laststatuschange -> now $offset = (( $epoch_now - $epoch_sc ) * 86400 ) + ( $secs_now - $secs_sc ); $hour = ( int )( $offset / 3600 ); $min = ( int )( ( $offset - ( $hour * 3600 ) ) / 60 ); if ( $min < 10 ) $min = '0' . $min; $date_laststatuschange .= '<br /><em>'.text( 'difference' ) . ' '. text('now') . ': ' . $hour . ':' . $min . ' ' . text 297,0-1 47% // laststatuschange -> started $offset = (( $epoch_sc - $epoch_started ) * 86400 ) + ( $secs_sc - $secs_started); $hour = ( int )( $offset / 3600 ); $min = ( int )( ( $offset - ( $hour * 3600 ) ) / 60 ); if ( $min < 10 ) $min = '0' . $min; $date_laststatuschange .= '<br /><em>'.text( 'difference' ) . ' '. text('date_started') . ': ' . $hour . ':' . $min . ' $table->add_row( array( '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['db nl2br($row['desc_small']), $date_reported, $date_started, $date_laststatuschange ) ); } $GLOBALS['box']->add( text('incidents_time'), $table->finish() ); } /** * Shows SLA information per incident */ function report_incidents_sla() { global $main_time_where, $where, $db2, $uls_incident_limiter, $custom_table, $custom_id_fields; $amount_missed = 0; $amount_ok = 0; $amount_none = 0; $bar_chart = ''; $value_row = ''; $name_row = ''; $bar_chart = '<table cellspacing="20" height="200" align="center"><tr>'; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; $ta = db_time_to_array( now() ); $days_now = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_now = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; $epoch_now = ( $days_now * ( 3600 * 24 ) ) + $secs_now; $table_missed = new class_table; $table_missed->add_header_row( array( '#', text('status'), text('priority'), text('hour'), text('desc_small') ) ); $table_ok = new class_table; $table_ok->table_columns = 5; $table_ok->add_header_row( array( '#', text('status'), text('priority'), text('hour'), text('desc_small') ) ); $table_none = new class_table; $table_none->table_columns = 4; $table_none->add_header_row( array( '#', text('status'), text('priority'), text('desc_small') ) ); // Loop incidents $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', desc_small, i.date_reported AS date_reported, i.date_escalated AS date_escalated, status.name AS status, status.id AS statusid, priorities.id AS priorityid, priorities.name AS priority FROM '.$custom_table.' AS i LEFT JOIN status ON ( i.status_id = status.id ) LEFT JOIN priorities ON ( i.priorities_id = priorities.id ) '.$main_time_where.' '.$where. ' ' . $incident_limiter . 'ORDER BY status.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { // Get the last new sla_time from the logs $db2->query( 'SELECT sla_time, changed FROM '.$custom_table.'_log WHERE incident_id='.$row['id'].' AND sla_time IS NOT // Sla time found ! if( $db2->num_rows() > 0 ) { $log_row = $db2->fetch_array(); // Calc it back to seconds and check if we are still within the limits // date escalted has higher precidence and if set use that as a the base time // replace the date_reported with the escalation time if ( is_valid_date( $row['date_escalated'] ) && O_INC_USEESCALATION ) { $row['date_reported'] = $row['date_escalated']; } // Calc how many days from epoch this task is // Calc how many days from epoch this task is // Calc how many seconds from the start of the day the task is $ta = db_time_to_array( $row['date_reported'] ); $days_incident = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_incident = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; $epoch_incident = ( $days_incident * ( 3600 * 24 ) ) + $secs_incident; $ta = db_time_to_array( $log_row['changed'] ); $days_sla = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_sla = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; $epoch_sla = ( $days_sla * ( 3600 * 24 ) ) + $secs_sla; // Check if we are now past this date if( ( $epoch_sla + ( $log_row['changed'] * 3600 ) ) < $epoch_now ) { $table_missed->add_row( array( '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'sh '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status' '<a href="priorities.php?prioritiesaction=show&prioritiesshowid='.$row['priorityid'].'">' $log_row['sla_time'], $row['desc_small'] ) ); $amount_missed++; continue; } $table_ok->add_row( array( '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid=' '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="priorities.php?prioritiesaction=show&prioritiesshowid='.$row['priorityid'].'">'.$row[ $log_row['sla_time'], $row['desc_small'] ) ); $amount_ok++; continue; } // No sla $table_none->add_row( array( '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$r '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="priorities.php?prioritiesaction=show&prioritiesshowid='.$row['priorityid'].'">'.$row[ $row['desc_small'] ) ); $amount_none++; } // Create nice array $sla_array = array(); $sla_array[ text('sla_missed') ] = $amount_missed; $sla_array[ text('sla_ok') ] = $amount_ok; $sla_array[ text('sla_none') ] = $amount_none; $totals = $amount_ok + $amount_missed + $amount_none; if( $totals == 0 ) return; reset( $sla_array ); while( list($key,$value) = each($sla_array ) ) { $pct = ( $value / ($totals/100) ); $bar_chart .= '<td class="customReportReportIncidentsSlaColumnHolder"><table class="customReportReportIncidentsSlaColum $name_row .= '<td> '.$key.' <br /><em>'.number_format( $pct, 2).' %</em></td>'; $value_row .= '<td><small> ( '.$value.' '.text('of'). ' '. $totals . ' ) </small></td>'; } $bar_chart .= '</tr><tr>'.$name_row.'</tr><tr>'.$value_row.'</tr></table>'; $bar_chart = $GLOBALS['box']->data( text('status'), $bar_chart ); // Show it all in a template $GLOBALS['template']->show( 'report_incidents_sla.tpl', array( 'SLA_MISSED' => $GLOBALS['box']->data( text('sla_missed').' ('.$amount_missed.')', $table_ 'SLA_NONE' => $GLOBALS['box']->data( text('sla_none').' ('.$amount_none.')', $table_none->f 'SLA_OK' => $GLOBALS['box']->data( text('sla_ok').' ('.$amount_ok.')', $table_ok->finish() ) 'BAR_CHART' => $bar_chart ) ); } /** * Show all incidents categorized by their status */ function report_incidents_small_stat() { global $main_time_where, $where, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; $status_array = array(); $totals = 0; // Query $table = new class_table; $table->table_columns = 3; $table->add_header_row( array( text('status'), '#', text('desc_small') ) ); $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', desc_small, status.name AS status, status.id AS statusid FROM '.$custom_table.' AS i LEFT JOIN status ON ( i.status_id = status.id ) '.$main_time_where.' '.$where. ' '.$incident_limiter. 'ORDER BY status.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { if( ! isset( $status_array[$row['status']]) ) $status_array[$row['status']] = 0; $status_array[$row['status']]++; $totals++; $table->add_row( array( '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['dbid'].' $row['desc_small'] ) ); } $amount_incidents = $GLOBALS['db']->num_rows(); $incidents_box = $GLOBALS['box']->data( text('incidents').' ('.$amount_incidents.')', $table->finish() ); $bar_chart = ''; $name_row = ''; $value_row = ''; $bar_chart .= '<table cellspacing="20" height="200" align="center"><tr>'; reset( $status_array ); while( list($key,$value) = each($status_array ) ) { $pct = ( $value / ($totals/100) ); $bar_chart .= '<td class="customReportReportIncidentsSlaColumnHolder"><table class="customReportReportIncidentsSlaColum $name_row .= '<td> '.$key.' <br /><em>'.number_format( $pct, 2).' %</em></td>'; $value_row .= '<td><small> ( '.$value.' '.text('of'). ' '. $totals . ' ) </small></td>'; } $bar_chart .= '</tr><tr>'.$name_row.'</tr><tr>'.$value_row.'</tr></table>'; $bar_chart = $GLOBALS['box']->data( text('status'), $bar_chart ); $GLOBALS['template']->show( 'report_incidents_totals.tpl', array( 'INCIDENTS_BOX' => $incidents_box, 'BAR_CHART' => $bar_chart ) ); } } /** * Show a report with all incidents but without their solution */ function report_incidents_extended() { global $main_time_where, $where, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; // All incidents $table = new class_table; $table->table_columns = 3; $table->add_header_row( array( text('status'), '#', text('description') ) ); $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', i.description AS description, status.name AS status, status.id AS st FROM '.$custom_table.' AS i, status '.$main_time_where.' '.$where. ' AND i.status_id = status.id '.$incident_limiter . ' ORDER BY statusid, i.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { $table->add_row( array( '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['dbid'].' nl2br($row['description']) ) ); } $GLOBALS['box']->add( text('incidents_extended'), $table->finish() ); } /** * Show a report with all incidents and their solutions */ function report_incidents_extended_incl_solution() { global $main_time_where, $where, $uls_incident_limiter, $custom_table, $custom_id_fields; $incident_limiter = $uls_incident_limiter; if( $incident_limiter != '' ) $incident_limiter = ' AND '.$incident_limiter; // All incidents $table = new class_table; $table->table_columns = 4; $table->add_header_row( array( text('status'), '#', text('description'), text('solution') ) ); $GLOBALS['db']->query( 'SELECT '.$custom_id_fields.', i.description AS description, i.solution AS solution, status.name AS FROM '.$custom_table.' AS i, status '.$main_time_where.' '.$where. ' AND i.status_id = status.id '.$incident_limiter . ' ORDER BY statusid, i.id' ); while( $row=$GLOBALS['db']->fetch_array() ) { $table->add_row( array( '<a href="status.php?statusaction=show&statusshowid='.$row['statusid'].'">'.$row['status'].'</a '<a href="'.$custom_table.'.php?'.$custom_table.'action=show&'.$custom_table.'showid='.$row['dbid'].' nl2br($row['description']), nl2br($row['solution']) ) ); } $GLOBALS['box']->add( text('incidents_extended'), $table->finish() ); } ?>
-
Thanks for the suggestion.I think have been rude with my Open SOurce and that too with this forum writing like that way. Actly I dont want to Flood the forum with codes rather than the forum should have something where we can attach files and ask for help. is it there? Oh...I got it...Have a look.a the attachement ..If anyone who can help me tweaking with codes [attachment deleted by admin]
-
Hello Freakers, I need few PHP experts to help me out with my project work.I maynt be able to post my issues in this forum as it needs to be explained through mail.Its Not large project but something related to Timing Stuff. Its related to Open source TIcket Tracking Tool called HelpCORE which follows 24 past 7 timing which I need to fix it to my Office Timing. I welcome to those experts who are ready to help me out. Waiting for your Reply, Open Source Fan
-
I can see that lots of Helpdesk Ticket Tracking tool is present but the right SLA features are missing and if few have then its not free. Can anyone provide me with the code for Service Level Agreement realted to Support HelpDESK??
-
This is not just a code but complete project.Its a Tool called HelpCORE which is ticket Tracking tool. If you are ready to help me just download the project through this link : http://freshmeat.net/projects/helpcore/ It completely free version completely written in PHP. Are you ready to help me out??
-
HEllo Guys, I have a tool for cricket Tracking which is completely written in PHP.I need to change the ticket tracking HelpDESK tool to work for 9:00 to 6:00 rather than its 24*7 utility. Is this possible.Since I am newbie to PHP,I need your help. I will provide you with the overall details once anyone wish to help me out.
-
I have a tool called HelpCORE which is a ticket Tracking and Call Handling.The tool is 24*7 based support.In Our firm we have normal Office timing and so do we have 8 hours working support.Now How can I modify the tool so as to work a/c to my requirements. Here's the snippet which I think shall help us with fixing: File : time.php <?php /* * HelpCORE source file * ==================== * * CVS: * ---- * $header$ * * Purpose: * -------- * Date and Time related functions * * Copyright: * ---------- * Copyright (C) 2002-2003 Dennis Fleurbaaij <dennis@io-software.nl> * Copyright (C) 2002-2005 IO Software <info@io-software.nl> * * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software Foundation; * either version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this * program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. * * Please note that this software is dual licensed. For the commercial use of this * software you will need a Commercial License. Please see http://www.io-software.nl * for the terms and conditions. * * For more information you can contact IO Software at http://www.io-software.nl */ // Defines for easy handling of time define( 'TIME_YEAR', 2 ); define( 'TIME_MONTH', 1 ); define( 'TIME_DAY', 0 ); define( 'TIME_HOUR', 3 ); define( 'TIME_SECOND', 5 ); /** * Return the current microtime */ function stopwatch_start() { list( $usec, $sec ) = explode( " ", microtime() ); return ( ( float )$usec + ( float )$sec ); } /** * Return the time spent since the input time */ function stopwatch_stop( $starttime ) { list( $usec, $sec ) = explode( " ", microtime() ); return ( ( ( float )$usec + ( float )$sec ) - $starttime ); } /* * Db time to dfe */ function db_time_to_dfe( $db_time ) { return dmy_array_to_days_from_epoch( db_time_to_array( $db_time ) ); } /** * Calculates d m y to days from epoch */ function dmy_array_to_days_from_epoch( $array ) { return dmy_to_days_from_epoch( $array[0], $array[1], $array[2] ); } /** * calculates how long since the computer epoch we are */ function dmy_to_days_from_epoch( $day, $month, $year ) { if( ($timestamp=@gmmktime (1, 0, 0, $month, $day, $year)) === -1 ) { __FATAL__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Invalid timestamp( " D:'.$day.', M:'.$month.', Y:'.$year.' ) -> '.$timestamp.'" )' ); return 0; } return ($timestamp / 86400); } /** * Epoch to array */ function epoch_to_dmy( $epoch ) { // We use day-epcohs $epoch = $epoch * 86400; return( array( gmdate('d', $epoch), gmdate('m', $epoch), gmdate('Y', $epoch), gmdate('H', $epoch), gmdate('i', $epoch), gmdate('s', $epoch) ) ); } /** * Calculates EXACT dmy */ function exact_epoch_to_dmy( $epoch ) { return( array( gmdate('d', $epoch), gmdate('m', $epoch), gmdate('Y', $epoch), gmdate('H', $epoch), gmdate('i', $epoch), gmdate('s', $epoch) ) ); } /** * Calculates days to months and years */ function day_to_dmy_array( $days ) { global $month_days; $months = $month_days; $year = 1970; $month = 1; // Calc howmany years we have while ( true ) { // Count jaar (leapyear is counted later) $days -= 365; $year++; // Shrikkel if ( ( $year % 4 == 0 ) && ( $year % 100 != 0 ) ) { if ( $days < 366 ) { // echo "+ Break on leap ($year)<br />"; break; } $days--; // Normal } else { if ( $days < 365 ) { // echo "+ Normal break<br />"; break; } } } // echo "v- After yearcount we have $days days left.<br />"; // Calc months while( $days > $months[$month] ) { $days -= $months[$month]; $month++; } if( $days == 0 ) $days = 1; // echo "v- After monthcount we have $days days left.<br />"; if( $days < 10 ) $days = '0' . $days; if( $month < 10 ) $month = '0' . $month; // echo "Days: $days Month: $month Year: $year<br />"; return array( $days, $month, $year, '00', '00', '00' ); } /* * Integer to time function int_to_time( $time ) { $days = ''; $mins = $time % 60; $hours = ( int )( $time / 60 ); if( $mins < 10 ) { $mins = '0' . $mins; } $timestring = $hours . ':' . $mins; return $timestring; } /** * Seconds to time string */ function seconds_to_time( $time ) { $days = ''; $timestring = ''; $seconds = $time % 60; $mins = ( ( int )($time/60) ) % 60; $hours = ( int )( ($time/60) / 60 ); if( $mins < 10 ) { $mins = '0' . $mins; } if( $hours > 24 ) { $timestring .= ((int) ($hours/24) ) .' '.text('days').' '; $hours = $hours % 24; } $timestring .= $hours . ':' . $mins .':'.$seconds; return $timestring; } /** * returns now */ function now() { return array_to_db_time( array( date( 'd' ), date( 'm' ), date( 'Y' ), date( 'H' ), date( 'i' ), date( 's' ) ) ); } /** * Find out in what week this date is */ function date_to_weeknr( $date ) { if( ($timestamp=strtotime( $date ) ) === -1 ) { __ERROR__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Invalid timestamp: strtotime("'.$date.'") => "'.$timestamp.'"' ); } return date( 'W', $timestamp ); } /** * Find out on what day a week begins * Note: we can't do leap years so we just guess if the user does not know if it's a leap year */ function weeknr_to_date( $weeknr, $year) { global $month_days; $months = $month_days; if( $weeknr > 53 ) __FATAL__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'weeknr_to_date(): week cannot be larger then 53.' ); // There is no week 53, it's week one of the next year if( $weeknr == 53 ) { return array_to_db_date( array( '01', '01', ($year+1) ) ); } // No week zero and start counting at one $weeknr_days = (($weeknr-1) * 7)+1; // The second problem is finding out what day this year started. As not all years start at monday but all weeks DO ! $offset_day = date( 'w', mktime (0,0,0,1,1,$year) ) - 1; // Minus one because php starts at sunday and the world(c) at monday //echo $offset_day.'<br />'; // Now fix the weernr days to start not at monday but at the actual day, this is probmeatic as we can go back in time if( $offset_day >= $weeknr_days ) { // Goes back a year //echo " weeknr_to_date($weeknr, $year): PREV YEAR EXECPT array_to_db_date( array( ( 31 - $offset_day ), '12', ($year-1) ) ): ".array_to_db_date( array( ( 31 - $offset_day ), '12', ($year-1) ) )."<br /><br />"; return array_to_db_date( array( ( 32 - $offset_day ), '12', ($year-1) ) ); // Dec has 32 days to compensate for 0-1 } // Remains in this year else { $weeknr_days -= $offset_day; } //echo " weeknr_to_date($weeknr, $year): weeknr_days: $weeknr_days<br />"; // Schrikkeljaar if ( $year % 4 == 0 ) { $months[02] = 29; } $month = 1; while( $weeknr_days >= $month_days[$month] ) { //echo " weeknr_to_date($weeknr, $year): while( $weeknr_days >= ".$month_days[$month]." )<br />"; $weeknr_days -= $month_days[$month]; $month++; } //echo " weeknr_to_date($weeknr, $year): return array_to_db_date( array( $weeknr_days, $month, $year ) ): ".array_to_db_date( array( $weeknr_days, $month, $year ) )."<br /><br />"; if( $weeknr_days < 10 ) $weeknr_days = '0' . (int)$weeknr_days; if( $month < 10 ) $month = '0' . (int)$month; return array_to_db_date( array( $weeknr_days, $month, $year ) ); } ?> Pls help
-
I have written a login script during the user inputs it shows the password being written in plain text.I want to write it in dot-dot or encryted way as usual website has. How can I do that??
-
HI, I have written a PHP Script for Login with MySQl database as backened. Now my manager wants me to allow logging in through NIS. How gonna it be possible?Any Idea?
-
Great !!! I did it happen...I passed the query like this: SELECT incidents.id,incidents.description,users.firstname FROM incidents,users where (incidents.contact_id = '".$uid."') AND (incidents.owner_id = users.id) OR (incidents.owner_id = NULL) But it is showing now: ID DEscription EngineerNAme 9 install IOS prabhu But the entry corresponding to NULL is not shown.
-
More Clearly, if we run the query: SELECT incidents.id, incidents.description, incidents.owner_id FROM incidents, users WHERE incidents.contact_id = users.id LIMIT 0 , 30 id description owner_id 36 Install Mandriva NULL 26 test1 7 37 asd;lfkasd;fkjas NULL 38 install redhat5 on26 server NULL 39 install perl NULL 40 install informix NULL 13 at 1 24 test 1 34 asdfgasdgsdf NULL Instead of 7,NULL from incidents table it shoud display firstname , surname corresponding to owner_id
-
Now this query is working: SELECT t1.id, t1.description, t2.firstname FROM incidents AS t1 INNER JOIN users AS t2 ON ( t1.contact_id = t2.id ) AND ( t1.contact_id =9 ) LIMIT 0 , 30 The Output Being: 38 install redhat5 on26 server venkat 39 install perl venkat Heyyy... I dont want Venkat to be displayed ...It should display value realted to owner_id not for contact_id. In the above table , the output shud be like: 38 install redhat5 on26 server NULL 39 install perl venkat prabhu Just note that NULL shoud also be shown and if any other value other than NULL is there it should also get displayed In incident table we have owner_id and the table should display corresponding to id , name of the engineer who will work for the project.
-
Its showing error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN users AS T2 ON (T1.contact_id = T2.id) (T1.contact_id = 9) LIMIT ' at line 1 Pls post the right query syntax
-
There is a table called “ incidents “.Recently I (venkat) raised a call to ISD People that I need Ettercap tool to be installed.So When I raised a call the incident got ID = 41,description as specified. Since noone has accepted call from ISD side it is showing NULL under owner_id. Heres the complete table structure: Incidents ID Description contact_id Owner_id 41 install ettercap 9 NULL Now here one important thing to consider is NULL under Owner_id refers to that No Engineer has yet taken responsibilty to carry on the issue.Once it is accepted by engineer on its ownself,it becomes that engineer ID. Also,There is another table called Users. Table:Users ID firstname surname loginname 9 venkat saraswathi saraswathiv The Contact ID in incident table is same as ID on users table. Now I am running this query: SELECT incidents.id,incidents.description,users.firstname,users.surname FROM incidents,users where (incidents.contact_id = 9) AND (incidents.contact_id = users.id) All it displays: --------------------------------------------------------------------------------- ID Description Engineers Firstname Engineers Surname 38 install redhat5 on26 server venkat 39 install perl venkat 35 sdvfzsdgvsdfb venkat 41 Pls install Ettercap on 10.14.2.42 venkat ------------------------------------------------------------------------ What I want is display the following way: ID Description EngineersNAME 41 Install Ettercap Prabhu Engineers NAME should nt be ID but name.Simply passing the query: select id,description,owner_id from incident where incidents.id= 9 will retrieve owner_id but I want ownerNAME ...