Jump to content

tuxbuddy

Members
  • Posts

    103
  • Joined

  • Last visited

    Never

Everything posted by tuxbuddy

  1. I have written a login script which when user logins is redirected to new page.Here are the codes: File: login.php <html><table width="300" border="1" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <p> <body bgcolor="#d0d0d0"> <img src="helpcore.jpg" align="center"> </p> <br><iframe src="http://free.timeanddate.com/clock/iz28p1x/n438/fc969/tccff/pcff9/ftb/bas2/bat6/bacf00/tt0/td1/tb3" frameborder="1" width="326" height="22"></iframe> </br><br> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Member Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Login"></td> <td><br><a href="forget.php"><i>Forgot your password?</i></a><td><a href="register.php">Register</a></td> </tr> </table> </td> </form> </tr> </table> </html> File : checklogin.php <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="mysql123"; // Mysql password $db_name="helpcore"; // Database name $tbl_name="users"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string ($mypassword); $sql="SELECT * FROM $tbl_name WHERE loginname='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; //echo "You need to register to login.Go Back and click on "Register" button."; } ?> If the login is successful,then.he is redirected to: File:login_sucess.php <? session_start(); if(session_is_registered(myusername)){ #header("location:http://10.14.2.36/HelpCORE/modules_helpcore_public"); echo "<meta http-equiv='refresh' content='0;url=http://10.14.2.36/HelpCORE'>"; } ?> <html><body> Login Successful. </body></html> Now the new page gets displayed where I want to display like say: Welcome $username And then the other content.How can I carry the variable to this new page. Pls Help
  2. I have taken snippet of code from a tool called HelpCORE.Here a submit button is there which when clicked displays the query for incidents taken place from database table. As you can see below in the code few variables it is fetching and able to display.But I need some help regarding the following lines : $GLOBALS['box']->add( text( 'reporter' ), '<FORM method="GET" action="' . BASE_URL . 'module_helpcore_public/reporter.php"> <INPUT type="submit" value="'.text('finished').'"> <INPUT type="hidden" name="incidentsaction" value="show"></SPAN><br />' ); It displays a button called finished which when clicked goes to fetch reporter.php page..but if yu see below code,I have used it for two times separately for Open and finished Can someone help me to write both the options under one box and separate link say, reporter.php should be called if open is clicked and reporter2.php shoud be fetched if finished is clicked. Below is the complete code. if ( ! include( '../coreapm/coreapm.php' ) ) { die( 'Cannot include CORE APM' ); } if( ! ( O_PUBLIC_SHOWINCIDENTSTATUS && USE_INCIDENTS ) ) { $GLOBALS['box']->add( text( 'warning' ), text( 'administrator_disabled' ) ); $coreapm->finish(); die; } $GLOBALS['cache']->no_cache = true; $coreapm->start(); $GLOBALS['box']->add( text( 'fill_in_incidentnumber' ), '<SPAN class="center">' . text( 'incidentnumber' ) . '<FORM method="GET" action="' . BASE_URL . 'module_helpcore_public/incidents.php?incidentsaction=show"><INPUT type="text" name="incidentsshowid" maxlength=32 size=32><INPUT type="submit" value="'.text('search').'"><INPUT type="hidden" name="incidentsaction" value="show"></SPAN><br />' ); $GLOBALS['box']->add( text( 'reporter' ), '<FORM method="GET" action="' . BASE_URL . 'module_helpcore_public/reporter.php"> <INPUT type="submit" value="'.text('open').'"> <INPUT type="hidden" name="incidentsaction" value="show"></SPAN><br />' ); $GLOBALS['box']->add( text( 'reporter' ), '<FORM method="GET" action="' . BASE_URL . 'module_helpcore_public/reporter.php"> <INPUT type="submit" value="'.text('finished').'"> <INPUT type="hidden" name="incidentsaction" value="show"></SPAN><br />' ); $coreapm->finish(); ?> Pls Help
  3. Can you have your email ID?Its possible to send yu project details through this post.Anyway I will send you a few details and we can post here the process we adopted to carry on further issues Waiting for yur reply.
  4. Thanks Man...You have helped me a lot...I will check that too... Can you ask you for a decent help..? If really you think you can be helpful for me for my project. I have discussed it too in this forum but I dont see any reponse till now. Lemme discuss this with you too. I have a new PHP Developer recently joined a company.this is a time to impress my manager and I want a helpful hands for that..I hope you gonna help me with my project work ahead. Have you tried a ticket tracking tool called "HelpCOre" It is Open Source and completely in PHP. Now its recent version is 1.7 which is commercial but before that ie. 1.6 it was free.I downloaded the tool. But there are lots of thing my manager wants me to add up. Like timing,SLA stuffs etc.Now I am working for Registration and email verification stuff.But I need your help in TIming as it is totally confusing. Its difficult to understand the tool created by other people..but since Its urgent to be implemented I need to add up few features. If you can , then I can help you installing the tool..all you need is see on this tool and add up two major things--timing and SLA suffs etc. Will you help me wiht this??/
  5. I will try implementing.But you dint reply how I gonna take group_id value. I am seeing two GROUP tables which I have named "PROJECT" Here's the code: <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="group_id"VALUE="<?php echo $group_id ?>" SIZE="20"></TD></TR> <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="<? echo $row["id"];?>" ><? echo $row["name"]; ?> </options><? } ?></select></TD></TR> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html> if I delete the first text box then where it gonna select group_id value. What about the second text value????It is not taking group_id as we dint mention. Pls help
  6. Can you plz help me with this?I am not able to understand how yu gonna implement that. You can see the codes above.Can you help me out writing this code? Pls....
  7. Not exactly....I want him to select GROUPNAME during the registration page but when the data gets inserted into the database it shoud be group_id not groupname... That means before inserting the data during insert.php,we should retrieve group_id from groupname(from tabel named groups)...
  8. Hello Guys, I have written a code for my registration page which after being submitted will move data into the database.I have few registration inputs like ID, FirstNAme,SecondName,Title,Group etc.Now corresponding to that,I have database entry like id,firstname,secondname,title but GROUP is all I am interested to talk about. Actually,I have designed a page to accept project as NAME through dropdown list retrieving values from mysql database.....but the database is not having an entry as NAME..rather it has entry called group_id. Now What I want is After user inputs the Groupname,corresponding to that I have a table called groups..so it should retrieve group_id from that and then it should actually insert into the required table. In short, 1. User input the data into registration page. 2. He will select groupname from dropdown list 3. We wont put it directly into database 4. But retrieve group_id from groupname(----<<< Transition state) 5.And then addu group_id into "users" table(the ultimate database to enter) Heres my codes: File : register.php ------------------------ <?php $con=mysql_connect("localhost","root","mysql123"); mysql_select_db("helpcore",$con); $sql=mysql_query("select name from groups"); ?> <html><title>User Registration Page</title> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <p> <body bgcolor="#d0d0d0"> <img src="helpcore.jpg" align="center"> </p> <form action="insert.php" method="post"> <!--<INPUT TYPE="HIDDEN" NAME="action" VALUE="register">--> <DIV ALIGN="CENTER"><CENTER> <TABLE BORDER="1" WIDTH="90%"> <h1> User Registration Form</h1> <TR> <TH WIDTH="30%" NOWRAP>Title</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="title"VALUE="<?php echo $title ?>" SIZE="8" MAXLENGTH="8"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Letters</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="first_letters" VALUE="<?php echo $first_letters ?>" SIZE="20"></TD> </TR> <TR> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="firstname" VALUE="<?php echo $firstname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Middle Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="middlename" VALUE="<?php echo $middlename ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Last Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="lastname" VALUE="<?php echo $lastname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Surname</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="surname" VALUE="<?php echo $surname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Email</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="email" VALUE="<?php echo $email ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Telephone Nr.</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="telnr" VALUE="<?php echo $telnr ?>" SIZE="20"></TD> <TR> <TR> <TH WIDTH="30%" NOWRAP>login Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="loginname" VALUE="<?php echo $loginname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Password</TH> <TD WIDTH="70%"><INPUT TYPE="PASSWORD" NAME="password" SIZE="15"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>[color=red]GROUP[/color]</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="group_id"VALUE="<?php echo $group_id ?>" SIZE="20"></TD></TR> <TR> <TH WIDTH="30%" NOWRAP>[color=red]GROUP[/color]</TH> <TD WIDTH="70%"><select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="" ><? echo $row["name"]; ?></options><? } ?></select></TD></TR> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html> After user inut the values,a temporary database is updated: File:insert.php <?php $firstname=$_POST['firstname']; $surname=$_POST['surname']; $email=$_POST['email']; $password=$_POST['password']; $loginname=$_POST['loginname']; $telnr=$_POST['telnr']; $rooms_id=$_POST['rooms_id']; $organisation_id=$_POST['organisation_id']; $middlename=$_POST['middlename']; [color=red]$group_id=$_POST['group_id'];[/color] $department_id=$_POST['department_id']; $loc_telnr=$_POST['loc_telnr']; $title=$_POST['title']; $first_letters=$_POST['first_letters']; $con = mysql_connect("localhost","root","mysql123"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("helpcore", $con); $sql="INSERT INTO member (firstname, surname, email, password, is_admin, loginname, personeelsnummer, allowed_to_log_in, telnr, rooms_id, may_log_in, ip, session_key, last_contact, initial_contact, last_visited_page, organisation_id, middlename, [color=red]group_id[/color], department_id, building_id, loc_telnr, global_view, sla_level_id, title, first_letters, session_use_alerts,notes) VALUES ('$firstname','$surname','$email','$password',0,'$loginname',NULL,NULL,'$telnr','$rooms_id',0,'127.0.0.1',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00',NULL,NULL,'$middlename',NULL,NULL,NULL,'$loc_telnr',0,0,'$title','$first_letters',0,'GET')"; $result=mysql_query($sql); if($result){ #if (!mysql_query($sql,$con)) # { # die('Error: ' . mysql_error()); # } #include("banner.gif"); #include("mailing.php"); #echo "Thanks for the Registration.Your Record has been sent for Approval.Kindly wait for the PETP Approval Mail"; $to="ajeet.singh.raina@logicacmg.com"; // Your subject $subject="Activation Request Mail"; // From $header="This mail is automatically generated from PETP-INSTALL NEW TICKET TRACKIING TOOl "; // Your message $message="A New User has registered for an account\n"; $message="This mail is regarding a New User Account Activation \r\n"; $message.="Click on this link to activate his account \r\n"; $message.="http://10.14.2.36/petp/activation.php?passkey=$loginname"; // send email $sentmail = mail($to,$subject,$header,$message); //mail(ajeet.singh.raina@logica.com,Test,Test,test); //echo " Kindly Check your mail for final arrpoval status"; } // if not found else { echo "Not found your email in our database"; } // if your email succesfully sent if($sentmail){ echo "Thanks for the Registration\n."; echo "You will soon receive an activation mail from INSTALL TEAM."; } else { echo "Cannot send Confirmation link to your e-mail address"; } mysql_close($con) ?> How can I insert not the GROUPNAME but groupid to that? Thanks in advance., Pls Help
  9. Wait...One minute...Still In trouble. Now your code displays two projects...Heeyyyy I need it to display : Project |-----------| only once .... But is displays project two times. Pls Help
  10. Its Done.I simply removed the line <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="group_id" VALUE="<?php echo $group_id ?>" SIZE="20"> and now the code is <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="" ><?echo $row["name"]; ?></options><? } ?></select> </td></tr> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> But tell me one thing...Earlier I was storing the Project value which the user inputs into one table BUt how will I fetch this by which name. Pls Help
  11. Heyy....Again its not solved..Displaying two textboxes. in front of Project.....Here;s the complete code: <html><title>User Registration Page</title> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <p> <body bgcolor="#d0d0d0"> <img src="helpcore.jpg" align="center"> </p> <form action="insert.php" method="post"> <INPUT TYPE="HIDDEN" NAME="action" VALUE="register"> <DIV ALIGN="CENTER"><CENTER><TABLE BORDER="1" WIDTH="90%"> <h1> User Registration Form</h1> <?php $con=mysql_connect("localhost","root","mysql123"); mysql_select_db("helpcore",$con); $sql=mysql_query("select name from groups"); ?> <TR> <TH WIDTH="30%" NOWRAP>Title</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="title" VALUE="<?php echo $title ?>" SIZE="8" MAXLENGTH="8"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Letters</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="first_letters" VALUE="<?php echo $first_letters ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="firstname" VALUE="<?php echo $firstname ?>" SIZE="20"></TD> VALUE="<?php echo $firstname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Middle Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="middlename" VALUE="<?php echo $middlename ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Last Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="lastname" VALUE="<?php echo $lastname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Surname</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="surname" VALUE="<?php echo $surname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Email</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="email" VALUE="<?php echo $email ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Telephone Nr.</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="telnr" VALUE="<?php echo $telnr ?>" SIZE="20"></TD> </TR> <TR> <TR> <TH WIDTH="30%" NOWRAP>login Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="loginname" VALUE="<?php echo $loginname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Password</TH> <TD WIDTH="70%"><INPUT TYPE="PASSWORD" NAME="password" SIZE="15"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="group_id" --------<<< POINT OF INTEREST VALUE="<?php echo $group_id ?>" SIZE="20">[/color]<select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="" ><?echo $row["name"]; ?></options><? } ?></select></td></tr> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html>
  12. ya...I got the point but its dsplaying two text box.I need to display only one. What abt VALUE="<?php echo $group_id ?>" SIZE="20"> I think this line is creating a problem. How will I remove that???Pls write me code from Heres my last few lines of code now: <TR> <TH WIDTH="30%" NOWRAP>login Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="loginname" VALUE="<?php echo $loginname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Password</TH> <TD WIDTH="70%"><INPUT TYPE="PASSWORD" NAME="password" SIZE="15"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="group_id" VALUE="<?php echo $group_id ?>" SIZE="20"> <?php include('config.php'); ?><?php $sql=mysql_query("select name from groups"); ?> <select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="" ><?echo $row["name"]; ?></options><? } ?></select></td></tr> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html>
  13. Thanks for the code its working but displaying out of table.Can you write the code for me?I tried but wonder where to place the code at right place. Here where I need to put at: <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="group_id" VALUE="<?php echo $group_id ?>" SIZE="20"> <?php include('config.php'); ?><?php $sql=mysql_query("select name from groups"); ?> <select name ="name"> <? while($row=mysql_fetch_array($sql)) { ?> <option value="" ><?echo $row["name"]; ?></options><? } ?></select></td></tr> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> I showing both the text box.Will removing the first will enter the same into database correctly. help Me Pls with complete code
  14. Missed it: The Group table has the following columns: id,name,description,maint_cyclus,sla_level_id,notes
  15. I have created a registration page like shown below.In the Project section,I need to let user select from the drop down list.That too should be fetched from the database table called "groups". Can anyone help how gonna I do that Stuff?? File : register.php <html><title>User Registration Page</title> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <p> <body bgcolor="#d0d0d0"> <img src="helpcore.jpg" align="center"> </p> <form action="insert.php" method="post"> <INPUT TYPE="HIDDEN" NAME="action" VALUE="register"> <DIV ALIGN="CENTER"><CENTER><TABLE BORDER="1" WIDTH="90%"> <h1> User Registration Form</h1> <TR> <TH WIDTH="30%" NOWRAP>Title</TH> <TD WIDTH="70%"> <INPUT TYPE="TEXT" NAME="title" VALUE="<?php echo $title ?>" SIZE="8" MAXLENGTH="8"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Letters</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="first_letters" VALUE="<?php echo $first_letters ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>First Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="firstname" VALUE="<?php echo $firstname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Middle Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="middlename" VALUE="<?php echo $middlename ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Last Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="lastname" VALUE="<?php echo $lastname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Surname</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="surname" VALUE="<?php echo $surname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Email</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="email" VALUE="<?php echo $email ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Telephone Nr.</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="telnr" VALUE="<?php echo $telnr ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>login Name</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="loginname" VALUE="<?php echo $loginname ?>" SIZE="20"></TD> </TR> <TR> <TH WIDTH="30%" NOWRAP>Password</TH> <TD WIDTH="70%"><INPUT TYPE="PASSWORD" <TR> <TH WIDTH="30%" NOWRAP>Project</TH> <TD WIDTH="70%"><INPUT TYPE="TEXT" NAME="group_id" VALUE="<?php echo $group_id ?>" SIZE="20"></TD> </TR> </table> <input type="submit" value="Submit"> <input type="reset" name="Reset" value="Reset"> </table> </html>
  16. I Missed to include one file : Here it is : File : corepm.php <?php // Hack voor intern bij externe hosting if(!isset($_SERVER['QUERY_STRING'])) $_SERVER['QUERY_STRING'] = ''; // only load once, the second time just give the coreapm object if ( defined( 'COREAPM_LOADED' ) ) { $coreapm = $GLOBALS['coreapm']; return true; } else { define( 'COREAPM_LOADED', true ); // Defines define( 'PLUGIN_NAME', 0 ); define( 'PLUGIN_VERSION', 1 ); define( 'PLUGIN_URL', 2 ); define( 'PLUGIN_ACTIVE', 3 ); define( 'PLUGIN_NICE_NAME', 4 ); // ---- Vital requires, don't load without ----------------------------------------------------------------------- // Autogenerated always-perfect include path if( ! @include_once( dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'application_config.php' ) ) { die( 'Cannot load application_config.php'); } // Determine OS if( ( file_exists( 'c:\command.com' ) || file_exists( 'c:\autoexec.bat' ) || eregi( "windows", getenv( 'OS' ) ) ) && ( ! file_exists( '/etc/passwd' ) ) ) { define( 'OS', 'WINDOWS' ); } else { define( 'OS', 'UNIX' ); } // Load debug as soon as possible if( DEBUG ) { error_reporting(E_ALL); ini_set( 'error_reporting', true ); ini_set( 'display_errors', true ); ini_set( 'display_startup_errors', true ); } // Built in check if the config is right if ( ! defined( 'BASE_PATH' ) ) { die( 'Config loaded, but expected defined variables not found! Loading the wrong config file. Load aborted' ); } if ( ! file_exists( BASE_PATH . COREAPM_LOCATION . 'includes/global_defines.php' ) ) { die( 'Could not load global_defines from ("'.BASE_PATH . COREAPM_LOCATION . 'includes/global_defines.php")<br />. This means that your BASE_PATH("'.BASE_PATH.'") and COREAPM_LOCATION("'.COREAPM_LOCATION.'") are likely to be wrong' ); } // Include version if( ! include_once( BASE_PATH . 'version.php' ) ) { die( 'Cannot load version.php, no sense in loading CORE apm.' ); } // load some values that are not intended to be user-defineable if ( ! include_once( BASE_PATH . COREAPM_LOCATION . 'includes/global_defines.php' ) ) { die( 'Cannot load includes/global_defines.php, no sense in loading CORE apm. This holds needed defines.' ); } // ---- Load most-important requires ----------------------------------------------------------------------- //basic include functions needed for overall functionality include_once( BASE_PATH . COREAPM_LOCATION . 'includes/time.php' ); if ( CLOCK_ME || SHOW_INFO ) { $page_load_start_time = stopwatch_start(); } // load text outputting and translation require_once( BASE_PATH . COREAPM_LOCATION . 'includes/language.php' ); $language = new class_language; $language->set( $language->selected_language ); if ( ! include_once( LANGUAGE_DIR . $language->selected_language . '.lng' ) ) { die( 'language file could not be loaded !' ); } if( file_exists( LANGUAGE_DIR . $language->selected_language . '_ALTERED.lng' ) ) { include_once( LANGUAGE_DIR . $language->selected_language . '_ALTERED.lng' ); } else { $_COREAPM_ALTERED_LANGUAGE = array(); } $month_names = array( 0 => '', 1 => text( 'jan' ), 2 => text( 'feb' ), 3 => text( 'mar' ), 4 => text( 'apr' ), 5 => text( 'may' ), 6 => text( 'jun' ), 7 => text( 'jul' ), 8 => text( 'aug' ), 9 => text( 'sep' ), 10 => text( 'okt' ), 11 => text( 'nov' ), 12 => text( 'dec' ) ); // load up email require_once( BASE_PATH . COREAPM_LOCATION . 'includes/email.php' ); $email = new class_email; // our own kind of syslog handles error-logging require_once( BASE_PATH . COREAPM_LOCATION . 'includes/syslog.php' ); $syslog = new class_syslog; // error handling require_once( BASE_PATH . COREAPM_LOCATION . 'includes/error.php' ); // Now load the main gui classes require_once( BASE_PATH . COREAPM_LOCATION . 'gui/screen.php' ); $screen = new class_screen; require_once( BASE_PATH . COREAPM_LOCATION . 'gui/box.php' ); $box = new class_box; require_once( BASE_PATH . COREAPM_LOCATION . 'gui/table.php' ); $table = new class_table; require_once( BASE_PATH . COREAPM_LOCATION . 'gui/tree.php' ); require_once( BASE_PATH . COREAPM_LOCATION . 'gui/tabs.php' ); $tabs = new class_tabsheets; require_once( BASE_PATH . COREAPM_LOCATION . 'gui/formtable.php' ); $form = new class_formtable; require_once( BASE_PATH . COREAPM_LOCATION . 'gui/template.php' ); $template = new class_template; require_once( BASE_PATH . COREAPM_LOCATION . 'gui/various.php' ); // load the database connection require_once( BASE_PATH . COREAPM_LOCATION . 'database/db.php' ); $db = new class_database; // load security require_once( BASE_PATH . COREAPM_LOCATION . 'includes/security.php' ); $security = new class_security; // caching require_once( BASE_PATH . COREAPM_LOCATION . 'includes/cache.php' ); $cache = new class_cache; require_once( BASE_PATH . COREAPM_LOCATION . 'includes/checks.php' ); require_once( BASE_PATH . COREAPM_LOCATION . 'includes/scripts.php' ); require_once( BASE_PATH . COREAPM_LOCATION . 'includes/binairy.php' ); require_once( BASE_PATH . COREAPM_LOCATION . 'forms/elements.php' ); require_once( BASE_PATH . COREAPM_LOCATION . 'forms/selectbuilder.php' ); /** * This is our superclass. It is the most important class there is as it controls loads of functions that are important. * Especially handy of you just want a start() and finish() on a page. * * @author Dennis Fleurbaaij <dennis@io-software.nl> */ class class_coreapm { var $instance_calls; var $plugins; var $plugin_menu_items; var $plugin_quick_select_menu_items; var $plugin_callbacks; /** * Constructor * * @author Dennis Fleurbaaij <dennis@io-software.nl> */ function class_coreapm() { $this->instance_calls = 0; $this->plugins = array(); $this->plugin_menu_items = array(); $this->plugin_quick_select_menu_items = array(); $this->plugin_callbacks = array(); } /** * Starts up everything, first secures you, checks for compression and starts page rendering * * @author Dennis Fleurbaaij <dennis@io-software.nl> */ function start() { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Starting' ); if( $this->instance_calls++ > 0 ) { // echo( 'COREAPM ALLREADY STARTED CANNOT START TWICE, ADDING INSTANCE CALL AND COMING TO A TOTAL OF '.$this->instance_calls); return true; } // check if the browser is capable of gzip compression activate if possible if ( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && strstr( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip, deflate' ) ) { //header ('Content-Encoding: gzip'); //ob_start('ob_gzhandler'); ob_start(); __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Your browser is capable of gzip compression. We will compress the output before sending it.' ); } else { ob_start(); __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Cannot handle compression. Sending clear text output.' ); } // If we need to export as CVS do not load top templates if( isset( $_GET['csvexport'] ) ) { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'cvsexport set, not creating top' ); return true; } if( isset( $_GET['xmlexport'] ) ) { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'xmlexport set, not creating top' ); return true; } // Can we load the page from cache ? Don't load on POSTS! // // Dennis Fleurbaaij <dennis@io-software.nl>, 1-1-2004: // Page cache is disabled for a indefinate amount of time due to issues with showing the // wrong information. // // if( sizeof( $_POST ) == 0 ) { // // if( ( $data =& $GLOBALS['cache']->get_page_cache( $_SERVER['PHP_SELF'] ) ) != NULL ) { // // echo $data; // // if( DEBUG ) { // $GLOBALS['box']->add( 'DEBUG BOX', $GLOBALS['syslog']->show_html_log() ); // } // // if( CLOCK_ME ) { // $load_time= stopwatch_stop( $GLOBALS['page_load_start_time'] ); // echo '<FONT color="#1F3985"><small><br />'.number_format($GLOBALS['syslog']->database_time, 5).' '.text('clock_me_bar1').' '.$GLOBALS['syslog']->database_calls.' '.text('clock_me_bar2').' '.number_format($load_time, 5).' '.text('clock_me_bar3').' '.number_format( ($GLOBALS['syslog']->database_time+$load_time), 5 ).' '.text('clock_me_bar4').' '.text('cache_hit')."</small></FONT>\n"; // } // // $GLOBALS['screen']->create_bottom(); // die; // } // } $GLOBALS['screen']->create_top(); // echo 'STARTING COREAPM ( this instance: '.$this->instance_calls.' (first has id 1!) )<br />'; } /** * Stops rendering, emails admin if errors are found and cleans up * * @author Dennis Fleurbaaij <dennis@io-software.nl> */ function finish() { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Finishing' ); if( $this->instance_calls <= 0 ) { die( 'COREAPM NOT YET STARTED CANNOT FINISH!' ); } // Deduct and see if we can finish $this->instance_calls--; if( $this->instance_calls >= 1 ) { //echo 'COREAPM FINISH: Cannot finish, instance_calls >= 1 ( currently: '.$this->instance_calls.', tabs: '.$GLOBALS['tabs']->tabs.' )<br />'; return true; } // Close db connection $GLOBALS['db']->close(); // Csv rendering file, return file header and quit here if( isset( $_GET['csvexport'] ) ) { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'cvsexport set, rendering and returning file' ); // Send custom header header( 'Content-type: text/comma-separated-values' ); header( 'Content-Disposition: attachment; filename=HelpCORE_report.csv' ); header( 'Content-length: ' . ob_get_length() ); header( 'Content-Description: HelpCORE Report' ); echo ob_get_clean(); die; } // XML rendering file, return file header and quit here if( isset( $_GET['xmlexport'] ) ) { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'xmlexport set, rendering and returning file' ); $xml = '<?xml version="1.0" encoding="utf-8"?>'; // Get the name of the form to make some sort of relationship in the xml to the exported data $file = explode('/', $_SERVER['PHP_SELF']); $file = substr($file[count($file)-1],0,-4); $xml .= "\r\n\t<".$file.">\r\n"; // put the content in an array $content = explode('<br />', nl2br( ob_get_clean() ) ); // get the rough headers $headers = explode(';', $content[0]); // characters to be replaced in the header names $replace_array = array( ' ', '!', '#', '/', '(', ')' ); // the replacements $replace_with_array = array( '_', '', '', '_', '', '' ); // small check to make sure both arrays are equall in size //if (count($replace_array) != count($replace_with_array)) // this will keep looping, lock up your webserver and eventually it will most likely also kill the mail server //__FATAL__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Replacements arrays are not equall in size' ); // initialze new header array and clean stuff up $goodheaders = array(); foreach ($headers as $key => $header) { if ($header != '') { $header = str_replace( $replace_array, $replace_with_array, trim($header) ); $header = str_replace( '__', '_', $header ); if ($header != '') $goodheaders[] = $header; else $goodheaders[] = 'field'.$key; } } // get the data and turn it into xml $headercount = count($goodheaders); foreach ($content as $key => $value) { if ($key != '0') { $xml .= "\t\t<record>\r\n"; $values = explode(';', $value); foreach ($values as $key2 => $value2) { if (($key2 <= $headercount-1) && (count($values) >= $headercount)) $xml .= "\t\t\t<".$goodheaders[$key2].'>'.str_replace("\r\n", '', trim($value2)).'</'.$goodheaders[$key2].">\r\n"; } $xml .= "\t\t</record>\r\n"; } } $xml .= "\t</".$file.">"; // Send custom header header( 'Content-type: text/xml' ); header( 'Content-Disposition: attachment; filename=HelpCORE_export_'.$file.'.xml' ); header( 'Content-length: ' . ob_get_length() ); header( 'Content-Description: HelpCORE Report' ); // output the actuall XML echo $xml; die; } // Page is now rendered, submit it to cache // // Dennis Fleurbaaij <dennis@io-software.nl>, 1-1-2004: // Page cache is disabled for a indefinate amount of time due to issues with showing the // wrong information. // // $GLOBALS['cache']->put_page_cache( $_SERVER['PHP_SELF']); // Show the debug panel if ( DEBUG ) { $GLOBALS['tabs']->addDataPanel( 'Debug', $GLOBALS['box']->data( 'DEBUG BOX', $GLOBALS['syslog']->show_html_log() ) ); } // echo 'COREAPM FINISHING ( tabs ( amount: '.$GLOBALS['tabs']->tabs.' ) will render below, direct output will render above this text ) !<br />'; // if ( DEBUG ) { // $content = '<ol><li>' . str_replace( "\n", "</li><li>\n", htmlspecialchars( ob_get_contents() . $GLOBALS['tabs']->show() ) ) . '</li></ol>'; // $content = str_replace( " ", ' ', $content ); // $GLOBALS['tabs']->addDataPanel( 'Source', $GLOBALS['box']->data( 'HTML SOURCE CODE', '<div align="left"><p>' . $content . '</p></div>' ) ); // } // If there are tabs show them echo $GLOBALS['tabs']->show(); // If we need to show timing information render it now if ( CLOCK_ME ) { $load_time = stopwatch_stop( $GLOBALS['page_load_start_time'] ); echo '<br /><span class="clockMe">' . number_format( $GLOBALS['syslog']->database_time, 5 ) . ' ' . text( 'clock_me_bar1' ) . ' ' . $GLOBALS['syslog']->database_calls . ' ' . text( 'clock_me_bar2' ) . ' ' . number_format( $load_time, 5 ) . ' ' . text( 'clock_me_bar3' ) . ' ' . number_format( ( $GLOBALS['syslog']->database_time + $load_time ), 5 ) . ' ' . text( 'clock_me_bar4' ) . ' ' . text( 'cache_miss' ) . "</span>\n"; } elseif ( SHOW_INFO ) { $load_time = stopwatch_stop( $GLOBALS['page_load_start_time'] ); echo '<script type="text/javascript">'."\n".'window.status = "'. date( "D, d M Y" ) . ' | Version: ' . HELPCORE_VERSION . ', Release: ' . HELPCORE_RELEASE_DATE . ' ( db-time: '. number_format( $GLOBALS['syslog']->database_time, 5 ) . ', db-calls: '. $GLOBALS['syslog']->database_calls . ', render-time: '. number_format( $load_time, 5 ) . ', size: '. number_format( ob_get_length() , 0 ) . 'b. )";'."\n".'</script>'; } ob_end_flush(); $GLOBALS['screen']->create_bottom(); } /** * Register a plugin, return the plugin's id */ function plugin_register( $name, $nice_name, $version, $url, $active ) { // Push array_push( $this->plugins, array( PLUGIN_ACTIVE=>$active, PLUGIN_NICE_NAME=>$nice_name, PLUGIN_NAME=>$name, PLUGIN_URL=>$url, PLUGIN_VERSION=>$version ) ); // Return false if not active if( ! $active ) { return false; } // Return id if active return sizeof( $this->plugins ); } /** * Add a plugin page to the menu */ function plugin_register_menu_page( $module_name, $parent, $menu_array ) { // Create array if not yet exists if( ! isset( $this->plugin_menu_items[ $module_name ] ) ) { $this->plugin_menu_items[ $module_name ] = array(); } // Create array if not yet exists if( ! isset( $this->plugin_menu_items[ $module_name ][ $parent ] ) ) { $this->plugin_menu_items[ $module_name ][ $parent ] = array(); } // Store it for use $this->plugin_menu_items[ $module_name ][ $parent ] = array_merge( $this->plugin_menu_items[ $module_name ][ $parent ], $menu_array ); } /** * Add a plugin page to the quick select menu */ function plugin_register_quick_select_menu_page( $module_name, $html_code ) { // Create array if not yet exists if( ! isset( $this->plugin_quick_select_menu_items[ $module_name ] ) ) { $this->plugin_quick_select_menu_items[ $module_name ] = ''; } // Store it for use $this->plugin_quick_select_menu_items[ $module_name ] .= $html_code; } /** * Used by the menu for retrieving items to add, if there are none return an empty array */ function plugin_get_menu_pages( $module_name, $parent ) { if( ! isset( $this->plugin_menu_items[ $module_name ][ $parent ] ) ) { return array(); } return $this->plugin_menu_items[ $module_name ][ $parent ]; } /** * Used by the quick menu for retrieving items to add, if there are none return an empty string */ function plugin_get_quick_select_menu_pages( $module_name ) { if( ! isset( $this->plugin_quick_select_menu_items[ $module_name ] ) ) { return ''; } return $this->plugin_quick_select_menu_items[ $module_name ]; } /** * Regsiter with a relational (.php) callback function */ function plugin_register_relational_callback( $table, $action, $function ) { if( ! isset( $this->plugin_callbacks[ $table ] ) ) { $this->plugin_callbacks[ $table ] = array(); } if( ! isset( $this->plugin_callbacks[ $table ][ $action ] ) ) { $this->plugin_callbacks[ $table ][ $action ] = array(); } array_push( $this->plugin_callbacks[ $table ][ $action ], $function ); } /** * Return the callbacks the relational function has to make */ function plugin_get_relational_callbacks( $table, $action ) { if( ! isset( $this->plugin_callbacks[ $table ][ $action ] ) ) { return array(); } return $this->plugin_callbacks[ $table ][ $action ]; } /** * Return true if the plugin is loaded */ function plugin_loaded( $name ) { foreach( $this->plugins as $plugin ) { if( $plugin[ PLUGIN_NAME ] == $name ) { return true; } } return false; } function plugin_active( $name ) { foreach( $this->plugins as $plugin ) { if( $plugin[ PLUGIN_NAME ] == $name ) { if ($plugin[ PLUGIN_ACTIVE ]) return TRUE; } } return false; } } $coreapm = new class_coreapm; if ((!defined('REGISTRATION_SEND') || REGISTRATION_SEND == FALSE) && (strtolower(substr($_SERVER['PHP_SELF'],-22)) != 'registration/index.php')) { header('location: '.BASE_URL.'registration/index.php?return='.urlencode(BASE_URL)); die(); } // Check if the application is allready configured if( ( ( ! defined( 'CONFIGURED' ) ) || ( CONFIGURED !== true ) ) && ( strtolower(substr($_SERVER['PHP_SELF'],-16)) != 'configurator.php' ) && (strtolower(substr($_SERVER['PHP_SELF'],-22)) != 'registration/index.php') ) { echo 'HelpCORE is not yet configured, please go to <a href="'.BASE_URL.'configurator.php">the configurator</a>'; die; } // ---- Load user's module-specific config ----------------------------------------------------------------------- if ( ! defined( 'LOAD_NO_MODULES' ) ) { if ( isset( $_GET['module_subdir'] ) ) { $module_subdir = $_GET['module_subdir']; if ( $module_subdir != BASE_PATH ) { include_once( BASE_PATH . $module_subdir . '/config.php' ); } } } // To save us much work we will load the superclasses here. They are capable of managing all functions needed for a // relational database to work without the need for complex code. Keep in mind that these are HUGE-MASSIVE-GIAGANTIC in memory and cpu needs if ( ! defined( 'LOAD_LIGHT' ) ) { include_once( BASE_PATH . COREAPM_LOCATION . 'relational/relational.php' ); $relational = new class_relational; } // Open handle if( ( ! is_dir( PLUGINS_DIR ) ) || ( ( $dh = opendir(PLUGINS_DIR) ) == null ) ) { __FATAL__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Could not open plugin directory: "'.PLUGINS_DIR.'"' ); } // Loop and read while( ($fileName = readdir($dh)) !== false ) { if( ($fileName == '.') || ($fileName == '..') || (! is_dir( PLUGINS_DIR.$fileName )) ) { continue; } // Check if dir has the loadable plugin.php file if( file_exists( PLUGINS_DIR . $fileName . DIRECTORY_SEPARATOR . 'plugin.php' ) ) { $GLOBALS['current_plugin_active']=true; // Do not load if disabled.dat if( file_exists( PLUGINS_DIR . $fileName . DIRECTORY_SEPARATOR . 'disabled.dat' ) ) { $GLOBALS['current_plugin_active']=false; } if( include_once( PLUGINS_DIR . $fileName . DIRECTORY_SEPARATOR . 'plugin.php' ) ) { __DEBUG__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Loaded the "'.$fileName.'" plugin' ); } } } closedir($dh); } ?>
  17. We are using call tracking tool called HelpCORE.The Timing configured for that tool displays the 24hrs service but we have our office timing as 9AM to 5:30 PM.It was not an issue since the timing format may be UTC,GMT but when the SLA stuffs was studied it created problem as the SLA will get counted on holidays or after working hours too. In Summary,the tool workd as 24/7 but our requirement is 5 days and timings are like this 9AM to 5.30 PM and We need to stop sla in defined holidays also. I have included the reuired files which I think should be sufficient to track the issue.If yu want more structural file do let me know. The files using are incidents_escalate.php --> setting escalation time of incident time.php ---> All time settings for the application corepm.php  Main include for all files, handles setup and plugins incidents_escalate.php <?php Purpose: Implements functions that aid in the escalation of incidents // This is needed because this file is called by timed_event_handler.php if( ! isset( $coreapm ) ) { if ( ! include( '../coreapm/coreapm.php' ) ) { die( 'Cannot include CORE APM' ); } $GLOBALS['security']->secure(); } $GLOBALS['temp_db'] = new class_database; /** * Escalate an incident */ function incident_escalate( $incident_id, $force_escalation = false, $reason = -1 ) { global $temp_db; $temp_db->query( 'SELECT incidents.priorities_id AS prio_id, priorities.name AS name, incidents.date_reported AS date_reported, incidents.date_escalated AS date_escalated, incidents.owner_id AS owner, incidents.sla_level_id AS sla_level_id, organisation.sla_level_id AS organisation_sla_level_id, buildings.sla_level_id AS building_sla_level_id, departments.sla_level_id AS department_sla_level_id, rooms.sla_level_id AS room_sla_level_id, users.sla_level_id AS user_sla_level_id, groups.sla_level_id AS group_sla_level_id, hardware.sla_level_id AS hardware_sla_level_id FROM incidents, priorities LEFT JOIN organisation ON ( organisation.id = incidents.organisation_id ) LEFT JOIN buildings ON ( buildings.id = incidents.building_id ) LEFT JOIN rooms ON ( rooms.id = incidents.rooms_id ) LEFT JOIN users ON ( users.id = incidents.owner_id ) LEFT JOIN groups ON ( groups.id = incidents.group_id ) LEFT JOIN hardware ON ( hardware.id = incidents.hardware ) LEFT JOIN departments ON ( departments.id = incidents.department_id ) WHERE incidents.priorities_id = priorities.id AND incidents.id=' . $incident_id ); if( ! ( $incident_row = $temp_db->fetch_array() ) ) return false; $sla_level_id = ''; if( $incident_row['organisation_sla_level_id'] != '' ) $sla_level_id .= $incident_row['organisation_sla_level_id'] . ','; if( $incident_row['building_sla_level_id'] != '' ) $sla_level_id .= $incident_row['building_sla_level_id'] . ','; if( $incident_row['department_sla_level_id'] != '' ) $sla_level_id .= $incident_row['department_sla_level_id'] . ','; if( $incident_row['room_sla_level_id'] != '' ) $sla_level_id .= $incident_row['room_sla_level_id'] . ','; if( $incident_row['user_sla_level_id'] != '' ) $sla_level_id .= $incident_row['user_sla_level_id'] . ','; if( $incident_row['group_sla_level_id'] != '' ) $sla_level_id .= $incident_row['group_sla_level_id'] . ','; if( $incident_row['hardware_sla_level_id'] != '' ) $sla_level_id .= $incident_row['hardware_sla_level_id'] . ','; if( $incident_row['sla_level_id'] != '' ) $sla_level_id .= $incident_row['sla_level_id'] . ','; $sla_level_id = substr( $sla_level_id, 0, -1 ); // 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( $incident_row['date_escalated'] ) && O_INC_USEESCALATION ) { $incident_row['date_reported'] = $incident_row['date_escalated']; } // 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( $incident_row['date_reported'] ); $epoch_incident = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_incident = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; if( $sla_level_id == '' ) { return false; } $temp_db->query( 'SELECT s.name AS name, s.id AS sla_id, e.time AS time, e.id AS esc_id, e.escalate AS escalate, e.time AS solve_time, e.escalate_owner AS escalate_owner, e.escalate_group AS escalate_group, e.escalate_priority AS escalate_priority, e.escalate_status AS escalate_status FROM sla_levels as s, escalations as e WHERE e.sla_level_id = s.id AND s.id IN ( ' . $sla_level_id . ') AND e.priority_id=' . $incident_row['prio_id'] . ' HAVING e.time = min(e.time)' ); $row = $temp_db->fetch_array(); $hours_offset = $row['time']; // Incident does not escalate if( $hours_offset == '' ) { return false; } // Now calc the deadlines $epoch_deadline = $epoch_incident + ( int )( $hours_offset / 24 ); $secs_deadline = $secs_incident + ( ( $hours_offset % 24 ) * 3600 ); // Fill in some values in the array that are from the incident_row $row['date_reported'] = $incident_row['date_reported']; $row['name'] = $incident_row['name']; $row['owner'] = $incident_row['owner']; // Event can't escalate normally, we CAN force escalation tough if( ( returned_database_boolean( $row['escalate'] ) == false ) && ( $force_escalation == false ) ) { return false; } $epoch_now = dmy_to_days_from_epoch( date( 'd' ), date( 'm' ), date( 'Y' ) ); $secs_now = ( date( 'H' ) * 3600 ) + ( date( 'i' ) * 60 ) + date( 's' ); $ta = db_time_to_array( $row['date_reported'] ); $epoch_incident = dmy_to_days_from_epoch( $ta[0], $ta[1], $ta[2] ); $secs_incident = ( $ta[3] * 3600 ) + ( $ta[4] * 60 ) + $ta[5]; if( ( ( ( $epoch_deadline - $epoch_now ) * 86400 ) + ( $secs_deadline - $secs_now ) < 0 ) || ( $force_escalation == true ) ) { // We're escalating $log = ''; // Update database and create log if( $row['escalate_owner'] != '' ) { $temp_db->query( 'UPDATE incidents SET owner_id=' . $row['escalate_owner'] . ' WHERE id=' . $incident_id ); $temp_db->query( 'SELECT firstname, middlename, surname FROM users WHERE id=' . $row['escalate_owner'] ); $temprow = $temp_db->fetch_array(); $log .= text( 'owner' ) . ' ' . text( 'escalated_to' ) . ' ' . $temprow['firstname'] . ' ' . $temprow['middlename'] . ' ' . $temprow['surname'] . "\n"; } if( $row['escalate_group'] != '' ) { $temp_db->query( 'UPDATE incidents SET group_id=' . $row['escalate_group'] . ' WHERE id=' . $incident_id ); $temp_db->query( 'SELECT name FROM groups WHERE id=' . $row['escalate_group'] ); $temprow = $temp_db->fetch_array(); $log .= text( 'group' ) . ' ' . text( 'escalated_to' ) . ' ' . $temprow['name'] . "\n"; } if( $row['escalate_priority'] != '' ) { $temp_db->query( 'UPDATE incidents SET priorities_id=' . $row['escalate_priority'] . ' WHERE id=' . $incident_id ); $temp_db->query( 'SELECT name FROM priorities WHERE id=' . $row['escalate_priority'] ); $temprow = $temp_db->fetch_array(); $log .= text( 'priority' ) . ' ' . text( 'escalated_to' ) . ' ' . $temprow['name'] . "\n"; } if( $row['escalate_status'] != '' ) { $temp_db->query( 'UPDATE incidents SET status_id=' . $row['escalate_status'] . ' WHERE id=' . $incident_id ); $temp_db->query( 'SELECT name FROM status WHERE id=' . $row['escalate_status'] ); $temprow = $temp_db->fetch_array(); $log .= text( 'status' ) . ' ' . text( 'escalated_to' ) . ' ' . $temprow['name'] . "\n"; } if( $log == '' ) { $log = text( 'no_changes' ); } // There is a reason, alter the text if( $reason > -1 ) { if( $reason == 0 ) { $log = text( 'no_reason' ) . '<br />' . $log; } else { $temp_db->query( 'SELECT name FROM escalation_reasons WHERE id=' . $reason ); $temprow = $temp_db->fetch_array(); $log = text( 'reason' ) . ': ' . $temprow['name'] . '<br />' . $log; } } $log = '<strong>' . text( 'incident_escalation_from' ) . ' ' . $row['name'] . "</strong>\n" . $log; // Add this to incident log // Note: incident's old owner always escalates an incident $temp_db->query( 'INSERT INTO incidents_log( incident_id, user_id, changed, log, sla_time ) values( ' . $incident_id . ', ' . $row['owner'] . ', now(), \'' . stripslashes( $log ) . '\', '.$hours_offset.' );' ); // Update incident and set the date_escalated to now $temp_db->query( 'UPDATE incidents SET date_escalated=now() WHERE id=' . $incident_id ); // Email admin about it if( O_INC_SENDEMAIL ) { $GLOBALS['email']->email_user( $row['owner'], 'incident_escalated_owner', array( 'id' => $incident_id ), true ); } if( O_INC_ESCALATION_SENDADMINEMAIL ) { $GLOBALS['email']->email_message( ADMIN_EMAIL, 'incident_escalated_admin', array( 'id' => $incident_id ) ); } return true; } return false; } ?> File :time.php <?php * Purpose: * -------- * Date and Time related functions * // Defines for easy handling of time define( 'TIME_YEAR', 2 ); define( 'TIME_MONTH', 1 ); define( 'TIME_DAY', 0 ); define( 'TIME_HOUR', 3 ); define( 'TIME_MINUTE', 4 ); 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.
  18. I got the Solution....I think I am very careless about the right Programming.... Here lies the Culprit: ............. ---------- $firstname=$rows['firstname']; $surname=$rows['surname']; $email=$rows['email']; $password=$rows['password']; $loginname=$rows['loginname']; $telnr=$rows['telnr']; And all I was using $_POST['row']---------------- Anyway Now everything seems to work. Thanks for dedicating TIme to solve my DIfficulty.I learnt a lot from Yu. See Yu Bye..
  19. I tried to troubleshoot and now I think you need to help me wiht few stuffs left.The Code is working.It is inserting half ata into the database...esp the cloumns which I am supplying as default in the code. See This: if($count==1) { $rows=mysql_fetch_array($result1); $firstname=$_POST['firstname']; echo "$firstname"; $surname=$_POST['surname']; echo "$surname"; $email=$_POST['email']; $password=$_POST['password']; $loginname=$_POST['loginname']; $telnr=$_POST['telnr']; $rooms_id=$_POST['rooms_id']; $organisation_id=$_POST['organisation_id']; $middlename=$_POST['middlename']; $group_id=$_POST['group_id']; $department_id=$_POST['department_id']; $loc_telnr=$_POST['loc_telnr']; $title=$_POST['title']; $first_letters=$_POST['first_letters']; echo "Hai"; $tbl_name2="users"; $sql2="INSERT INTO $tbl_name2(firstname,surname,email,password,is_admin,loginname,personeelsnummer,allowed_to_log_in,telnr,rooms_id,may_log_in,ip,session_key,last_contact,initial_contact,last_visited_page,organisation_id,middlename,group_id,department_id,building_id,loc_telnr,global_view,sla_level_id,title,first_letters,session_use_alerts,notes) VALUES ('$firstname','$surname','$email','$password',0,'$loginname',NULL,NULL,'$telnr','$rooms_id',0,'127.0.0.1',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00',NULL,NULL,'$middlename',NULL,NULL,NULL,'$loc_telnr',0,0,'$title','$first_letters',0,'GET')"; The $firstname is not giving any value.But When I saw the database entry it is simpl adding the already inputted values like 0,127.0.0.1 etc.. Is the format correct? Why $firstname isnt retrieving anything??? Pls Help
  20. I checked with the code: <?PHP include('config.php'); $passkey=$_GET['passkey']; echo "$passkey"; #$activate_status = 'unchecked'; #$deactivate_status = 'unchecked'; if ($_POST['gender']=='activate') { $tbl_name1="member"; $sql1="Select * from $tbl_name1 where loginname='$passkey'"; $result1=mysql_query($sql1); // If successfully queried if($result1) { // Count how many row has this passkey $count=mysql_num_rows($result1); echo "$count"; // if found this passkey in our database, retrieve data from table "temp_members_db" if($count==1) { $rows=mysql_fetch_array($result1); echo "$rows"; $firstname=$_POST['firstname']; echo "$firstname"; ---------------- But its shwoing some error I think: Coz the output is : maheshk1Array maheshk is the passkey,1 is the output for count,Array(no idea) Can you pls look at the code and help me with the solution
  21. You are Simply a Brilliant Guy... Its Working Maan....I need one more help...Do you think the migrate.php gonna work...I mean Is my Logic Correct??? I have commented lots of lines...Pls Do check if it gonna work...or not. Here all after uncommenting: File : migrate.php <?PHP include('config.php'); echo "$host"; $passkey=$_GET['passkey']; echo "$passkey"; #$activate_status = 'unchecked'; #$deactivate_status = 'unchecked'; echo "Hai"; echo "Welcome"; echo $_POST['gender']; if ($_POST['gender']=='activate') { $tbl_name1="member"; $sql1="Select * from $tbl_name1 where loginname='$passkey'"; $result1=mysql_query($sql1); // If successfully queried if($result1) { // Count how many row has this passkey $count=mysql_num_rows($result1); // if found this passkey in our database, retrieve data from table "temp_members_db" if($count==1) { $rows=mysql_fetch_array($result1); $firstname=$_POST['firstname']; $surname=$_POST['surname']; $email=$_POST['email']; $password=$_POST['password']; $loginname=$_POST['loginname']; $telnr=$_POST['telnr']; $rooms_id=$_POST['rooms_id']; $organisation_id=$_POST['organisation_id']; $middlename=$_POST['middlename']; $group_id=$_POST['group_id']; $department_id=$_POST['department_id']; $loc_telnr=$_POST['loc_telnr']; $title=$_POST['title']; $loc_telnr=$_POST['loc_telnr']; $title=$_POST['title']; $first_letters=$_POST['first_letters']; $tbl_name2="users"; $sql2="INSERT INTO $tbl_name2 (firstname, surname, email, password, is_admin, loginname, personeelsnummer, allowed_to_log_in, telnr, rooms_id, may_log_in, ip, session_key, last_contact, initial_contact, last_visited_page, organisation_id, middlename, group_id, department_id, building_id, loc_telnr, global_view, sla_level_id, title, first_letters, session_use_alerts,notes) VALUES ('$firstname','$surname','$email','$password',0,'$loginname',NULL,NULL,'$telnr','$rooms_id',0,'127.0.0.1',NULL,'0000-00-00 00:00:00','0000-00-00 00:00:00',NULL,NULL,'$middlename',NULL,NULL,NULL,'$loc_telnr',0,0,'$title','$first_letters',0,'GET')"; $result2=mysql_query($sql2); } // if not found passkey, display message "Wrong Confirmation code" else { echo "Wrong Confirmation code"; } // if successfully moved data from table"member" to table "users" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db" if($result2) { echo "The account has been activated"; // Delete information of this user from table "temp_members_db" that has this passkey $sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'"; $result3=mysql_query($sql3); } } } elseif ($_POST['gender']=='deactivate') { echo "Deactivate Selected"; } ?>
  22. His Comfirmation link Click on this link to activate the users' account http://10.14.2.36/petp/activation.php?passkey=prabhu from: your name <your email> Just like the same above.. I made little chanhe in the language..Thats it..
  23. If you browse thru that.....In my Case only Passkey stuff is not working....
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.