Skip to main content
Inspiring
November 17, 2012
Question

Hiding Browser URL

  • November 17, 2012
  • 1 reply
  • 1976 views

Hi

Summary: I have a working input form. User information is captured. This form is posted around. I do not wish for the url of this page to be known.

Question:

How will I achieve this and What should I code? Where should I code it?

Source code:

<?php require_once('Connections/dbAttendance.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;

}

}

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {

  $insertSQL = sprintf("INSERT INTO attendlist (Windowsid, title, firstname, surname, extension, mobile, jobrole, course, cpg, mgrname, room) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

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

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

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

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

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

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

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

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

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

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

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

  mysql_select_db($database_dbAttendance, $dbAttendance);

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

  $insertGoTo = "Thankyou.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

mysql_select_db($database_dbAttendance, $dbAttendance);

$query_rsAttendance = "SELECT * FROM attendlist";

$rsAttendance = mysql_query($query_rsAttendance, $dbAttendance) or die(mysql_error());

$row_rsAttendance = mysql_fetch_assoc($rsAttendance);

$totalRows_rsAttendance = mysql_num_rows($rsAttendance);

?>

<!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>Delegate Register</title>

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

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

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

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

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

</head>

<?php

$date = date(“format”, $timestamp);

?>

<body>

<div class="container">

  <div class="header"><img src="Cerner At Imperial2.jpg" width="960" height="150" alt="" /><!-- end .header --></div>

  <div class="content">

    <h3>Register: <?php echo "Date  - ".date("d/m/Y - H:ia")?></h3>

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

      <table width="780" border="0">

        <tr>

          <td><div align="right">User ID *</div></td>

          <td><span id="sprytextfield1">

            <input name="textfield" type="text" id="textfield" tabindex="1" size="18" maxlength="10" />

          <span class="textfieldRequiredMsg">A value is required.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Title *</div></td>

          <td><span id="spryselect1">

            <select name="select" id="select" tabindex="2">

              <option value="0">Select</option>

              <option value="1">Ms</option>

              <option value="2">Mrs</option>

              <option value="3">Mdm</option>

              <option value="4">Dr</option>

              <option value="5">Mr</option>

              <option value="6">Prof</option>

            </select>

          <span class="selectRequiredMsg">Please select an item.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">First name*</div></td>

          <td><span id="sprytextfield2">

            <input name="textfield2" type="text" id="textfield2" tabindex="3" size="30" maxlength="30" />

          <span class="textfieldRequiredMsg">A value is required.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Surname *</div></td>

          <td><span id="sprytextfield3">

            <input name="textfield3" type="text" id="textfield3" tabindex="4" size="30" maxlength="30" />

          <span class="textfieldRequiredMsg">A value is required.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Contact / Bleep *</div></td>

          <td><span id="sprytextfield4">

            <input name="textfield4" type="text" id="textfield4" tabindex="5" size="30" maxlength="30" />

          <span class="textfieldRequiredMsg">A value is required.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Mobile no: (optional)</div></td>

          <td><input name="textfield5" type="text" id="textfield5" tabindex="6" size="20" maxlength="20" /></td>

          <td> </td>

        </tr>

        <tr>

          <td> </td>

          <td> </td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Job Role *</div></td>

          <td><span id="spryselect5">

            <select name="select5" id="select5" tabindex="7">

              <option value="0">Select </option>

              <option value="1">Doctor</option>

              <option value="2">Nurse IP</option>

              <option value="3">Nurse OP</option>

              <option value="4">Midwife</option>

              <option value="5">Booking Clerk</option>

              <option value="6">Medical Secretary</option>

              <option value="7">OP Receptionist</option>

              <option value="9">CNS/NP</option>

              <option value="10">Tester</option>

            </select>

          <span class="selectRequiredMsg">Please select an item.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Manager's Name *</div></td>

          <td><span id="sprytextfield5">

            <input name="textfield7" type="text" id="textfield7" tabindex="8" size="30" maxlength="30" />

          <span class="textfieldRequiredMsg">A value is required.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td> </td>

          <td> </td>

          <td> </td>

        </tr>

        <tr>

          <td> </td>

          <td> </td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Course *</div></td>

          <td><span id="spryselect2">

            <select name="select2" id="select2" tabindex="9">

              <option value="0">Select</option>

              <option value="1">Demo</option>

              <option value="2">Doctors</option>

              <option value="9">CNS/NP</option>

              <option value="3">Nurse IP</option>

              <option value="4">Nurse OP</option>

              <option value="5">Midwife</option>

              <option value="6">Booking Clerk</option>

              <option value="7">Medical Secretary</option>

              <option value="8">OP Receptionist</option>

            </select>

          <span class="selectRequiredMsg">Please select an item.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">Location *</div></td>

          <td><span id="spryselect3">

            <select name="select3" id="select3" tabindex="10">

              <option value="0">Select </option>

              <option value="1">CHX 12 Floor Rm 1</option>

              <option value="2">CHX 12 Floor Rm 2</option>

              <option value="3">CHX 10 West </option>

              <option value="4">HH N207 </option>

              <option value="5">HH W12 Conference</option>

              <option value="6">SMH Rm a</option>

              <option value="7">SMH Rm b</option>

              <option value="8">SMH Ming Wing Rm 5</option>

              <option value="9">SMH Ming Wing Rm 3</option>

            </select>

          <span class="selectRequiredMsg">Please select an item.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="right">CPG *</div></td>

          <td><span id="spryselect4">

            <select name="select4" id="select4" tabindex="11">

              <option value="0">Select </option>

              <option value="1">CPG 1 - Medicine</option>

              <option value="2">CPG 2 - Surgery and Cancer</option>

              <option value="3">CPG 3 - Specialist Services </option>

              <option value="4">CPG 4 - Circulatory Services and Renal Medicine</option>

              <option value="5">CPG 5 - Womens and Children</option>

              <option value="6">CPG 6 - Clinical and Investigative Sciences</option>

              <option value="7">CPG 7 - Private Patients</option>

              <option value="8">Others</option>

            </select>

          <span class="selectRequiredMsg">Please select an item.</span></span></td>

          <td> </td>

        </tr>

        <tr>

          <td> </td>

          <td><input name="button" type="submit" id="button" value="Submit" /></td>

          <td> </td>

        </tr>

        <tr>

          <td><div align="center">*Mandatory fields </div></td>

          <td> </td>

          <td> </td>

        </tr>

      </table>

      <input type="hidden" name="MM_insert" value="form" />

    </form>

<!-- end .content --></div>

  <div class="footer">

<p align="center">

    <a href="http://validator.w3.org/check?uri=referer"><img

      src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>

      <p align="center"> Cerner@Imperial ICT Training Team </p>

</p>

 

  <!-- end .footer --></div>

  <!-- end .container --></div>

<script type="text/javascript">

var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur", "change"]});

var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["change", "blur"]});

var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {validateOn:["blur", "change"]});

var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur", "change"]});

var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none", {validateOn:["blur", "change"]});

var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {validateOn:["change", "blur"]});

var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {validateOn:["change", "blur"]});

var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {validateOn:["change", "blur"]});

var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur", "change"]});

var spryselect5 = new Spry.Widget.ValidationSelect("spryselect5", {validateOn:["blur", "change"]});

</script>

</body>

</html>

<?php

mysql_free_result($rsAttendance);

?>

This topic has been closed for replies.

1 reply

Mylenium
Legend
November 17, 2012

If you don't want the URL to be known, don't run a web page. You could load it inside an iFrame or dynamically inside a script, which you can disguise further using Base64 encoding or similar or you could generate abstract URLs using PHP, but ultimately, if somebody wnats, they can still find out. You'd do better working authentication procedures, so only people who have a valid key can fill out and send the form...

Mylenium

Inspiring
November 17, 2012

Hi

It is not helpful. I have an idea too. How about this idea of hiding the URL? But let's run with this and see what the technical solutions are for this then maybe the rest. I am not sure about the rest of your suggestions. I require only 1 solution, maybe walk and talk thru it. Dont be sarcastic about not running the page!

Inspiring
November 17, 2012

This is a server-side question. As advised to you earlier once, you should post this in the appropriate forum for better (quicker) responses. I'm moving it there this time as well.

First look - You are using server behaviors. Bad idea. How about writing custom-code - considering the work that you seem to be doing is quite comprehensive?

Custom-code - Have you heard about AJAX? Posting a form while 're-directing' the user the the submission page is your problem - you've mentioned in your original question.

If you use AJAX form validation/ submission, your user will not be taken to the submission page. They go to Page A, fill the form info, hit submit, AJAX validation happens and form is submitted in the backend. User is still in Page A - the only change happening on front-end being that the user sees a 'Message sent' or 'Form submitted' message.

Eureka?


HI Sudarshan,

Thanks for the reply. I did post over there. I think it is over there, not sure how it got to here. I have been waiting over 8 hrs still no reply to the rest of my post

I am trying to write custom code, what code to write and how to custom is on my mind. Glad you can see that I am putting together some comprehensive systems. So I will require mentoring (support and help).

I have heard of AJAX? Heard but not learned it yet. So there are no thoughts processes churning my coxes at the moment. If only it was a Eureka moment. I understand the user experiences you mentioned. I want to be able to code and make this happen. So how shall I do it? I have a fully functional form. I used server behaviours, maybe bad idea. If you only had that one idea, it worked so far, why not.

Questions

Can DW support this idea ? Is there more to using server behaviour to try and code up this type of behaviour required. Is this behaviour in DW server behaviour?

Is this where DW server behaviour ends?