Page 1 of 1

Fatal error: Call to undefined function virtual() in c:\ ...

Posted: Wed Apr 05, 2006 7:41 pm
by jimmytheshoes
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hey,

First of all i'm a noob so please bear with me. 

I'm using PHP 5, MySQL 5  and IIS and coding with Dreamweaver 8.

I've been following along with a training cd and one of the first things i've done in PHP is attempt to create a login page using dreamweaver. 
As a noob it was suggested that instead of typing the code i use the built in Dreamweaver server behavior -> User Authentication -> Log In User.

I followed along exactly and when it came to testing the page i get this error.


[color=red][b]Fatal error: Call to undefined function virtual() in c:\Inetpub\wwwroot\Surgery\admin\login.php on line 1[/b][/color]

I understand that the function is undefined, but have no idea why this has happened or how to correct it. 
Like i mentioned it is a built in Dreamweaver behaviour.

Here is the page code:

Code: Select all

<?php virtual('/Connections/wtsurgery.php'); ?>
<?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['email'])) {
  $loginUsername=$_POST['email'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "UserTypeID";
  $MM_redirectLoginSuccess = "/admin/index.php";
  $MM_redirectLoginFailed = "/admin/loginFailed.php";
  $MM_redirecttoReferrer = true;
  mysql_select_db($database_wtsurgery, $wtsurgery);
  	
  $LoginRS__query=sprintf("SELECT EmailAddress, Password, UserTypeID FROM users WHERE EmailAddress='%s' AND Password='%s'",
  get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); 
   
  $LoginRS = mysql_query($LoginRS__query, $wtsurgery) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'UserTypeID');
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && true) {
      $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">
<!-- InstanceBegin template="/Templates/AdminTemp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>West Town Surgery</title>
<!-- InstanceEndEditable -->
<link href="../styles/surgerymain.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

//Specify affected tags. Add or remove from list:
var tgs = new Array('body');

//Specify spectrum of different font sizes:
var szs = new Array('small','medium','large','x-large');
var startSz = 1;

function textsize( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 3 ) sz = 3;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
</script>
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body>
<div id="Container">
  <div id="sizer">Accessibility Options: <a href="../text_only/index.php" title="Text Only Version of this page" accesskey="t">TEXT ONLY VERSION<br />
    </a> Text Size: <a href="javascript:textsize('Container',1)" title="Larger Text Size">LARGER</a> | <a
href="javascript:textsize('Container',-1)" title="Smaller Text Size">SMALLER</a></div>
  <div id="header"> </div>
  <div id="blueSpacer"><!-- InstanceBeginEditable name="AdminSection" --><img src="../Images/PageHeaders/AdminLogin.gif" alt="Administrator Login" width="363" height="40" /><!-- InstanceEndEditable --></div>
  <div id="nav">
    <ul id="ulNav">
      <li><a href="../index.php" title="Home" accesskey="h"><span class="underline">H</span>ome</a></li>
      <li><a href="../openinghours.php" title="Opening Hours" accesskey="o"> <span class="underline">O</span>pening Hours</a></li>
      <li><a href="../appointments.php" title="Appointments" accesskey="a"> <span class="underline">A</span>ppointments</a></li>
      <li><a href="../patientinfo.php" title="Patient Information" accesskey="i">Patient <span class="underline">I</span>nformation </a></li>
      <li><a href="../register.php" title="Registering With Us" accesskey="r"> <span class="underline">R</span>egistering With Us </a></li>
      <li><a href="../prescriptions.php" title="Prescriptions" accesskey="p"> <span class="underline">P</span>rescriptions</a></li>
      <li><a href="../clinics.php" title="Clinics" accesskey="c"> <span class="underline">C</span>linics </a></li>
      <li><a href="../practicestaff.php" title="Practice Staff" accesskey="s">Practice <span class="underline">S</span>taff </a></li>
      <li><a href="../contact.php" title="Contact Us" accesskey="u">Contact <span class="underline">U</span>s</a></li>
    </ul>
  </div>
  <div id="right">
    <h2 id="h2Top">ADMIN MENU </h2>
    <ul id="ulAdminNav">
      <li><a href="#">Repeat Prescriptions</a></li>
      <li><a href="#">Notices</a></li>
      <li><a href="#">Users</a></li>
      <li><a href="#">LOG OUT </a></li>
    </ul>
  </div>
  <div id="divCenter">
    <h2 id="h2Top">Welcome <!-- InstanceBeginEditable name="Name" --><!-- InstanceEndEditable --></h2>
    <!-- InstanceBeginEditable name="BodyContent" -->
    <p>Fill in the form to log in to the Administration Area.</p>
    <form ACTION="<?php echo $loginFormAction; ?>" id="LogInUser" name="LogInUser" method="POST">
      <table>
        <tr>
          <td><label for="label">Email:</label></td>
          <td><label for="email"></label>
            <input type="text" name="email" id="email" /></td>
        </tr>
        <tr>
          <td><label for="label">Password:</label></td>
          <td><input type="text" name="password" id="password" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="Log In" /></td>
        </tr>
      </table>
    </form>
    <p>&nbsp; </p>
    <!-- InstanceEndEditable --></div>
  <div id="clearer"></div>
  <div id="footer">West Town Surgery<span class="blackEmphasis"> | </span>80 High Street <span class="blackEmphasis">| </span>Barton upon Humber <span class="blackEmphasis">|</span> DN18 5PU<span class="blackEmphasis"> |</span> tel: 01652 660041 <span class="blackEmphasis">|</span> fax: 01652 636005 </div>
</div>
</body>
<!-- InstanceEnd -->
</html>
Any help would mean that i would love you forever...

Thanks
Jimmytheshoes


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Apr 05, 2006 7:53 pm
by ambivalent