Jump to content

bal bal

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by bal bal

  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
  15. hi I have got a form with name, email address and choose the pet from the list (cat or dog). How can I do the form validation with PHP, if anyone put the wrong name or invalid email address and don't choose anything from the pet list? please help me... thanks
  16. thanks for the reply. Just to make it a bit clear. I have got a textbox for name and another one for email address and a select button (value is cat, cow, dog) from where I will select one and validate the user name and email address. so the name field should not contain any digit and the email address should be a valid email address... thanks once again
  17. Hi I am new in PHP, I did this using perl but don't know how to do the form validation using PHP. here is the code for perl. can anyone please help me how can I do the form validation using PHP. I have got "text box" and "select" from the list in the PHP form. Thanks in advance. #!/usr/bin/perl - w use CGI ':standard'; use CGI::Carp "fatalsToBrowser"; use DBI; print header; $forename=param('txtfname'); $surname=param('txtsurname'); $day=param('lstday'); $month=param('lstmonth'); $year=param('lstyear'); $passport=param('txtpassport'); $gender=param('lstgender'); $email=param('txtemailadd'); $phone=param('txtphone'); $galaxy=param('lstgalaxy'); $flightdate=param('dptdate'); $flightmonth=param('dptmonth'); $flightyear=param('dptyear'); print "<html> <body bgcolor=\"burlyWood\">"; if ($forename !~/\A[A-Z][a-z]+\Z/i) { print "Please enter a valid forename<br>"; print "</body></html>"; } else { print "Forename: $forename <br>"; } if ($surname !~/\A[A-Z][a-z]+\Z/i) { print "\n Please enter a valid Surname <br>"; print "</body></html>"; } else { print "\n\nSurname: $surname <br>"; } if ($day !~m/\d/) { print "Please choose the valid date<br>"; print "</body></html>"; } else { print "Date of Birth "; print "$day/"; } if ($month !~m/\d/) { print "Please choose the valid month<br>"; print "</body></html>"; } else { print "$month/"; } if ($year !~m/\d/) { print "Please choose the valid year<br>"; print "</body></html>"; } else { print "$year<br>"; } if ($passport !~m/\d/) { print "Please enter 4 digits(0 to 9)"; print "</body></html>"; } else { print "Passport Number: $passport <br>"; } if ($gender !~/\A[A-Z][a-z]+\Z/i) { print "Please choose a gender<br>" } else { print"Gender: $gender<br>"; } if ($email !~m/\A[A-Z][a-z]|d+\@\[A-Z][a-z]|d+\.\[A-Z][a-z]|d+\z/i) { print "Please enter a valid email address<br>"; } else { print "Email: $email<br>"; } if ($phone !~m/\A\d+\Z/) { print "Please enter a valid phone number<br>"; print "</body></html>"; } else { print "Phone Number: $phone <br>"; } if ($galaxy !~/\A[A-Z][a-z]+\Z/i) { print "Please choose one from the list<br>" } else { print"Galaxy: $galaxy<br>"; } if ($flightdate !~m/\d/) { print "Please choose the valid date<br>"; print "</body></html>"; } else { print "Departure Date "; print "$flightdate/"; } if ($flightmonth !~m/\d/) { print "Please choose the valid month<br>"; print "</body></html>"; } else { print "$flightmonth/"; } if ($flightyear !~m/\d/) { print "Please choose the valid year<br>"; print "</body></html>"; } else { print "$flightyear<br>"; }
  18. should I use session_start(); in every pages?
  19. i've got a table called log_dtls where it stores the user name and password. what I want is, when I logged in, it should show the user name and the last login details, like when logged in before. it should like the bank account page, when you logged in your account, it shows your name and when you last logged in.... thanks
  20. hi when I logged in, the details (user ID & last loggin in time) should show in each pages... can anyone please help me how can I do this? I have got login page with user name and password. when I logged in, it shows the details in the in each pages untill I logged out. can anyone please help to how can I do this? thanks
  21. thanks all of you guys, I will start the way you guys told me to do. you all are really helpful. I keep posting the progress of it. thanks once again
  22. Hi this is Sha. I don't know how to start. I am going to design a database where there will be two tables, one for log in details and another one will be for student marks. There should be a standard say 40 marks. If any student gets less than 40, and everytime when he/she log in to the system, it will show him/her a message say for example "do more practice" until he/she reach the standard. I have got no clue how to start. Can anyone please help me to how to start? I am sorry if I post this in the wrong forum. Thanks... Sha
×
×
  • 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.