Jump to content

coppens

Members
  • Posts

    10
  • Joined

  • Last visited

coppens's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you all so much. You are amazing. Cheers
  2. I am using the coding wizards. I want to pull the ChildcareId of the session user. The session is followed by the users 'username'. The table has UserId, UserName, ChildcareID, and UserLevel. I need the filter to look at the ChildcareID of the current user and filter all users with the same ID as well as only choosing those users with a userlevel of 1. Please help. Thank you
  3. I am using Dreamweaver and would like the results of a page to display records that have the same variable as the user that has logged in. For instance, if User A works at 'Daycare A' and 'Daycare A' is coded as workplace '5'. How do I word the statement that all persons who work at workplace '5' appear on the page. The pages are already filtered to follow the user through by username. However I need the new filter to look at the users record, choose the column 'ChildcareID' and display all others from that Childcare. I currently have this statement. SELECT * FROM users WHERE ChildcareID = colname ORDER BY LastName ASC Name: colname Type: Integer Default value: -1 Run-time value: $_SESSION['MM_Username'] Thank you
  4. I am having trouble with the coding to return the user to the previous page after submitting a form. I understand that it is usually better to create a direct link to the previous page, however there are four entrances to this page and I would like the user to return to their previous page upon submitting. I have listed the code below and I think my problem lies in line 112 or there about. Thank you so much. <?php session_start(); ?> <?php require_once('../Connections/Connect.php'); ?> <?php if (!isset($_SESSION)) { session_start(); } $MM_authorizedUsers = "1,2"; $MM_donotCheckaccess = "false"; // *** Restrict Access To Page: Grant or deny access to this page function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { // For security, start by assuming the visitor is NOT authorized. $isValid = False; // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. // Therefore, we know that a user is NOT logged in if that Session variable is blank. if (!empty($UserName)) { // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. // Parse the strings into arrays. $arrUsers = Explode(",", $strUsers); $arrGroups = Explode(",", $strGroups); if (in_array($UserName, $arrUsers)) { $isValid = true; } // Or, you may restrict access to only certain users based on their username. if (in_array($UserGroup, $arrGroups)) { $isValid = true; } if (($strUsers == "") && false) { $isValid = true; } } return $isValid; } $MM_restrictGoTo = "AnitasAnimalArk/AnimalArk.php"; if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { $MM_qsChar = "?"; $MM_referrer = $_SERVER['PHP_SELF']; if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&"; if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $MM_referrer .= "?" . $_SERVER['QUERY_STRING']; $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer); header("Location: ". $MM_restrictGoTo); exit; } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO postshift (UserID, ShiftDay, ShiftDate, ShiftMonth, ShiftYear, ShiftStartHour, ShiftStartMin, ShiftStartTime, ShiftEndHour, ShiftEndMin, ShiftEndTime, ChildcareCentre, Address, City, Telephone, EmployeeFirstName, EmployeeLastName, `Position`, EmailEmployee, EmailCentre, Comments) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['UserID'], "int"), GetSQLValueString($_POST['ShiftDay'], "text"), GetSQLValueString($_POST['ShiftDate'], "text"), GetSQLValueString($_POST['ShiftMonth'], "text"), GetSQLValueString($_POST['ShiftYear'], "int"), GetSQLValueString($_POST['ShiftStartHour'], "int"), GetSQLValueString($_POST['ShiftStartMin'], "int"), GetSQLValueString($_POST['ShiftStartTime'], "text"), GetSQLValueString($_POST['ShiftEndHour'], "int"), GetSQLValueString($_POST['ShiftEndMin'], "int"), GetSQLValueString($_POST['ShiftEndTime'], "text"), GetSQLValueString($_POST['ChildcareName'], "text"), GetSQLValueString($_POST['ChildcareAddress'], "text"), GetSQLValueString($_POST['ChildcareCity'], "text"), GetSQLValueString($_POST['ChildcareTelephone'], "int"), GetSQLValueString($_POST['EmployeeFirstName'], "text"), GetSQLValueString($_POST['EmployeeLastName'], "text"), GetSQLValueString($_POST['Position2'], "text"), GetSQLValueString($_POST['EmployeeUserEmail'], "text"), GetSQLValueString($_POST['ChildcareEmail'], "text"), GetSQLValueString($_POST['Comments'], "text")); mysql_select_db($database_Connect, $Connect); $Result1 = mysql_query($insertSQL, $Connect) or die(mysql_error()); $insertGoTo = "HTTP_REFERER"; if (isset($_SERVER["HTTP_REFERER"])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_Connect, $Connect); $query_PostShift = "SELECT * FROM postshift"; $PostShift = mysql_query($query_PostShift, $Connect) or die(mysql_error()); $row_PostShift = mysql_fetch_assoc($PostShift); $totalRows_PostShift = mysql_num_rows($PostShift); $query_PostShift = "SELECT * FROM postshift"; $PostShift = mysql_query($query_PostShift, $Connect) or die(mysql_error()); $row_PostShift = mysql_fetch_assoc($PostShift); $totalRows_PostShift = mysql_num_rows($PostShift); $query_PostShift = "SELECT * FROM postshift"; $PostShift = mysql_query($query_PostShift, $Connect) or die(mysql_error()); $row_PostShift = mysql_fetch_assoc($PostShift); $totalRows_PostShift = mysql_num_rows($PostShift); $query_PostShift = "SELECT * FROM postshift"; $PostShift = mysql_query($query_PostShift, $Connect) or die(mysql_error()); $row_PostShift = mysql_fetch_assoc($PostShift); $totalRows_PostShift = mysql_num_rows($PostShift); $colname_Users = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_Users = $_SESSION['MM_Username']; } mysql_select_db($database_Connect, $Connect); $query_Users = sprintf("SELECT * FROM users WHERE UserName = %s", GetSQLValueString($colname_Users, "text")); $Users = mysql_query($query_Users, $Connect) or die(mysql_error()); $row_Users = mysql_fetch_assoc($Users); $totalRows_Users = mysql_num_rows($Users); $colname_Childcare = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_Childcare = $_SESSION['MM_Username']; } mysql_select_db($database_Connect, $Connect); $query_Childcare = sprintf("SELECT * FROM users INNER JOIN childcareinfo ON users.ChildcareID = childcareinfo.ChildcareID WHERE users.UserName = %s", GetSQLValueString($colname_Childcare, "text")); $Childcare = mysql_query($query_Childcare, $Connect) or die(mysql_error()); $row_Childcare = mysql_fetch_assoc($Childcare); $totalRows_Childcare = mysql_num_rows($Childcare); ?>
×
×
  • 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.