Skip navigation
Currently Being Moderated

Authentication user login?

Apr 4, 2013 7:46 AM

Im trying to creating an Authentication user login for a page (update.php) which is only to be used by staff to upload data to a database. Im not sure if i have gone about it the right way? but im having a few problems, firstly the page will only view in dreamweaver, i just get a blank page if i try to view in a browser.  Here is the code -

 

<?php ini_set('display_errors',1); ?>

<?php require_once('Connections/milesdata.php'); ?>

<?php

if (array_key_exists('submit', $_POST)) {

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"] == "dataUpdate_form")) {

  $insertSQL = sprintf("INSERT INTO donation (name, url) VALUES (%s, %s)",

                       GetSQLValueString($_POST['name'], "text"),

                       GetSQLValueString($_POST['url'], "text"));

 

 

  mysql_select_db($database_milesdata, $milesdata);

  $Result1 = mysql_query($insertSQL, $milesdata) or die(mysql_error());

}

 

 

 

 

$colname_Recordset1 = "-1";

if (isset($_POST['password'])) {

  $colname_Recordset1 = $_POST['password'];

}

mysql_select_db($database_milesdata, $milesdata);

$query_Recordset1 = sprintf("SELECT * FROM `user` WHERE password = %s", GetSQLValueString($colname_Recordset1, "text"));

$Recordset1 = mysql_query($query_Recordset1, $milesdata) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

 

 

mysql_free_result($Recordset1);

?>

}

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>donations</title>

<link href="Style sheet.css" rel="stylesheet" type="text/css">

<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>

<script src="Spry-UI-1.7/includes/SpryDOMUtils.js" type="text/javascript"></script>

<script src="Spry-UI-1.7/includes/SpryDOMEffects.js" type="text/javascript"></script>

<script src="Spry-UI-1.7/includes/SpryWidget.js" type="text/javascript"></script>

<script src="Spry-UI-1.7/includes/SpryMenu.js" type="text/javascript"></script>

<script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPl ugin.js" type="text/javascript"></script>

<script src="Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPl ugin.js" type="text/javascript"></script>

<script type="text/javascript" src="SpryAssets/SpryValidationTextField.js"></script>

<script type="text/javascript" src="SpryAssets/SpryValidationCheckbox.js"></script>

<link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css">

<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">

<link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css">

<style type="text/css">

#apDiv2 {

          position:absolute;

          width:815px;

          height:1173px;

          z-index:2;

          left: 137px;

          top: 188px;

          color: #000;

          font-family: "Palatino Linotype", "Book Antiqua", Palatino,

 

serif;

          background-image: url(images/scrollbg%20copy.jpg);

          background-repeat: no-repeat;

          background-color: #F4ECC5;

          /* [disabled]overflow: scroll; */

}

body,td,th {

          font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;

          font-size: 16px;

          color: #000000;

          width: 200px;

          height: auto;

          margin-top: 0px;

}

body {

          z-index: 1;

          height: 1284px;

          width: auto;

          margin-left: 0px;

          margin-right: 0px;

          background-image: url(images/golden-field2.jpg);

          background-color: #ffffcc;

          background-repeat: repeat;

}

#apDiv1 {

          position:absolute;

          width:124px;

          height:1158px;

          z-index:2;

          left: 952px;

          top: 186px;

          background-repeat: repeat;

          border-top-width: 9px;

          border-top-style: solid;

          border-bottom-style: solid;

          border-bottom-width: 9px;

          border-top-color: #BF9C29;

          border-bottom-color: #BF9C29;

          background-image: url(images/button2.jpg);

          border-right-width: 4px;

          border-right-color: #DEBF55;

          border-right-style: solid;

          border-left-width: 4px;

          border-left-style: solid;

          border-left-color: #DEBF55;

}

#apDiv3 {

          position:absolute;

          width:144px;

          height:92px;

          z-index:3;

          left: 534px;

          top: -1px;

}

#apDiv4 {

          position:absolute;

          width:816px;

          height:106px;

          z-index:2;

          left: 0px;

          right: auto;

          margin-right: auto;

          top: 1361px;

          box-shadow: 3px 3px 8px #666;

          visibility: visible;

}

