Beispiel #1
0
      alert("Les mots de passe rentrés ne sont pas identiques.");
      location.href = "index.php";
      </script>';
        }
    } else {
        $editName = $bdd->prepare("UPDATE users SET login = '******'login'] . "', prenom = '" . $_POST['prenom'] . "', nom = '" . $_POST['nom'] . "', email = '" . $_POST['email'] . "', admin = '" . $_POST['admin'] . "' WHERE id= " . $idUser . "");
    }
    $editName->execute();
    if ($_SESSION['admin'] == 1) {
        header('Location: gestinsc.php');
    } else {
        header('Location: index.php');
    }
}
if (isset($_POST['send'])) {
    editForm();
}
if ($_SESSION['id'] == $idUser || $_SESSION['admin'] == 1) {
    ?>
  <html>
  <head>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    <link type="text/css" rel="stylesheet" href="css/materialize.css"  media="screen,projection"/>
    <link type="text/css" rel="stylesheet" href="css/style.css">

    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta charset="utf-8"/>
  </head>

  <body>
Beispiel #2
0
     getEmployee($db);
 } else {
     if (isset($_GET['e']) && !empty($_GET['e'])) {
         getEmployeeStatus($db);
     } else {
         if (isset($_GET['ename']) && !empty($_GET['ename'])) {
             getEId($db);
         } else {
             if (isset($_GET['commentSubmit']) && !empty($_GET['commentSubmit'])) {
                 insertComment($db);
             } else {
                 if (isset($_GET['getform']) && !empty($_GET['getform'])) {
                     getForm($db);
                 } else {
                     if (isset($_GET['editform']) && !empty($_GET['editform'])) {
                         editForm($db);
                     } else {
                         if (isset($_GET['eid']) && !empty($_GET['eid'])) {
                             getRequirements($db);
                         } else {
                             if (isset($_GET['deleteform']) && !empty($_GET['deleteform'])) {
                                 deleteForm($db);
                             } else {
                                 if (isset($_GET['deletefield']) && !empty($_GET['deletefield'])) {
                                     deleteField($db);
                                 } else {
                                     if (isset($_GET['empid']) && !empty($_GET['empid'])) {
                                         pullVals($db);
                                     } else {
                                         if (isset($_POST['addField']) && !empty($_POST['addField'])) {
                                             updateForm($db);
Beispiel #3
0
 if ($thread['thread_closed'] == 1 && !P_EDITCLOSED) {
     message('Du bist nicht berechtigt in geschlossenen Threads zu editieren.', 'Rechte', 0);
 }
 if ($own_post == 1 && P_EDIT || $own_post == 0 && P_OEDIT) {
     if (!isset($send)) {
         if (!isset($back)) {
             $new['thread_topic'] = $thread['thread_topic'];
             $new['page'] = $page;
             $new['user_id'] = $post['user_id'];
             $new['guest_name'] = $post['guest_name'];
             $new['text'] = $post['post_text'];
             $new['topic'] = $thread['thread_topic'];
             $data['boardtable'] = editForm($new, $boardid, $threadid, $postid, $config['mail_func'], $config['smilies'], 1);
         } else {
             $new['user_id'] = $post['user_id'];
             $data['boardtable'] = editForm($new, $boardid, $threadid, $postid, $config['mail_func'], $config['smilies'], $new['code']);
         }
     } else {
         // check entrys -----------------------
         $err_mess = '';
         if ($post['user_id'] == 0) {
             $err_mess = check_string($new['autor'], 0);
         }
         $err_mess = check_string($new['topic'], 1);
         if (strlen($text) < $config['min_post_len']) {
             $err_mess .= ($err_mess == '' ? '' : '<br />') . 'Der Text ist zu kurz.';
         }
         if (strlen($text) > $config['max_post_len']) {
             $err_mess .= ($err_mess == '' ? '' : '<br />') . 'Der Text ist zu lang.';
         }
         if ($err_mess != '') {
Beispiel #4
0
function showedit()
{
    if (isset($_GET[action]) and $_GET[action] == 'edit') {
        editForm();
    }
}
function getStudents()
{
	$fp = fopen("users.txt","r"); 
	rewind($fp);

	$searched = $_POST['searched'];
	$edit = $_POST['edit'];
	$submit = $_POST['submit'];

	if(isset($submit))
	{
		$isMatch = false;
		$cfp = fopen("usercopy.txt","w"); 
	
		while(!feof($fp))
		{
			$line = fgets($fp);
			$element = split("\|", $line);

			if(strcasecmp(($element[2] . " " . $element[3]), $_SESSION['search_student']) == 0)
			{
				$isMatch = true;
				
				//Assign variables to capture (trimmed) input from the form.
				$uname = str_replace(" ","",$_POST['uname']);
				$pword = str_replace(" ","",$_POST['pword']);	
				$fname = str_replace(" ","",$_POST['fname']);
				$lname = str_replace(" ","",$_POST['lname']);
				$snumber = str_replace(" ","",$_POST['snumber']);
				$email = str_replace(" ","",$_POST['email']);
				$program = str_replace(" ","",$_POST['program']);
				$program_end = str_replace(" ","",$_POST['program_end']);
				$birth = str_replace(" ","",$_POST['birth']);
				$telephone = str_replace(" ","",$_POST['telephone']);
				$address = str_replace(" ","",$_POST['address']);
				$suburb = str_replace(" ","",$_POST['suburb']);
				$state = str_replace(" ","",$_POST['state']);
				$pcode = str_replace(" ","",$_POST['pcode']);
				$status = str_replace(" ","",$_POST['status']);
	
				$write_values = array("$uname","$pword","$fname","$lname","$snumber","$email","$program",
									"$program_end","$birth","$telephone","$address","$suburb","$state","$pcode","Student","$status");
				echoLine($write_values);
				echo "<tr><td></td><td><p>Back to <a href='students.php'>Student Management</a>.</p></td>";
				
				$write_values = implode("|",$write_values);
				fwrite($cfp, $write_values);
				fwrite($cfp,"\n");
			}
			else
			{
				$isMatch = false;
				fwrite($cfp,$line);
			}
		}
		fclose($fp);
		fclose($cfp);

		$userFile = "users.txt";
		$copyFile = "usercopy.txt";
		$fp = fopen($userFile, "w+");		
		$cfp = fopen($copyFile, "r");		
		$file_contents = fread($cfp, filesize($copyFile));
		fwrite($fp, $file_contents);
		fclose($cfp);
		
		rewind($fp);
		fclose($fp);
	}
	else if(isset($edit))
	{
		$isMatch = false;
	
		while(!feof($fp) and $isMatch == false)
		{
			$line = fgets($fp);
			$element = split("\|", $line);
			
			//This compares the first and second name of a student with the search field.
			if(strcasecmp(($element[2] . " " . $element[3]), $_SESSION['search_student']) == 0)
			{
				$isMatch = true;
				editForm($element);
			}
			else
			{
				$isMatch = false;
			}
		}
	}
	else if(isset($searched))
	{
		$_SESSION['search_student'] = $_POST['search_student'];
		$isMatch = false;
		
		while(!feof($fp) and $isMatch == false)
		{
			$line = fgets($fp);
			$element = split("\|", $line);
		
			if(strcasecmp(($element[2] . " " . $element[3]), $_SESSION['search_student']) == 0)
			{
				$isMatch = true;
				echoLine($element);
				edit_button();
			}
			else
			{
				$isMatch = false;
			}
		}
	}
	else
	{
		while (!feof($fp))
		{			
			$line = fgets($fp);
			$element = split("\|", $line);
				
			if(strcmp(trim($element[14]), "Student") == 0)
			{
				echoLine($element);
			}
		}
	}
}
Beispiel #6
0
function getBooks()
{
	$fp = fopen("books.txt","r"); 
	rewind($fp);

	$searched = $_POST['searched'];
	$edit = $_POST['edit'];
	$submit = $_POST['submit'];
	$add = $_POST['add'];
	$addbook = $_POST['addbook'];
	$delete = $_POST['delete'];

	if(isset($delete))
	{
		$cfp = fopen("bookcopy.txt","w"); 
	
		while(!feof($fp))
		{
			$line = fgets($fp);
			$element = split("\|", $line);

			if(strcasecmp($element[0], $_SESSION['search_book']) != 0)
			{
				fwrite($cfp,$line);
			}
		}
		fclose($fp);
		fclose($cfp);

		$bookFile = "books.txt";
		$copyFile = "bookcopy.txt";
		$fp = fopen($bookFile, "w+");		
		$cfp = fopen($copyFile, "r");		
		$file_contents = fread($cfp, filesize($copyFile));
		fwrite($fp, $file_contents);
		rewind($fp);
		
		showBooks($fp);
		add_button();
		
		fclose($fp);
		fclose($cfp);		
	}
	else if(isset($add))
	{
		addForm();
	}
	else if(isset($addbook))
	{
		$isMatch = false;
		$fp = fopen("books.txt","a"); 
		fwrite($fp,"\n");
									
		$title = trim($_POST['title']);
		$author = trim($_POST['author']);	
		$category = trim($_POST['category']);
		$year = trim($_POST['year']);
		$pages = trim($_POST['pages']);
		$notes = trim($_POST['notes']);
		$cnumber = trim($_POST['cnumber']);
		$status = trim($_POST['status']);
		$keywords = trim($_POST['keywords']);
		$borrower = "|";
		$due = "|";
		
		$write_values = array("$title","$author","$category","$year","$pages","$notes","$cnumber","$status","$keywords", "$borrower","$due"); 
		
		echoLine($write_values); //Need to echo this to so I can use the echoLine function before imploding.
		add_button();
		echo "<tr><td></td><td><p>Display all books on <a href='books.php'>Item Management</a> page.</p></td>";
				
		$write_values = implode("|",$write_values);
		fwrite($fp, $write_values);
		
		rewind($fp);
		fclose($fp);
	}
	else if(isset($submit))
	{
		$cfp = fopen("bookcopy.txt","w"); 
	
		while(!feof($fp))
		{
			$line = fgets($fp);
			$element = split("\|", $line);

			if(strcasecmp($element[0], $_SESSION['search_book']) == 0)
			{				
				$title = trim($_POST['title']);
				$author = trim($_POST['author']);	
				$category = trim($_POST['category']);
				$year = trim($_POST['year']);
				$pages = trim($_POST['pages']);
				$notes = trim($_POST['notes']);
				$cnumber = trim($_POST['cnumber']);
				$status = trim($_POST['status']);
				$keywords = trim($_POST['keywords']);
				$borrower = trim($_POST['borrower']);
				$due = trim($_POST['due']) . " |";
	
				$write_values = array("$title","$author","$category","$year","$pages","$notes","$cnumber","$status","$keywords","$borrower","$due"); 
				
				echoLine($write_values); 
				echo "<tr><td></td><td><p>Display all books on <a href='books.php'>Item Management</a> page.</p></td>";
				
				$write_values = implode("|",$write_values);
				fwrite($cfp, $write_values);
				fwrite($cfp,"\n");
			}
			else
			{
				fwrite($cfp,$line);
			}
		}
		fclose($fp);
		fclose($cfp);

		$bookFile = "books.txt";
		$copyFile = "bookcopy.txt";
		$fp = fopen($bookFile, "w+");		
		$cfp = fopen($copyFile, "r");		
		$file_contents = fread($cfp, filesize($copyFile));
		fwrite($fp, $file_contents);
		rewind($fp);
		fclose($fp);
		fclose($cfp);
	}
	else if(isset($edit))
	{
		$isMatch = false;
	
		while(!feof($fp) and $isMatch == false)
		{
			$line = fgets($fp);
			$element = split("\|", $line);
			
			if(strcasecmp(trim($element[0]), $_SESSION['search_book']) == 0)
			{
				$isMatch = true;
				editForm($element);
			}
			else
			{
				$isMatch = false;
			}
		}
	}
	else if(isset($searched))
	{
		$_SESSION['search_book'] = $_POST['search_book'];
		$isMatch = false;
		
		while(!feof($fp) and $isMatch == false)
		{
			$line = fgets($fp);
			$element = split("\|", $line);
		
			if(strcasecmp($element[0], $_SESSION['search_book']) == 0)
			{
				$isMatch = true;
				echoLine($element);
				delEditButtons();
			}
			else
			{
				$isMatch = false;
			}
		}
	}
	else
	{
		showBooks($fp);
		add_button();
	}
}