Jump to content

Edmhar

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Edmhar

  1. Thank you i passed this problem hahaha kindly check my new post simple add and subtract mysql and php
  2. Hello. im gonna ask how i will make this happen. i have a mysql database ( StockItem, in, out, availableitem) add and subraction only assuming that I have value n my StockItem = 50 , in = 0 , out = 0 , availableitem = ( have a computation of stockitem - in & availableitem + out ) so i will have form for ( in ) The IN AND OUT are USERINPUT it will have textbox that will input the value by admin. for example i input in FOR (in) textbox = 10 then click the button process it will update the whole table affecting all the field in that row
  3. how about if i put this in html?
  4. how about if will put this in html?
  5. thanks man your great hahaha I love you No homo! you helping me to finish my Thesis
  6. i want to post if logged in i want to have echo logout link if not logged in want to echo login
  7. the order must not have set value it must be inputed by the admin who in charge in sales. <?php include 'connect.php'; //this item order must be input by officer in charge am i correct? $itemorder = ""; $query ="SELECT * FROM tbl_equipment WHERE Equip_ID ='".$itemid."' AND Equip_name ='".$itemname."' AND EquipVolume = '".$itemstock."' "; query echo $itemname; echo $itemid; echo $itemstock - $itemorder; //for example stock of camera is 15 and a customer rent 5 pcs so in my admin page i will input input the number of order and so the other customer will see after they refresh is 10 pcs ony // It must have effect in my database so im thinking i will use UPDATE but i dont know how to input it in // then if item went down to 0 it will show The item is 0 with UNAVAILBLE ?> <?php $conn_err ='Cant Connect'; $mysql_host = 'localhost'; $mysql_itemid = 'root'; $mysql_db = 'mis'; if (!@mysql_connect($mysql_host, $mysql_itemid)||!@mysql_select_db($mysql_db)) { die($conn_err); } ?> this is my connect.php
  8. you are so good in programming i hope youre like my professor hahaha BTW check this link im doing in my inventory system http://forums.phpfreaks.com/topic/283378-logical-operation-for-php-with-mysql-inventory-system/
  9. Hi guys i want to ask how to get the value of the in the mysql for example i have a equipments like camera so i have tbl_equipments with field of EquipmentID, EquipmentName, NoOfEquip, for example values EquiptmentID : 1001 EquiptmentName: Camera NoOfEquip: 15 So my customer can see if how many available camera from our website EXAMPLE A customer rent a camera for 5 pcs if i refresh the page the remaining camera items is 10 and i that customer back that item item What maybe the code? I have no idea to make this.
  10. nope i using even that cause me loop I use this <?php include '../../core.php'; if($_SESSION['login'] && $_SESSION['type'] === 'ADMINISTRATION'){ ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="../css/main.css"/> </head> <body> This is Admin. <a href="../../logout.php">Log Out!</a> </body> </html> <?php }else{ header('Location:Webpage/index.php'); } ?>
  11. Thank you i got this there is some error but so basic so my problem is now is loop when i logged in it go loop
  12. I want your this suggestion but it cause Webpage indirect loop
  13. its already same variable. but it i change the <? form action= <?php echo $current_file; ?> and it cause access forbidden
  14. your code earlier i think the php code is correct but when it go to loading to the html it go to webpage was in indrect loop wanna see my all codes?
  15. Hmm.. Hi I try your code but when i run it will go something like error. webpage do not display like that but it will to my adminhome but i will have no output.
  16. Hey man , it cause an error Notice: Undefined variable: eusername in C:\xampp\htdocs\MIS\login\loginform.php on line 36 Notice: Undefined variable: epassword in C:\xampp\htdocs\MIS\login\loginform.php on line 36 Thank you )
  17. like this? this is the home of my admin i put this <?php include '../../core.php'; if($_SESSION['login'] && $_SESSION['type'] === 'ADMINISTRATION'){ ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="../css/main.css"/> </head> <body> This is Admin. <a href="../../logout.php">Log Out!</a> </body> </html> <?php }else{ header('Location:Webpage/index.php'); } ?>
  18. HI, Guys Im back! After i successfully found my solution to problem earlier. I want to ask what code i will add to have limitation to employee to admin can access, My problem is when My Employee Logged in he will direct to localhost/MIS/Webpage/Employee/home.php This is the correct for my employee but when i changed the address to localhost/MIS/Webpage/Admin/home.php My Employee can access the admin homepage. this is the problem i want to have limitation of my employee access. so this is my codes of my index.php <?php require 'core.php'; require 'connect.php'; if (loggedin()) { if($_SESSION['type'] == 'ADMINISTRATION'){ header('Location:../Mis/Webpage/Employee/home.php'); }else if($_SESSION['type'] == 'EMPLOYEE'){ header('Location:../Mis/Webpage/Admin/home.php'); } } else{ header('Location:Webpage/index.php'); } ?> this is my loginform <?php include '../../Mis/connect.php'; include '../../Mis/core.php'; if(isset($_POST['eusername']) && isset($_POST['epassword'])){ if(!empty($_POST['eusername']) && !empty($_POST['epassword'])){ $user = mysql_real_escape_string($_POST['eusername']); $pass = mysql_real_escape_string(md5($_POST['epassword'])); $query = "SELECT * FROM tbl_account WHERE LogUsername='".$user."' AND LogPassword = '".$pass."' AND type = 'EMPLOYEE'"; if($query_run = mysql_query($query)){ $query_num_rows = mysql_num_rows($query_run); if($query_num_rows == 0){ echo "<script>alert('Incorrect Pass or User')</script>"; }else{ $user_id = mysql_result($query_run, 0, 'LogUsername'); $_SESSION['user_id']=$user_id; $_SESSION['type'] = "EMPLOYEE"; echo "<script>alert('Employee Login')</script>"; header('Location: ../../Mis/index.php'); } }else{ echo "<script>alert('Connecting Failed')</script>"; } }else{ echo "<script>alert('Sorry, You must supply Username/Password...')</script>"; } } if(isset($_POST['username']) && isset($_POST['password'])){ if(!empty($_POST['username']) && !empty($_POST['password'])){ $user = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string(md5($_POST['password'])); $query = "SELECT * FROM tbl_account WHERE LogUsername='".$user."' AND LogPassword = '".$pass."' AND type = 'ADMINISTRATION'"; if($query_run = mysql_query($query)){ $query_num_rows = mysql_num_rows($query_run); if($query_num_rows == 0){ echo "<script>alert('Incorrect Pass or User')</script>"; }else{ $user_id = mysql_result($query_run, 0, 'LogUsername'); $_SESSION['user_id']=$user_id; $_SESSION['type'] = "ADMINISTRATION"; echo "<script>alert('Admin Login')</script>"; header('Location: ../../Mis/index.php'); } }else{ echo "<script>alert('Connecting Failed')</script>"; } }else{ echo "<script>alert('Sorry, You must supply Username/Password...')</script>"; } } ?> <div id="employee"> <form action="<?php echo $current_file; ?>" method="POST"> Employee ID: <input type="text" name="eusername"> </br> Password: <input type="password" name="epassword"> <input type="submit" id="employeesubmit" value="Log in"> </form> </div> <div id="admin"> <form action="<?php echo $current_file; ?>" method="POST"> Admin ID: <input type="text" name="username"> </br> Password: <input type="password" name="password"> <input type="submit" id="adminsubmit" value="Log in"> </form> </div> This is my core.php <?php ob_start(); session_start(); $current_file = $_SERVER['SCRIPT_NAME']; function loggedin() { if (isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) { return true; } else { return false;; } } function adminloggedin() { if (isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) { return true; } else { return false;; } } ?>
×
×
  • 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.