#apDiv5 {

          position:absolute;

          width:141px;

          height:616px;

          z-index:4;

          left: 833px;

          top: 48px;

}

#apDiv6 {

          position:absolute;

          width:134px;

          height:40px;

          z-index:1;

          left: 389px;

          top: 99px;

}

a:link {

          color: #B30D19;

          text-decoration: none;

}

a:visited {

          text-decoration: none;

          color: #B30D19;

}

a:hover {

          text-decoration: none;

          color: #CFB345;

}

a:active {

          color: #B30D19;

          text-decoration: none;

}

</style>

<script type="text/javascript">

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}

function MM_goToURL() { //v3.0

  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;

  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");

}

</script>

<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">

</script>

<link href="Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css" rel="stylesheet" type="text/css">

<style type="text/css">

/* BeginOAWidget_Instance_2141544: #MenuBar */

/* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in

          these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css

 

           These assume the following widget classes for menu layout (set in a preset)

          .MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right.

          .MenuBarVertical - vertical main bar; all submenus are pull-right.

 

          You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset.

          They only apply to horizontal menu bars:

                    MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned

                    MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned

                    MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned. 

                    MenuBarFixedCentered -  - Fixed at a specified width set in the rule '.MenuBarFixedCentered',

                                                            and centered in its parent container.

                    MenuBarFullwidth - Grows to fill its parent container width.

 

          In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along

          with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations,

          there are a few rules where this was not possible. Those rules are so noted in comments.

 

*/

 

 

#MenuBar  {

          background-color:transparent;

          font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer,

                                                                                                                         MenuItem, and MenuItemLabel

                                                                                                                         at a given level all use same definition for ems.

                                                                                                                         Note that this means the size is also inherited to child submenus,

                                                                                                                         so use caution in using relative sizes other than

                                                                                                                         100% on submenu fonts. */

          font-weight: bold;

          font-size: 16px;

          font-style: normal;

          padding:0;

          background-image: url(images/button2.jpg);

          background-repeat: repeat;

          border-top-width: 9px;

          border-right-width: 4px;

          border-bottom-width: 9px;

          border-left-width: 4px;

          border-top-style: solid;

          border-right-style: solid;

          border-bottom-style: solid;

          border-left-style: solid;

          border-top-color: #bf9c29;

          border-right-color: #debf55;

          border-bottom-color: #bf9c29;

          border-left-color: #debf55;

          z-index: 3;

          height: 1159px;

}

/* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this

widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar

in this section. These have very low specificity, so be careful not to accidentally override them. */

 

 

.MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */

          display:none;

}

.MenuBarLeftShrink {

          float: left; /* shrink to content, as well as float the MenuBar */

          width: 8em;

}

.MenuBarRightShrink {

          float: right; /* shrink to content, as well as float the MenuBar */

          width: 8em;

}

.MenuBarFixedLeft {

          float: left;

          width: 8em;

}

.MenuBarFixedCentered {

          float: none;

          width: 8em;

          margin-left:auto;

          margin-right:auto;

}

.MenuBarFixedCentered br {

          clear:both;

          display:block;

}

.MenuBarFixedCentered .SubMenu br {

          display:none;

}

.MenuBarFullwidth {

          float: left;

          width: 100%;

}

 

 

/* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */

#MenuBar  .MenuItemContainer {

          padding: 0px 0px 0px 0px;

          margin: 0;           /* Zero out margin  on the item containers. The MenuItem is the active hover area.

                                        For most items, we have to do top or bottom padding or borders only on the MenuItem

                                        or a child so we keep the entire submenu tiled with items.

                                        Setting this to 0 avoids "dead spots" for hovering. */

}

#MenuBar  .MenuItem {

          padding: 13px 0px 13px 0px;

          background-color:transparent;

          border-top-width: 1px;

          border-right-width: 1px;

          border-left-width: 1px;

          border-top-style: none;

          border-right-style: none;

          border-bottom-style: none;

          border-left-style: none;

          border-top-color: transparent;

          border-right-color: transparent;

          border-bottom-color: transparent;

          border-left-color: transparent;

}

