Jump to content

bal bal

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bal bal's Achievements

Member

Member (2/5)

0

Reputation

  1. how can I change my webserver time?
  2. thanks for the reply. I am new in this php world. can anyone please tell me exactly where I need to put the timezone code in my code? I am now in UK. thanks once again.
  3. Hi there, I have a login table which shows the login details, the login & logout time. but it does not show my pc time. it shows the time which is 1 hour ahead of my laptop. can anyone plz tell me how can I solve the problem? here is the all code. <?php session_start(); require_once("config.php"); if(!$_SESSION['username']) { header("Location: loginpage.php"); } ?> <?php $query="select f_name from student_details where username='".$_SESSION['username']."'"; $res=mysql_query($query); $data=mysql_fetch_object($res); ?> <?php function get_time_difference( $start, $end ) { $uts['start'] = strtotime( $start ); $uts['end'] = strtotime( $end ); if( $uts['start']!==-1 && $uts['end']!==-1 ) { if( $uts['end'] >= $uts['start'] ) { $diff = $uts['end'] - $uts['start']; if( $days=intval((floor($diff/86400))) ) $diff = $diff % 86400; if( $hours=intval((floor($diff/3600))) ) $diff = $diff % 3600; if( $minutes=intval((floor($diff/60))) ) $diff = $diff % 60; $diff = intval( $diff ); return( array('days'=>$days, 'hours'=>$hours, 'minutes'=>$minutes, 'seconds'=>$diff) ); } else { trigger_error( "Ending date/time is earlier than the start date/time", E_USER_WARNING ); } } else { trigger_error( "Invalid date/time data detected", E_USER_WARNING ); } return( false ); } /*$query="select * from student_details where username='".$_SESSION['username']."'"; $result=mysql_query($query); $fetch=mysql_fetch_object($result);*/ $qry="select * from userlogin_info where user_id ='".$_SESSION['username']."'"; $res=mysql_query($qry); $i=0; while($usrObj = mysql_fetch_object($res)) { if($i%2!=0) { $trcolor = "#666666"; } else { $trcolor = "#333333"; } $login_time=""; $logout_time=""; $login_time=$usrObj->login_time; $logout_time=$usrObj->logout_time; $ex_login_time=""; $ex_logout_time=""; $ex_login_time=substr("$login_time",-8,; $ex_logout_time=substr("$logout_time",-8,; ?> <?php if( $diff=@get_time_difference($ex_login_time, $ex_logout_time) ) { echo sprintf( '%02d:%02d:%02d', $diff['hours'], $diff['minutes'],$diff['seconds'] ); } else { } ?> <?php $i++; } ?> these all codes are in the same file. thanks
  4. bal bal

    i=f

    hi i've got a login script from the net. its working perfectly. but i can't understand "i=f" after the php file name. here it is... <form action="actions/login.php?i=f" method="post"> can anyone please help me? thanks
  5. this is the pattern matching for the perl. ($forename !~/\A[A-Z][a-z]+\Z/i) can anyone please tell me how can I write the same in PHP? please need help ???
  6. Hi this is how it print in the in the perl, can anyone please tell me how to print them in the PHP. print "Please enter a valid forename<br>"; print "</body></html>"; thanks in advance
  7. if I don't put an empty option, & the user don't change it, that means the user choose the wrong option. thats why I want to make sure the user choose the right one and if it is blank, it should says "you have to choose one option from the list"
  8. Maybe I'm confused but with a SELECT, the first option is automatically selected by default, so it's impossible for someone not to choose an option. Am I missing something...? yes..... this is the code for select <select name="list"> <option></option> <option value="car">car</option> <option value="bus">bus</option> <option value="motorbike">motorbike</option> </select> so 1st option is not selected. its still not working > when I tried with this code, it shows me "The page cannot be found" error
  9. Maybe I'm confused but with a SELECT, the first option is automatically selected by default, so it's impossible for someone not to choose an option. Am I missing something...? yes..... this is the code for select <select name="list"> <option></option> <option value="car">car</option> <option value="bus">bus</option> <option value="motorbike">motorbike</option> </select> so 1st option is not selected. its still not working >
  10. if you don't select any thing from the list, why it is not showing any message, like "please choose one from the list"
  11. I tried with this code.... <?php if (trim($_POST['list'])<="" { $error = "Please pick from the list"; else echo "You selected ". " " . $_POST['list'] . ".<br />"; //echo $_POST['list']; } ?> but it shows me nothing. did I make any mistake?
  12. these are in menu bar, when I click on the menu, these 3options will come but I've to select only 1. so how can I validate it if I don't select any or if I select any one of them...
  13. How can I get the value from the select box, where the value is (car, bus, motorbike), should select anyone of them from the list. if not selected it should give an warning... "select the right vehical" please help me..... thanks
  14. hi here is my code for name field which is a text box. it is working if I put any digit or if the field is empty but when I put the symbols like '%$%^&*!' it still takes the value not showing any error. if ((is_numeric($name))||(empty($name))) { echo 'please enter your name<br>'; return; } can anyone please help me... thanks
×
×
  • 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.