PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Donovan
Client


Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Mon Sep 22, 2008 12:29 pm Reply with quote Back to top

I have been round and round on this and cannot find my error. I think it has to do with my authentication. Let me explain.

I have a Peer Evaluation page for 1st and 2nd year medical students. First they authenticate with LDAP.

Code:
function AuthStudent() {

etc
etc
if  ($db->sql_numrows($sql) == 1) {
           // if a row was returned
              // authentication was successful
           // set session variable         
         $_SESSION['authuser'] = $authuser;
header("Location: modules.php?name=$module_name&op=nav");   
}
}


nav is a function like so.

Code:
function nav() {
 global $prefix, $module_name, $db;
 include("header.php");       
    echo "<table border=\"1\" width=\"100%\" align=\"center\"><tr><td width=\"10%\">";       
    echo "<font class=\"content\">"
   ."<center><a href=\"modules.php?name=$module_name&amp;op=TLM1StudentGrades\"><img src='modules/$module_name/images/M1icon.gif'\" border=\"0\" alt=\"Current Team Learning Grades\" title=\"First Year Courses\"></a><br>"
   ."<a href=\"modules.php?name=$module_name&amp;op=TLM1StudentGrades\">First Year Courses</a>"
   ."</center></font></td>";
   
   
    echo "<td width=\"10%\"><font class=\"content\">"
   ."<center><a href=\"modules.php?name=$module_name&amp;op=TLM2StudentGrades\"><img src='modules/$module_name/images/courses.jpg'\" border=\"0\" alt=\"Peer Evaluations\" title=\"Second Year Courses\"></a><br>"
   ."<a href=\"modules.php?name=$module_name&amp;op=TLM2StudentGrades\">Second Year Courses</a>"
   ."</center></font></td>";     
 
   
   echo "<td width=\"10%\"><font class=\"content\">"
       ."<center><a href=\"modules.php?name=$module_name&amp;op=PeerEval\"><img src='modules/$module_name/images/test-icon.jpg'\" border=\"0\" alt=\"Submit Peer Evaluations\" title=\"Submit Peer Evaluations\"></a><br>"
       ."<a href=\"modules.php?name=$module_name&amp;op=PeerEval\">Submit Peer Evaluations</a>"
       ."</center></font></td>";
   
    echo "</tr></table>";
}


They can view scores from first or second year courses. They also click on "Submit Peer Evaluations" and it sends them to the proper page depending on which Class_Year they are in.

First year students complete peer eval after each course, while second year med students complete evals after each term.

Here is the Peer Eval function