#MenuBar .MenuItemLast {

}

 

 

#MenuBar  .MenuItem  .MenuItemLabel{

          text-align:left;

          color:#000000;

          background-color:transparent;

          width: auto;

          font-size: 16px;

          padding-right: 0px;

          padding-left: 12px;

}

.SpryIsIE6 #MenuBar  .MenuItem  .MenuItemLabel{

          width:1em; /* Equivalent to min-width in modern browsers */

}

 

 

/* First level submenu items */

#MenuBar .SubMenu  .MenuItem {

          font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;

          font-weight: bold;

          font-size: 16px;

          font-style: normal;

          background-color:transparent;

          color: #000;

          background-image: url(images/button2.jpg);

          background-repeat: repeat;

          border-bottom-width: 1px;

          border-top-style: none;

          border-right-style: none;

          border-bottom-style: solid;

          border-left-style: none;

          border-top-color: transparent;

          border-right-color: transparent;

          border-bottom-color: transparent;

          border-left-color: #BF9C29;

          padding-top: 13px;

          padding-right: 0px;

          padding-left: 12px;

}

#MenuBar  .SubMenu .MenuItemFirst {

          border-style: none none solid none;

}

#MenuBar  .SubMenu .MenuItemFirst .MenuItemLabel{

          padding-top: 0px;

}

#MenuBar .SubMenu .MenuItemLast {

          border-style: none none solid none;

}

#MenuBar .SubMenu .MenuItemLast .MenuItemLabel{

          padding-bottom: 0px;

}

#MenuBar .SubMenu .MenuItem .MenuItemLabel{

          text-align:left;

          line-height:1em;

          background-color:transparent;

          color:#333333;

          padding: 0px 0px 0px 12px;

          width: 8em;

 

}

 

 

/* Hover states for containers, items and labels */

#MenuBar .MenuItemHover {

          background-color: transparent;

          border-color: transparent transparent #bf9c29 transparent;

}

 

 

#MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{

          background-color: transparent; /* consider exposing this prop separately*/

          color: #991115;

}

#MenuBar .MenuItemHover .MenuItemLabel{

          background-color: transparent;

          color: #991115;

}

#MenuBar .SubMenu .MenuItemHover {

          background-color: transparent;

          border-color: transparent transparent #bf9c29 transparent;

}

 

 

#MenuBar .SubMenu .MenuItemHover .MenuItemLabel{

          background-color: transparent;

          color: #991115;

}

/* Submenu properties -- First level of submenus */

#MenuBar .SubMenuVisible {

          background-color: transparent;

          min-width:100%;  /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */

          border-color: transparent transparent transparent transparent;

          border-width:0px;

          border-style: none none none none;

}

#MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */

          top: 100%;          /* 100% is at the bottom of parent menuItemContainer */

          left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem,

                                                  and your personal taste.

                                                  0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0

                                                  on MenuItemContainer and MenuItem on the parent

                                                  menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align

                                                  the dropdown with the left of the menu item label.*/

          z-index:10;

}

#MenuBar.MenuBarVertical .SubMenuVisible {

          top: 0px;

          left:100%;

          min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */

}

/* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */

#MenuBar .MenuLevel1 .SubMenuVisible {

          background-color: transparent;

          min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/

          top: 0px;          /* If desired, you can move this down a smidge to separate top item''s submenu from menubar -

                                        that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more

                                        vertically 'centered' on its invoking item */

          left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a

                                        negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value

                                        to use px or ems to get the offset you want. */

}

/* IE6 rules - you can delete these if you do not want to support IE6 */

 

 

/* A note about multiple classes in IE6.

* Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu),

* giving the selector '.MenuItemWithSubMenu.MenuItemHover'.

* Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores

* all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this

* problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'.

* Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class

* syntax for that. Since IE6 both applies rules where

* it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden.

* So, we put the multiple class rule first. IE6 will mistakenly apply this rule.  We follow this with the single-class rule that it would

* mistakenly override, making sure the  misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins.

* We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for

* the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the

* css style block to make it easy to delete if you want to drop IE6 support.

* If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script.

* The 'SpryIsIE6' class is placed on the HTML element by  the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules.

*/

.SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector  */{

          background-color: transparent; /* consider exposing this prop separately*/

          color: #a43a3a;

}

.SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector  */{

          background-color: transparent; /* consider exposing this prop separately*/

          color: #991115;

}

.SpryIsIE6 #MenuBar .SubMenu .SubMenu  /* IE6 selector  */{

          margin-left: -12px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */

}

 

 

 

/* EndOAWidget_Instance_2141544 */

</style>

<script type="text/xml">

<!--

<oa:widgets>

  <oa:widget wid="2141544" binding="#MenuBar" />

</oa:widgets>

-->

</script>

<link href="webassist/forms/fd_newfromblank_default.css" rel="stylesheet" type="text/css">

</head>

<body>

<div id="container">

  <div id="apDiv1"><span class="maintext"><img src="images/faslogo.jpg" alt="FAS logo" width="104" height="68" vspace="80" class="logo1" id="Image2" onClick="MM_goToURL('parent','http://www.nafd.org.uk/funeral-advice/about-us/funeral-arbitration-sch eme.aspx');return document.MM_returnValue"><img src="images/nafdlogo.jpg" alt="nafd logo" width="100" height="100" vspace="40" class="logo2" onClick="MM_goToURL('parent','http://www.nafd.org.uk/funeral-advice/funeral-advice-home.aspx');retur n document.MM_returnValue"><img src="images/fiatlogo.jpg" alt="fiat logo" width="124" height="84" hspace="0" vspace="80" class="logo3" onClick="MM_goToURL('parent','http://www.thanos.org/index.php?lang=1');return document.MM_returnValue"><img src="images/bifdlogo.jpg" alt="bifd logo" width="99" height="108" hspace="0" vspace="30" class="logo4" onClick="MM_goToURL('parent','http://www.bifd.org.uk/');return document.MM_returnValue"></span></div>

  <div id="apDiv2">

    <p> </p>

    <p class="subheading2"> </p>

<p class="subheading2"><span class="headingfuneral">Miles and Daughters database.</span></p>

<p> </p>

<form method="POST" name="login_form">

<table cellpadding="2" cellspacing="0" border="0">

    <tr>

      <td align="right"><label for="password">Username</label>

      <td><input name="username" type="text" id="username" value="" size="60"></td>

    </tr>

    <tr>

    <td align="right"><label for="password">Password</label>

      <td><input name="password" type="text" id="password" value="" size="60"></td>

     <tr>

      <td align="center" colspan="2"> </td>

    </tr>

        <td align="center" colspan="2"><input name="submit" type="submit" class="submit" value="Login" ></td>

    </tr>

    <tr>

      <td align="center" colspan="2"> </td>

    </tr>

  </table>

</form>

    <p class="maintext"> </p>

    <?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>

  <form action="<?php echo $editFormAction; ?>" method="POST" name="dataUpdate_form">

    <table cellpadding="2" cellspacing="0" border="0">

      <tr>

        <td align="right"><label for="name">Deceased Name</label>

          <td><input name="name" type="text" id="name" value="" size="60"></td>

        </tr>

      <tr>

        <td align="right"><label for="url">Deceased URL</label>

          <td><input name="url" type="text" id="url" value="" size="60"></td>

        <tr>

          <td align="center" colspan="2"> </td>

          </tr>

      <td align="center" colspan="2"><input name="submit" type="submit" class="submit" value="Update" ></td>

        </tr>

      <tr>

        <td align="center" colspan="2"> </td>

        </tr>

      </table>

    <input type="hidden" name="MM_insert" value="dataUpdate_form">

  </form>

  <?php } // Show if recordset not empty ?>

 

<p class="maintext"> </p>

    <p class="maintext"> </p>

    <p class="maintext"> </p>

    <p class="maintext"> </p>

  </div>

  <img src="banner.jpg" alt="banner" width="1082" height="187" id="Image1">

  <ul id="MenuBar">

    <li><a href="index.html">Home page</a></li>

    <li><a href="whychooseMD.html">Why choose us?</a></li>

    <li><a href="our-staff.html">Our team</a></li>

    <li><a href="our-premises.html">Our premises</a></li>

    <li><a href="funeral-services.html" class="MenuBarItemSubmenu">Our funeral services</a>

      <ul>

        <li><a href="funeral-services.html">Introduction</a></li>

        <li><a href="our-vehicles.html">Our vehicles</a></li>

        <li><a href="traditional-funeral.html">Traditional funerals</a></li>

        <li><a href="other-services.html">Other services</a></li>

        <li><a href="enviro-f-funerals.html">&quot;Green&quot; funerals</a></li>

        <li><a href="diy.html">DIY funerals</a></li>

        <li><a href="faq.html">Frequently asked questions</a></li>

      </ul>

    </li>

    <li><a href="estimator.html">Funeral costs estimator</a></li>

    <li><a href="vintage.html">Vintage vehicles</a></li>

    <li><a href="memorials.html">Memorials</a></li>

    <li><a href="funeral-planning.html">Pre-paid funerals</a></li>

    <li><a href="testimonial.html">Testimonials</a></li>

    <li><a href="contact.html">Contact us</a></li>

    <li><a href="advice-and-info.html" class="MenuBarItemSubmenu">Advice &amp; Information</a>

      <ul>

        <li><a href="advice-and-info.html">Introduction</a></li>

        <li><a href="regist-death.html">Registering the death</a></li>

        <li><a href="h.m-coroner.html">H.M. Coroner</a></li>

        <li><a href="funeral-costs.html">Funeral costs</a></li>

        <li><a href="b'support.html">Bereavement support</a></li>

      </ul>

    </li>

    <li><a href="useful-addresses.html">Useful addresses</a></li>

    <li><a href="directions.html">How to find us</a></li>

    <li><a href="florist.html">Floristry</a></li>

    <li><a href="donations.html">Donate in memory</a></li>

    <li><a href="nafd.html">NAFD</a></li>

    <li><a href="inspiration.html">Inspiration for your service</a></li>

    <li><a href="miles-and-daughters diary.html">Diary of a funeral director</a></li>

  </ul>

  <div id="apDiv4"><img src="images/footer.jpg" width="1082" height="139"></div>

</div>

<!-- end container -->

<script type="text/javascript">

// BeginOAWidget_Instance_2141544: #MenuBar

var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {

      widgetID: "MenuBar",

            widgetClass: "MenuBar MenuBarVertical MenuBarMenuBarVerticalLeftShrink",

            insertMenuBarBreak: true,

      mainMenuShowDelay: 200,

      mainMenuHideDelay: 200,

      subMenuShowDelay: 200,

      subMenuHideDelay: 200

      });

// EndOAWidget_Instance_2141544

 

 

</script>

</body>

</html>

 
Replies
  • Currently Being Moderated
    Apr 4, 2013 7:59 AM   in reply to Ness_quick

    Start from scratch........create an 'admin' folder in your site folder. Create a php page in that folder and call it insert_donation.php.

     

    Open the page and go to Insert>Data Object>Insert Record> use the Insert Record Wizard.

     

    This will automaically create a table/form for you on the page. All you have to do is style it with css. The styling only needs to be basic for an admin page as no one but that staff are going to see it. Typically I include the client logo and 'Administration Area' at the top of the page.

     

    Get the insert and update pages sorted out first then come back and create an index.php which will house the Username/Password form.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2013 8:34 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Ok done that and all is working as it should,  how exciting!! Right, so what do i need to do now?

    Do the same for the update page.

     

    Create a page named update_donation.php

     

    Open the page and go to Insert>Data Object>Update Record> use the Insert Update Wizard.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2013 10:02 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Its asking me to set up a recordset, what should i do here?

     

    Set up a recordset

     

    call it rsUpdate

     

    Actually before you can work on the update part of the admin page you need to add another field to your database as the recordset needs to be filtered by a 'unique' identifer field in the database

     

    Call the field donationID and insert it before the 'name' field - phpMyAdmin lets you insert additional fields, in the position you want before or after other fields.

     

    This field is used as a 'unique' identifier for the records.  For the 'Type' of field choose 'Int' and the 'value' insert 11. Choose 'Primary' and 'Auto Increments' also.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2013 11:34 PM   in reply to Ness_quick

    On this particular page you just select ALL from the donations table and don't choose any filtering options as you want to build a list of names and urls associated with those names on the page.

     

    After you have selected ALL  from the donations table insert a 1 row 3 column table on your page and using the server behaviours 'bind' option select the  database field 'name' from the bindings panel for the first table column and click insert. In the second column 'bind' the databsase field 'url' to it. In the third column just insert a link into the <td></td> cell - <a href="donations_update_details.php">Update</a>

     

    Once that is complete select the <tr></tr> row tag of the table (the row of <td></td> cells that the two bindings and link are in)  from the bottom of DW's design view window OR you can select it in code view.

     

    From server behaviours select Repeat Region and select show all records.

     

    If you have completed this correctly when the page is viewed in a browser it will list all records in the database, with a link beside them.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 12:27 AM   in reply to Ness_quick

    Now add this - ?donationsID=<?php echo $row_rsUpdate['donationID']; ?> to the link(as below)

     

     

    <a href="donations_update_details.php?donationID=<?php echo $row_rsUpdate['donationID']; ?>">Update</a>

     

    That should append the donationID to the link like: (Check it does by looking at the 'view source code' in the browser.

     

    <a href="donations_update_details.php?donationID=1">Update</a>

    <a href="donations_update_details.php?donationID=2">Update</a>

     

     

    If that happens then that page is complete, save for a bit of visual styling.

     

    The next step is to create the 'donations_update_details.php' page where the above links are pointing to, so the information can be retreived from the database and inserted into editable form fields for updating.

     

    On this page create another recordset named rsDonationDetails. You want to filter by donationID, choose URL Parameter and in the box opposite URL Parameter type in donationID

     

    Then use go to Insert > Data Objects > Update Record > use the wizard which should create a table on the page much in the same way as it did when yo used the 'insert record' wizard.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 3:58 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    I have done the above to the update_dontion.php page which is doing exactly as you said it should but i just wantd to double check, at the moment there is no form on this page, if you remember i was going to create a form for it in 'update record from wizard' but it prompted me to create a recordset for it first. Should i have gone back to make a form for it at some point?

    When you selected the update wizard was a form not created along with the table?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 4:52 AM   in reply to Ness_quick

    Oh ok thats alright no form should be on the page you posted. That's just a list of all the records in the database, which is what you want.

     

    That's that page finished.

     

    Did you create the donations_update_details.php page as per my instructions in my other post? This is the page which will automatically generate the update table and form.

     

    Here's my previous post:

     

    The next step is to create the 'donations_update_details.php' page where the above links are pointing to, so the information can be retreived from the database and inserted into editable form fields for updating.

     

    On this page create another recordset named rsDonationDetails. You want to filter by donationID, choose URL Parameter and in the box opposite URL Parameter type in donationID

     

    Then use go to Insert > Data Objects > Update Record > use the wizard which should create a table on the page much in the same way as it did when yo used the 'insert record' wizard.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 5:06 AM   in reply to Ness_quick

    And does it all work?

     

    You can update the information in the database now and insert new records?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 5:30 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Should there be a list of the data (names,urls) appear at the top of form so that staff can select which data they wish to update? T

     

     

    No, the  list is on the update_donation.php right?

     

    Have you checked that the link on that page is getting the correct donationID by looking at the source code in the browser?

     

    It's supposed to look like below where the donationID 1, 2 etc is appended to the link. Is that correct?

     

    <a href="donations_update_details.php?donationID=1">Update</a>

    <a href="donations_update_details.php?donationID=2">Update</a>

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 6:12 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Apologies! Its all working perfectly, i was just being a little slow! A couple of things, can we have an 'update' button on the insert_donation.php page so that staff only have to load the one page in order to access the others? 

     

    That's a little more complex and I doubt I could walk you through that one. Same with the delete idea, its doable but adds another layer of complexity.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 7:16 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Ok not to worry. With the update_donations.php the data is displayed in a 1 row with 3 cols and is repeated across the page, is there a way so that the three cols are repeat vertically down the page instead?

     

     

     

     

    The do/while loop has some how inserted itself in the wrong place.

     

    The <?php do { ?> bit should be before the <tr> and the <?php } while bit after the </tr> as below:

     

     

     

    <?php do { ?>

      <tr>

    <td><?php echo $row_rsUpdate['name']; ?></td>

    <td><?php echo $row_rsUpdate['url']; ?></td>

    <td><a href="donations_update_details.php?donationID=<?php echo $row_rsUpdate['donationID']; ?>">Update</a>

    </td>

    </tr>

    <?php } while ($row_rsUpdate = mysql_fetch_assoc($rsUpdate)); ?>

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 8:24 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Excellent that exactly what i wanted. Now theres just the one last thing, i'd like there to be a security username and password that has to be entered in order to gain access to the donation_insert.php page, how do i do that? I see in server behavior there is a 'restrict access to page' option but im sure it has to be more complicated than that?

     

    At this stage now you have the guts of it working I would duplicate the 'admin' folder so if anything goes wrong from this stage forward you can recall the files which are working to date.

     

     

    First you need to create another table in your database.

     

    Call it users and give it 3 fields:

     

    userID - Int(11) - Primary & Auto Increments

    username -varchar(50)

    password - (varchar(50)

     

     

    Then in the admin folder create a index.php page and put a form on the page with text field names 'username' and 'password'

     

    Include a submit button and point the forms action field to the insert donations php page.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 9:35 AM   in reply to Ness_quick

    My mistake......remove the action from the actions field in the form so it just says action=""

     

    Then apply the 'login in user' server behaviour under 'user authentication' menu to the index.php page.

     

    That gets the username and password from the database.

     

    In the page to go to field type in the insert donations page url.

     

    Once that is done. Open the insert donations page and apply the 'Restrict Access to page' behaviour. Authenticate by user and password, choose the radio button.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 10:20 AM   in reply to Ness_quick

    Paste the pages code here please.

     

    I'll look at it tonight.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 1:33 PM   in reply to Ness_quick

    Try this for the index.php page:

     

     

    <?php require_once('../Connections/milesdata.php'); ?>

    <?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;

    }

    }

    ?>

    <?php

    // *** Validate request to login to this site.

    if (!isset($_SESSION)) {

      session_start();

    }

     

    $loginFormAction = $_SERVER['PHP_SELF'];

    if (isset($_GET['accesscheck'])) {

      $_SESSION['PrevUrl'] = $_GET['accesscheck'];

    }

     

    if (isset($_POST['username'])) {

      $loginUsername=$_POST['username'];

      $password=$_POST['password'];

      $MM_fldUserAuthorization = "";

      $MM_redirectLoginSuccess = "insert_donation.php";

      $MM_redirectLoginFailed = "failed_login.php";

      $MM_redirecttoReferrer = false;

      mysql_select_db($database_milesdata, $milesdata);

     

      $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username=%s AND password=%s",

        GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

      

      $LoginRS = mysql_query($LoginRS__query, $milesdata) or die(mysql_error());

      $loginFoundUser = mysql_num_rows($LoginRS);

      if ($loginFoundUser) {

         $loginStrGroup = "";

       

        //declare two session variables and assign them

        $_SESSION['MM_Username'] = $loginUsername;

        $_SESSION['MM_UserGroup'] = $loginStrGroup;         

     

        if (isset($_SESSION['PrevUrl']) && false) {

          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];   

        }

        header("Location: " . $MM_redirectLoginSuccess );

      }

      else {

        header("Location: ". $MM_redirectLoginFailed );

      }

    }

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

     

    <html xmlns="http://www.w3.org/1999/xhtml">

     

    <head>

     

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

     

    <title>Security Login</title>

     

    <link href="../Style sheet.css" rel="stylesheet" type="text/css" />

     

    </head>

     

     

     

     

     

    <body>

     

    <div id="container">

    <p><img src="../banner.jpg" width="1082" height="187" alt="banner" /></p>

    <p class="admin_heading">Security Login</p>

    <form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">

    <table align="center">

    <tr valign="baseline">

    <td height="25" align="right" nowrap="nowrap" bgcolor="#E6CC7F">Username</td>

    <td height="25" bgcolor="#E6CC7F"><input type="text" name="username" value="" size="60" /></td>

    </tr>

    <tr valign="baseline">

    <td height="25" align="right" nowrap="nowrap" bgcolor="#F5E7B8">Password</td>

    <td height="25" bgcolor="#F5E7B8"><input type="text" name="password" value="" size="60" /></td>

    </tr>

    <tr valign="baseline">

    <td nowrap="nowrap" align="right"> </td>

    <td><input type="submit" class="submit" value="Login" /></td>

    </tr>

    </table>

    </form>

    </div>

    </body>

    </html>

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2013 1:47 PM   in reply to Ness_quick

    I dont see anything wrong with the 'insert_donations.php' page apart from you'll want the page to be redirected to the index.php page NOT failed_login.php:

     

    $MM_restrictGoTo = "failed_login.php";

     

    You can reset that easy enough. The user hasn't tried to login yet.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2013 5:55 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Ok so i changed that and the 'index.php' comes up first when i try to load 'insert_donation.php' page which is all great but when i enter the login details, it wont go through to 'insert_donation.php'. I double checked the details and they are definately correct, also if they werent correct it should direct to 'failed_login.php'. Which makes me think its not submitting properly, this is the code for the login form -

     

    <form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">

        <table align="center">

          <tr valign="baseline">

            <td height="25" align="right" nowrap="nowrap" bgcolor="#E6CC7F">Username</td>

            <td height="25" bgcolor="#E6CC7F"><input type="text" name="username" value="" size="60" /></td>

            </tr>

          <tr valign="baseline">

            <td height="25" align="right" nowrap="nowrap" bgcolor="#F5E7B8">Password</td>

            <td height="25" bgcolor="#F5E7B8"><input type="text" name="password" value="" size="60" /></td>

            </tr>

          <tr valign="baseline">

            <td nowrap="nowrap" align="right"> </td>

            <td><input type="submit" class="submit" value="Login" /></td>

            </tr>

          </table>

      </form>

     

    Did you copy the code for your index.php page I supplied in my post prior to the last one?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2013 7:41 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Sorry i didnt see that post, i have replaced the code with what you supplied and tested it but it seems you can put any username or password in and it will accept it, even if you dont put any details in at all, it will still go through to insert_donation.php?

    Make sure your brower is not getting the old index.php page from its memory by flushing the cache or at least inserting something on the new page so you can identify it is the correct updated one because this doesn't ring true. IF you type in the incorrect user/pass on the index.php page it should take you to the failed_login.php page. If its the correct user/pass it should take you to the insert_donations.php page

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2013 8:11 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Thats what i thought but it seems there is no restriction at all. I did notice that there are no recordset's present in the server behavior panel, only 'login user'. Could that be the problem or is a recordset not needed if 'login user' is applied? I tried doing the above but its not that.

     

    No you don't need to create a recordset on the index page.

     

    The page code I posted is working for me. I get taken to the failed_login.php page if the user/pass is not correct or get whisked to the insert_donations.php page if they are.

     

    Let's  see the user table in your database. Don't worry about revealing the pasword/user details you can change those for something else later.

     

    I'll take a look a bit later to see if I can identify anything else which may be causing the issue, at the moment I can't think of anything because its all working as it should do this end.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2013 10:44 AM   in reply to Ness_quick

    Ness_quick wrote:

     

    Found the problem, there where two lots of pass/user inserted for some reason. Works perfectly now. Thank you so much for all your hard work and effort! Ive learnt so much. Theres no way i could have done it without your help. THANK YOU!

     

    Great news, you're welcome.

    Case closed

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points