Jump to content

adavison2

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

adavison2's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. done it with if ($_SESSION['SESS_ADMIN'] == "admin") { $loc= "../admin/admin.php"; } elseif($_SESSION['SESS_HEADTEACHER'] == "head") { $loc = "../head/head.php"; }
  2. below is full code the session is set when a administrator logs on or headteacher logs on what i want it to do is if they are a administrator and click main menu they get sent to admin main menu if they are a hearteacher they get sent to the head teacher main menu it all worksup to the if(isset($_SESSION['SESS_ADMIN'])) it causes a error <?php ob_start(); if(!isset($_SESSION)) { session_start(); } require_once('../auth.php'); ?> <Head> <link href="../loginmodule.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style1 { font-size: 18px; font-weight: bold; } .style3 {font-size: 36px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; } --> </style> </head> <body> <?php require_once('../config.php'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } ?> <HTML> <h1>Reporting Online</h1> <P>Signature Archive</P> <P> <?php $path = "."; $dir_handle = @opendir($path) or die('Unable to open $path'); while (false !== ($file = readdir($dir_handle))) { // Prevent this file itself being shown if($file == "signfile.php") continue; // Prevent this file itself being shown if($file == "uploader.php") continue; // Prevent this file itself being shown if($file == "delete.php") continue; if($file == "makeactive.php") continue; if($file == "activate.php") continue; // Prevent this file itself being shown if($file == ".") continue; // Prevent this file itself being shown if($file == "..") continue; echo "<a href=$file>$file</a>"; ?> <?php echo "<BR>"; } ?> <FORM METHOD="LINK" ACTION="activate.php"> <INPUT TYPE="submit" VALUE="Activate a Signature"> </FORM> <h1></h1> <form enctype="multipart/form-data" action="uploader.php" method="POST"> Choose a file to upload to the signature archive: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <h1></h1> </P> Delete a file from the signature archive<BR> <?php // open the current directory $dhandle = opendir('.'); // define an array to hold the files $files = array(); if ($dhandle) { // loop through all of the files while (false !== ($fname = readdir($dhandle))) { // if the file is not this file, and does not start with a '.' or '..', // then store it for later display if (($fname != '.') && ($fname != '..') && ($fname != basename($_SERVER['PHP_SELF']))) { // store the filename $files[] = (is_dir( "./$fname" )) ? "(Dir) {$fname}" : $fname; } } // close the directory closedir($dhandle); } ?> <form enctype="multipart/form-data" action="delete.php" method="POST"> <input type="hidden" /> <select name= "deletefile"> <?php // Now loop through the files, echoing out a new select option for each one foreach( $files as $fname ) { // Prevent this file itself being shown if($fname == "signfile.php") continue; // Prevent this file itself being shown if($fname == "uploader.php") continue; // Prevent this file itself being shown if($fname == "delete.php") continue; if($fname == "activate.php") continue; if($fname == "makeactive.php") continue; // Prevent this file itself being shown if($fname == ".") continue; echo "<option> $fname </option>"; } echo "</select>"; ?> <input type="submit" value="Delete" /> </select> </form> <h1></h1> <?php if(isset($_SESSION['SESS_ADMIN'])) $loc = ../admin/admin.php; else $loc= ../head/head.php"; //$loc = "../admin/admin.php"; ?> <form><INPUT TYPE="button" value="Main Menu" onClick="parent.location='<?php echo $loc; ?>'"></form> </body> </HTML> MOD Edit: code tags added.
  3. why dose this not work <?php if(isset($_SESSION['SESS_ADMIN'])) $loc = ../admin/admin.php; else $loc= ../head/head.php"; ?> <form><INPUT TYPE="button" value="Main Menu" onClick="parent.location='<?php echo $loc; ?>'"></form> </body> </HTML>
  4. This is te query im useing at the moment $query = "INSERT INTO report (name,class,Sex,Reading_Effort,Reading_Progress,Reading_Target, Writing_Effort,Writing_Progress,Writing_Target,Maths_Effort,Maths_Progress,Maths_Target,Science,Topic,UPN) VALUES ('$name2','$class','$sex','$readingeffort','$readingprogress','$readingtarget', '$writingeffort','$writingprogress','$writingtarget','$mathseffort','$mathsprogress','$mathstarget','$science','$topic','$UPN')"; I can get the change by textarea onchange function to change a VAR to 1 what i need to figure out i if this VAR is 1 then INSERT INTO report what ever has been set to 1 Thank
  5. Hi in new to php with a work colleague we have been designing a php/mysql reporting system for the school i work at but need a help with a bug teachers can update reports when they do the code pouplates the textareas with what is in the DB they can then make changes no problem but if two do it at the same time or one opens a reports goes makes a tea another opens the same report makes a changes updates report lets say Science then and then the other teacher comes bak makes a change to Maths it rewights the old science over the top of the new one the othe teacher did a little while ago In short can you make a php statment that onchange of textarea then include into the mysql update query if no change the dont include that in the mysql update query
×
×
  • 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.