Code:
function PeerEval() {
global $module_name, $prefix, $db, $authuser;
   if (!$authuser) {
      header("Location: modules.php?name=$module_name&op=DisplayLogin");
      exit;
   }
   nav();
      //What class year does the student belong?
   $getYear = $db->sql_query("SELECT * FROM ".$prefix."_tl_students WHERE LDAP_USER = '$authuser'");
   if (!$getYear) {
      echo("<p>Error performing query: " . mysql_error() . "</p>");
      exit();
   }
   $row = $db->sql_fetchrow($getYear);   
   $LDAP_USER = $row['LDAP_USER'];
   $Class_Year = $row['Class_Year'];

   if ($Class_Year == 1) {   
//Class year found now get Course Number.   
$getCourse = $db->sql_fetchrow($db->sql_query("SELECT Course_Number, PE_Enabled FROM ".$prefix."_tl_courses
WHERE ((Peer_Eval = 'Yes') && (PE_Enabled = 'Yes'))"));   
$Course_Number = $getCourse['Course_Number'];
$PE_Enabled = $getCourse['PE_Enabled'];
//Find the start and stop time for Peer Evaluations      
$coursedata = TLCourse_info($Course_Number);
$today = time();
$start = strtotime($coursedata['PE_start_time']);
$stop = strtotime($coursedata['PE_stop_time']);

if (($PE_Enabled == 'Yes') && ($today >= $start) && ($today <= $stop)){
TLAddM1PeerEvals($Course_Number);
 }else{
 OpenTable();
   echo "<br>\n"
      ."<form action='modules.php?name=$module_name' method='post'>"
      ."<table border=\"0\">"
          ."<tr><td>Team learning peer evaluations are not enabled or the time to complete an evaluation has expired.</td></tr>"
      ."<tr><td>If you are a first year medical student please email xxx at
Only registered users can see links on this board!
Get registered or login to the forums!
, or call her at xxx -xxxx.</td></tr>"
      ."<tr><td>If you are a second year medical student please email xxxxx  at
Only registered users can see links on this board!
Get registered or login to the forums!
, or call her at xxx-xxxx.</td></tr>"      
      ."<tr><td><input type=\"hidden\" name=\"op\" value=\"nav\">\n"
      ."<input type=\"submit\" value=\"Continue\"></form></td></tr></table><br>\n\n";
CloseTable();
   exit();   
}
}

if ($Class_Year == 2) {   
//Get Term      
$getTerm = $db->sql_fetchrow($db->sql_query("SELECT term, enabled, PE_start_time, PE_stop_time FROM ".$prefix."_tl_M2settings"));
$Term = $getTerm['term'];
$Term_Enabled = $getTerm['enabled'];
$start_time = $getTerm['PE_start_time'];
$stop_time = $getTerm['PE_stop_time'];
}
$today = time();
$start = strtotime($start_time);
$stop = strtotime($stop_time);
if (($Term_Enabled == '1') && ($today >= $start) && ($today <= $stop)){
TLM2PeerEvals($Term);
 }else{
 OpenTable();
   echo "<br>\n"
      ."<form action='modules.php?name=$module_name' method='post'>"
      ."<table border=\"0\">"
          ."<tr><td>Team learning peer evaluations are not enabled or the time to complete an evaluation has expired.</td></tr>"
         ."<tr><td>Please email xxxx  at
Only registered users can see links on this board!
Get registered or login to the forums!
, or call her at xxx-xxxx.</td></tr>"      
      ."<tr><td><input type=\"hidden\" name=\"op\" value=\"nav\">\n"
      ."<input type=\"submit\" value=\"Continue\"></form></td></tr></table><br>\n\n";
CloseTable();
   exit();
   }
   
   }


If it is a first year student I pass the $Course_Number and send them to TLAddM1PeerEvals.

If it is a second year student I pass $Term and send them to TLM2PeerEvals.

My case statement has this.

Code:
switch($op) {

case "AuthStudent":
   AuthStudent();
   break;

case "PeerEval":
   PeerEval($authuser);
   break;

case "TLAddM1PeerEvals":
   TLAddM1PeerEvals($Course_Number);
   break;

case "TLM2PeerEvals":
   TLM2PeerEvals($Term);
   break;

case "DisplayLogin":
   DisplayLogin();
   break;
   
case "nav":
   nav();
   break;
   
case "Logout":
   Logout();
   break;
   
}


My page starts with this.

Code:

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

##################################################
# Start the session                              #
##################################################
session_start();
if (isset($_SESSION['authuser'])) {
   $authuser = $_SESSION['authuser'];
} else {
   $authuser = '';
}


Each time I try to enter Peer Eval as either a first or second year student I get the following:

Quote:

Fatal error: Cannot redeclare head() (previously declared in /Library/WebServer/Documents/atlas/header.php:2Cool in /Library/WebServer/Documents/atlas/header.php on line 47


I cannot find where I am including the header twice.

I think my authuser variable is getting stepped on and this is causing the Fatal error:.

Code:
if (!$authuser) {
   header("Location: modules.php?name=$module_name&op=DisplayLogin");
      exit;
   }   
View user's profile Send private message Visit poster's website ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Mon Sep 22, 2008 11:01 pm Reply with quote Back to top

Move session_start(); to the start of your script.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum