Edmhar
Members-
Posts
31 -
Joined
-
Last visited
Everything posted by Edmhar
-
Thank you i passed this problem hahaha kindly check my new post simple add and subtract mysql and php
-
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
-
how about if i put this in html?
-
how about if will put this in html?
-
thanks man your great hahaha I love you No homo! you helping me to finish my Thesis
-
i want to post if logged in i want to have echo logout link if not logged in want to echo login
-
LOGICAL OPERATION FOR PHP WITH MYSQL (INVENTORY SYSTEM)
Edmhar replied to Edmhar's topic in PHP Coding Help
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 -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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/ -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
Thank You i wil update you -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
-
LOGICAL OPERATION FOR PHP WITH MYSQL (INVENTORY SYSTEM)
Edmhar replied to Edmhar's topic in PHP Coding Help
-
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.
-
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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'); } ?> -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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 -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
What you think the problem is? hahha -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
I want your this suggestion but it cause Webpage indirect loop -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
its already same variable. but it i change the <? form action= <?php echo $current_file; ?> and it cause access forbidden -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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? -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
Oh sorry The output is the website is in indrect loop -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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. -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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 ) -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
HEY THANK YOU )) VERY USEFUL THANKS -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
Thank yo guys will try it -
2 Types of Users problem (Problem: Dont have Limitation)
Edmhar replied to Edmhar's topic in PHP Coding Help
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'); } ?> -
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;; } } ?>