Jump to content

naveendk.55

Members
  • Posts

    56
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

naveendk.55's Achievements

Member

Member (2/5)

0

Reputation

  1. I am trying to send multiple values to ajax variable(value) from multiple dropdown list. However, this is not working. I want multiple values to be stored in ajax variable if I select more than one dropdown value. Any help plz? Below is the ajax code: var xmlHttp1; var xmlHttp1; var str = new Array(); //xmlHttp.setRequestHeader( "Content-Type", "application/json" ); function showState1(str){ if (typeof XMLHttpRequest != "undefined"){ xmlHttp1= new XMLHttpRequest(); } else if (window.ActiveXObject){ xmlHttp1= new ActiveXObject("Microsoft.XMLHTTP"); } if (xmlHttp1==null){ alert("Browser does not support XMLHTTP Request"); return; } var url="test.jsp"; url +="?value=" +str; xmlHttp1 .onreadystatechange = stateChange1; xmlHttp1.open("POST", url, false); xmlHttp1.send(null); } function stateChange1(){ if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete"){ document.getElementById("functUnit").innerHTML=xmlHttp1.responseText ; } }
  2. Thank you Premiso. Have a wonderful time.
  3. Hi I have a table as mentioned below. I am writing the below insert command and it is showing syntax error. Newbie. Please help if there is any mistake. insert into task (Desc, Total_Time, End_Date) values ('volks', '11:45:50', '2012-03-10'); mysql> desc task; +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | Desc | varchar(225) | NO | | NULL | | | Total_Time | time | NO | | NULL | | | End_Date | date | NO | | NULL | | +------------+--------------+------+-----+---------+----------------+ 4 rows in set (0.03 sec)
  4. Hi, I have added a time counter in below code. This is used to track the total time of a project. If a person is going on break, then they will apply the break that stops the time counter. However, once they come back from break and end the break, then time is counting at double speed (two seconds instead at one second). Any help please.... <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title>Strategy One - Tracker</title> <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> <!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]--> <!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]--> <!-- Script for Current time in text box --> <script type="text/javascript"> function GetDate() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('start_time').value = curHour + ":" + curMin; var row = document.getElementById("end1_time"); var row1 = document.getElementById("start1_time"); row.style.display = 'none'; row1.style.display = 'none'; } </script> <!-- End of Script for Current time in text box --> <!-- Script for Current time in text box --> <script type="text/javascript"> function GetDate1() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('end_time').value = curHour + ":" + curMin; var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); var row3 = document.getElementById("end2_time"); row.style.display = 'none'; row1.style.display = 'none'; row2.style.display = 'none'; row3.style.display = 'none'; } </script> <script type="text/javascript"> function GetDate2() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('break_time_out').value = curHour + ":" + curMin ; var row = document.getElementById("end2_time"); row.style.display = ''; } </script> <script type="text/javascript"> function GetDate3() { var curDateTime = new Date() var curHour = curDateTime.getHours() var curMin = curDateTime.getMinutes() if(curHour<10) curHour = "0" + curHour if(curMin<10) curMin = "0" + curMin document.getElementById('break_time_in').value = curHour + ":" + curMin ; } </script> <script type="text/javascript"> function tout1() { var temp= document.tracker.start_time.value; if(temp.length>0) { var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); row1.style.display = 'none'; row2.style.display = 'none'; } else { var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); row.style.display = 'none'; row1.style.display = 'none'; row2.style.display = 'none'; } } function tout2() { var temp= document.tracker.start_time.value; if(temp.length>0) { var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); var row3 = document.getElementById("end2_time"); row.style.display = 'none'; row1.style.display = 'none'; row2.style.display = 'none'; row3.style.display = 'none'; } else { var row = document.getElementById("start1_time"); var row1 = document.getElementById("end1_time"); var row2 = document.getElementById("start2_time"); var row3 = document.getElementById("end2_time"); row.style.display = ''; row1.style.display = 'none'; row2.style.display = 'none'; row3.style.display = 'none'; } } </script> <script type="text/javascript"> var seconds = 0; var minutes = 0; var hours = 0; function zeroPad(time) { var numZeropad = time + ''; while(numZeropad.length < 2) { numZeropad = "0" + numZeropad; } return numZeropad; } function countSecs() { var j=document.tracker.hide.value; if(j=="yes") { seconds++; if (seconds > 59) { minutes++; seconds = 0; } if (minutes > 59) { hours++ minutes = 0; } document.tracker.time_utilization.value = zeroPad(hours) + ":" + zeroPad(minutes) + ":" + zeroPad(seconds); } else {} } function startTimer() { action = window.setInterval(countSecs,1000); } function s() { document.tracker.hide.value ="yes"; startTimer(); } function p() { document.tracker.hide.value ="no"; } </script> </head> <body> <form name="tracker" method="post" action="processor.php" onsubmit="return formCheck(this);"> <label class="formFieldQuestion">Start Time *</label><input readonly class=mainForm type=text name=start_time id=start_time size='30' value=''> <input type="button" id="start1_time" style="width: 100px" Value="Start Time" onClick="javascript:GetDate();s();"></li> <label class="formFieldQuestion">End Time *</label><input readonly class=mainForm type=text name=end_time id=end_time size='30' value='' > <input type="button" id="end1_time" style="width: 100px" Value="End Time" onClick="javascript:GetDate1(); p();" style='display: none'></li> <input type="hidden" name="hide" /> <label class="formFieldQuestion">Break Time Out </label><input class=mainForm readonly type=text name=break_time_out id=break_time_out size='30' value='' > <input type="button" id="start2_time" style="width: 100px" Value="Start Time" onClick="javascript:GetDate2();tout1();p();"></li> <label class="formFieldQuestion">Break Time In </label><input class=mainForm readonly type=text name=break_time_in id=break_time_in size='30' value=''> <input type="button" id="end2_time" style="width: 100px" Value="End Time" onClick="javascript:GetDate3(); tout2();s();" style='display: none'></li> <label class="formFieldQuestion">Time Utilization</label><input class=mainForm type=text name=time_utilization id=time_utilization size='30' value='' readonly></li> <br /> <br /> <input id="saveForm" class="mainForm" type="submit" value="Submit" style="width : 100px"/> </form> </body> </html>
  5. Thanks Little Guy. That helped me and thanks again.
  6. Below is the my code. If the error is resolved, then I'll put the code in the program to get full result. If it display the total, then I'll be able to resolve it. Below is the full code in my page except database connection include file.
  7. tried that and getting the error :Notice: Undefined index: time_utilization in C:\wamp\www\strategyone\testing.php on line 28"
  8. I have a column with time in HH:MM:SS format. How to add the total time in this column? I tried the below steps but o/p display only 1.. $qry = "select SEC_TO_TIME(SUM(TIME_TO_SEC(time_utilization))) from tracker"; $result=mysql_query($qry) or die (mysql_error()); $row = mysql_num_rows($result); echo $row;
  9. Hi I tried few things and was not able to solve it. Also just let me know how to implement such things. I'll be able to do that. All I need is the logic that I need to follow. Help help if I'll be able to do it with mySQL or not. If I need to format after retrieving the data?. This will be a big help. Thanks
  10. I am trying to get result and display them in a particular format. I’m a beginner and hope below discription is clear. Table Structure is like mentioned below: ID| Date | Report| Start time | End Time REPORT Attribute hold any of the three values(Productivity, Monitoring, Break). I want to display the output in below two formats between two selected dates from a form. a) DATE | Productivity | Monitoring | break| Start Time | End Time. The report field has the paramenters productivity, Monitoring and Break. If the value has productivity, then it should display in Productivity column, Monitoring value should be displaed in monitoring field. I’m using PHP and Mysql. b) DATE | Productivity | Monitoring | break| Start Time | End Time. Here, I want the optput same a above however,the Start time and End time should display the sum of time between the selected dates.
  11. Can you tell me how to rewrite it according to your syntax?
  12. Yes, you're absolutely right. When I echo the session variable, it only printed one digit. My user id is a 10 digit code. Please check if I'm making any error while creating the session.. <?php session_start(); ?> <?php include_once("includes/connections.php"); ?> <?php include_once("functions/funphp.php"); ?> <?php if (isset($_POST['password']) && isset($_POST['login'])) // if the password is set then the form has been submitted on login.php page { $login = mysql_real_escape_string($_POST['login']); $password = mysql_real_escape_string($_POST['password']); $qstr = "SELECT * from users where empid='$login' and password ='$password'"; $result = mysql_query($qstr); $_SESSION['login']=$login['login']; $_SESSION['username'] = $username['username']; if (mysql_num_rows($result)==1) { redirect("home.php"); } else { echo "<font color=#000000><b>Invalid User Name or Password. <a href=index.php> Click here</a> to go back to the login screen </a></Center></font>"; } mysql_close(); } ?>
  13. Hi I'm able to log in successfully. The issue is only with changing password. The password is not updating in database after changing it. Thank you.
  14. Session is added at the top of the code. If the password change works for normal password, then I'll be able to do it for sha1 encryption. below is the HTML code: <form name=tracker method=post action=checkpassword.php> <table width="100%" border="0" cellpadding="2" cellspacing="2" id="changepass" align="center" style="border-color:#39C; border-width:medium; border-style:outset;"> <tr> <td style="text-align:left">Enter your New Password:</td> <td><input type="password" name="newpassword" id="newpassword" size='50'/></td> </tr> <tr> <td style="text-align:left">Confirm New Password:</td> <td><input type="password" name="confirmnewpassword" id="confirmnewpassword" size='50'/></td> </tr> <tr> <td scope="row" > </td> <td colspan="2"><div id="submit"><input id="changepass" class="mainForm" type="submit" value="Change Password"/></div></td> </tr> </table> </form> Below is the login check code that has the login session variable. This file name is checkpassword.php. <?php session_start(); ?> <?php include_once("includes/connections.php"); ?> <?php include_once("functions/funphp.php"); ?> <?php if (isset($_POST['password']) && isset($_POST['login'])) // if the password is set then the form has been submitted on login.php page { $login = mysql_real_escape_string($_POST['login']); $password = mysql_real_escape_string($_POST['password']); $qstr = "SELECT * from users where empid='$login' and password ='$password'"; $result = mysql_query($qstr); $_SESSION['login']=$login['login']; if (mysql_num_rows($result)==1) { redirect("home.php"); } else { echo "<font color=#000000><b>Invalid User Name or Password. <a href=index.php> Click here</a> to go back to the login screen </a></Center></font>"; } mysql_close(); } ?> Below is my session code (redirect has a function for Location). This file is included at the top of the checkpassword.php. <?php include_once("functions/funphp.php"); ?> <?php session_start(); function logged_in() { return isset($_SESSION['login']); } function confirm_logged_in() { if (!logged_in()) { redirect("index.php"); } } ?>
  15. Hi, I'm trying to change the password after logging in to web site. Following is the code that change the password. However, the password is not changing in the table. Please let me know if I'm making any error in below code. Thanks. <?php $password=mysql_real_escape_string($_POST['newpassword']); $password2=mysql_real_escape_string($_POST['confirmnewpassword']); if ( strlen($password) < 5 or strlen($password) > 12 ){ echo "Password must be more than 5 char legth and maximum 12 char lenght<BR>"; } if ( $password <> $password2 ){ echo "Both passwords are not matching"; } if($password == $password2){ if(mysql_query("update users set password='$password' where empid='$_SESSION[login]'")){ echo "<font face='Verdana' size='2' ><center>Thanks <br> Your password changed successfully. Please keep changing your password every 2 monthsfor better security</font></center>"; } }
×
×
  • 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.