[Gelöst] XML Directory

Darf den admin auf die Datenbank zugreifen? (einzustellen unter Benutzer - Datenbank in phpMyAdmin)
.

Dort steht bei Benutzer 'admin'@'%'

Datenbank Rechte GRANT Tabellenspezifische Rechte Aktion
xml_directory ALL PRIVILEGES Ja Nein Rechte ändern Rechte ändern Entfernen
 
Im Moment nutze ich root ohne PW.
Als ich den vorhin geändert habe, bin ich nicht mehr in phpMyAdmin reingekommen
 
Das passt, aus Sicherheitsgründen solltest Du den Zugriff anstatt für alle Clients (%) auf localhost bescchränken und dem Benutzer die Rechte für GRANT entziehen.

Also kannst Du gar nicht mehr auf die DBs zugreifen?
 
Im Moment kann ich auf alles zugreifen. Als ich vorhin testweise dem root das PW weggenommen habe, kam immer der Fehler

PHP:
#1045 - Access denied for user 'root'@'localhost' (using password: NO)

Dann musste ich das backup einspielen, damit ich wieder Zugriff habe.
 
Bei meiner PHPMyAdmin Version kann sich admin in PHPMyAdmin nur einloggen wenn nicht % sondern localhost gesetzt wurde.
...also guter Hinweis von andiling.

Das hat bestimmt mit dem "neuen Sicherheitskonzept" von XAMPP zu tun. ;)
 
Zuletzt bearbeitet:
In der Tat. Nun ist die undefined index Anzeige weg. Nun kann ich mich einloggen. Und sehe die Benutzeroberfläche.

Will schnell mal testen, ob ich auch Einträge vornehmen kann.
 
Machen sie es so...
Energie!!
:rolleyes:
 
Das klappt leider nicht.

Klicke ich auf "Eintrag hinzuf�gen sehe ich das hier

"Neue Eintrag.jpg

EDIT:

Bei klicken auf den letzten Eintrag heißt es:

Notice: Undefined index: action in C:\xampp\htdocs\directory\index.php on line 38

Dort steht in Zeile 37

PHP:
// verteile ja nach Aufruf in die entsprechenden Funktionen

und in 38

PHP:
switch ($_GET['action'])  {
 
Zuletzt bearbeitet:
Gut, ich mein, schlecht...

Poste mal bitte die komplette index.php in [ php ] Tags.
...ich vermute einen syntaktischen Fehler in der Gänsefüßchen/Hochkommata Setzung.

Nicht richtig maskiert worden, oder unwissentlich vermurkst.
 
index.php


PHP:
<?php

  // Initialize session data
  session_start();

  // IE 6 Fix
  header("Cache-control: private");

  // Lade die funktionen für den Zugriff auf die Datenbank
  require_once('baseFunction.inc.php');

  // Lade den oberen Teil der HTML Seite
  include('header.inc.php');

  // Bei einem Login prüfe Eingaben gegen die Datenbank wenn korrekt aktiviere die Session
  if ($_POST['action'] == "login")  {
    $login = check_login($_POST['username'], $_POST['password']);
    if ($login)  {
      $_SESSION['user_id'] = $login['user_id'];
      $_SESSION['username'] = $login['username'];
      $_SESSION['language'] = $login['language'];

      // Lade das Sprachenregister
      require ('lang/register.inc.php');
      require "lang/".$register['file'][$_SESSION['language']];
      $_SESSION['lang'] = $lang;
      $_GET['action'] = "show_directory_entries";
    }
  }

  // Prüfe ob die Session aktiv ist
  if (!empty($_SESSION['user_id']))  {

    // Lade die Navigationszeile
    include('navigation.inc.php');

    // verteile ja nach Aufruf in die entsprechenden Funktionen
    switch ($_GET['action'])  {

    // Dialog zur Eingabe neuer Nummern
    case "add_directory_entries":
      include('add_entry.inc.php');
    break;

    // neuen Eintrag in Datenbank schreiben oder vorhandenen aktualisieren
    case "insert_update_entry":
      insert_update_entry($_GET['entry_id'], $_POST['name'], $_POST['lastname']);
    break;

    // Eintrag aus Datenbank löschen
    case "del_directory_entries":
      del_directory_entries($_GET['entry_id']);
    break;

    // Dialog zum Ändern von Einträgen
    case "mod_directory_entries":
      mod_directory_entries($_GET['entry_id']);
    break;

    // zeige vorhanden Einträge
    case "show_directory_entries":
      show_directory_entries();
    break;
//******************************************************************************************************

    // Dialog zum Anzeigen der Rufnummern eines Eintrages
    case "show_directory_entry_numbers":
      show_directory_entry_numbers($_GET['entry_id']);
    break;

    // Dialog zum hinzufügen von Rufnummern
    case "del_directory_entry_number":
      del_directory_entry_number($_GET['number_id'], $_GET['entry_id']);
    break;

    // Dialog zum hinzufügen von Rufnummern
    case "mod_directory_entry_numbers":
      mod_directory_entry_numbers($_GET['number_id'], $_GET['entry_id']);
    break;

    // Dialog zum hinzufügen von Rufnummern
    case "add_directory_entry_numbers":
      add_directory_entry_numbers($_GET['entry_id']);
    break;

    // hinzufügen und ändern von rufnummern
    case "insert_update_entry_number":
      insert_update_entry_number($_GET['number_id'], $_POST['type_id'], $_POST['entry_id'], $_POST['number']);
    break;


    // zeige Telefone des Benutzers
    case "show_user_phones":
      show_user_phones();
    break;

    // Dialog zur Eingabe neuer Telefone
    case "add_user_phones":
      include('add_phone.inc.php');
    break;

    // neues Telefon in Datenbank speichern
    case "insert_user_phones":
      insert_user_phones($_POST['name']);
    break;

    // Lösche Telefon aus Datenbank
    case "del_user_phones":
      del_user_phones($_GET['phone_id']);
    break;

    // zeige dialog zum Ändern von Username/Password
    case "show_my_settings":
     mod_directory_user($_SESSION['user_id'], $_GET['action']);
    break;

    // geänderte Benutzerdaten in Datenbank speichern
    case "update_my_settings":
     insert_update_user($_SESSION['user_id'], $_POST['username'], $_POST['password'], $_POST['lang']);
    break;

    /* Zugriff nur für User mit ID 1
    zeige alle Benutzer des Directories  */
    case "show_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        show_directory_user();
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Anlegen neuer Benutzer
    case "add_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        unset($user_id, $username);                                       //register globals On Patch
        include('add_user.inc.php');
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // ändern oder hinzufügen von Nutzerdaten in Datenbank
    case "insert_update_user":
      if ($_SESSION['user_id'] == "1")  {
        insert_update_user($_GET['user_id'], $_POST['username'], $_POST['password'], $_POST['lang']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // lösche Benutzer
    case "del_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        del_directory_user($_GET['user_id']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Ändern von Nutzerdaten
    case "mod_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        mod_directory_user($_GET['user_id'], $_GET['action']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // Zeige die Nummerntypen des Directory
    case "show_number_types":
      if ($_SESSION['user_id'] == "1")  {
        show_number_types();
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // lösche Nummerntyp
    case "del_number_types":
      if ($_SESSION['user_id'] == "1")  {
        del_number_types($_GET['type_id']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Anlegen neuer Nummerntypen
    case "add_number_types":
      if ($_SESSION['user_id'] == "1")  {
        include('add_type.inc.php');
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // ändern oder hinzufügen von Nummerntypen in Datenbank
    case "insert_update_types":
      if ($_SESSION['user_id'] == "1")  {
        insert_update_types($_GET['type_id'], $_POST['type']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Ändern von Nummerntypen
    case "mod_number_types":
      if ($_SESSION['user_id'] == "1")  {
        mod_number_types($_GET['type_id']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;


    // wenn keine action oder garbage im GET dann zeige das directory
    default:
      show_directory_entries();
    }

  // wenn Session nicht aktiv dann zeige Login Seite
  } else {
    include 'login_mask.inc.php';
  }

  // Lade den unteren Teil der HTMl Seite
  include('footer.inc.php');


















function insert_user_phones($name)
{
  $query  = "insert into directory_phones (user_id, name) ";
  $query .= "values (".$_SESSION['user_id'].", '$name')";
  connect_db();  // connect to the DB
  safe_query($query);
  show_user_phones();
}


function del_user_phones($phone_id)
{
  $query = "delete from directory_phones where phone_id = '$phone_id' AND user_id = " .$_SESSION['user_id'];
  connect_db();  // connect to the DB
  safe_query($query);
  show_user_phones();
}


function show_user_phones()
{
  connect_db();  // connect to the DB
  $query = "select * from directory_phones where user_id = ".$_SESSION['user_id'];
  $result = safe_query($query);
  if ($result)
  {
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['phonename']."</b></td>\n";
    echo "</tr>\n";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['name']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_user_phones&phone_id=".$row['phone_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_user_phones\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addphone']."</a>\n";
    mysql_free_result($result);
  }
}


function mod_directory_user($user_id, $call)
{
  $query = "select * from directory_user where user_id  = '$user_id'";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $username=$row['username'];
      $language=$row['language'];
    }
  }
  if ($call == "mod_directory_user") include('add_user.inc.php');
  if ($call == "show_my_settings") include('my_settings.inc.php');
  mysql_free_result($result);
}


function del_directory_user($user_id)
{
  $query1  = "delete from directory_user where user_id = '$user_id'";

  $query2  = "delete from directory_phones where user_id = '$user_id'";

  $query3  = "delete from directory_numbers ";
  $query3 .= "using directory_numbers, directory_entries ";
  $query3 .= "where directory_numbers.entry_id = directory_entries.entry_id ";
  $query3 .= "and directory_entries.user_id = '$user_id'";

  $query4  = "delete from directory_entries where user_id = '$user_id'";

  connect_db();  // connect to the DB
  safe_query($query1);
  safe_query($query2);
  safe_query($query3);
  safe_query($query4);
  show_directory_user();
}


function insert_update_user($user_id, $username, $password, $language)
{

  // Benutzer neu anlegen
  if (empty($user_id))  {
  $query  = "insert into directory_user (username, password) values ";
  $query .= "('$username', password('$password'))";
  }

  // bestehenden Benutzer Passwort und Sprache ändern
  if (!empty($user_id) && !empty($password))  {
  $query  = "update directory_user set ";
  $query .= "username='$username', password=password('$password'), language='$language' ";
  $query .= "where user_id='$user_id'";
  }

  // bestehenden Benutzer Sprache ändern
  if (!empty($user_id) && empty($password))  {
  $query  = "update directory_user set ";
  $query .= "username='$username', language='$language' ";
  $query .= "where user_id='$user_id'";
  }

  connect_db();  // connect to the DB
  safe_query($query);
  if ($_SESSION['user_id'] == "1")  {
    show_directory_user();
  } else {
    show_directory_entries();
  }
}


function show_directory_user()
{
  $query = "select * from directory_user";
  connect_db();  // connect to the DB
  $result = safe_query($query);
  if ($result)
  {
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['userid']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['username']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['pwdhash']."</b></td>\n";
    echo "</tr>\n";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['user_id']."</td>\n";
      echo "\t<td>".$row['username']."</td>\n";
      echo "\t<td>".$row['password']."</td>\n";

      if ($row['user_id'] != "1") {
        echo "\t<td><a href=\"index.php?action=del_directory_user&user_id=".$row['user_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
        echo "\t<td><a href=\"index.php?action=mod_directory_user&user_id=".$row['user_id']."\"><img src=\"images/mod_user.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      } else {
        echo "\t<td></td>\n";
        echo "\t<td><a href=\"index.php?action=mod_directory_user&user_id=".$row['user_id']."\"><img src=\"images/mod_user.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      }

      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_directory_user\"><img src=\"images/add_user.png\" border=\"0\">".$_SESSION['lang']['adduser']."</a>\n";
  }
  mysql_free_result($result);
}


function insert_update_entry($entry_id, $name, $lastname)
{

  if (empty($entry_id))  {
  $query  = "insert into directory_entries (user_id, name, lastname) ";
  $query .= "values (".$_SESSION['user_id'].", '$name', '$lastname')";
  } else {
  $query  = "update directory_entries set ";
  $query .= "name='$name', lastname='$lastname' ";
  $query .= "where entry_id='$entry_id' AND user_id = " .$_SESSION['user_id'];
  }

  connect_db();  // connect to the DB
  safe_query($query);
  show_directory_entries();
}


function mod_directory_entries($entry_id)
{
  $query = "select * from directory_entries where entry_id  = '$entry_id' AND user_id = " .$_SESSION['user_id'];
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $entry_id=$row['entry_id'];
      $name=$row['name'];
      $lastname=$row['lastname'];
    }
  }
  if (mysql_num_rows($result) > 0)  {
    include('add_entry.inc.php');
  } else {
    show_directory_entries();
  }
  mysql_free_result($result);
}



function del_directory_entries($entry_id)
{
  $query  = "delete from directory_numbers ";
  $query .= "using directory_numbers, directory_entries ";
  $query .= "where directory_numbers.entry_id = directory_entries.entry_id ";
  $query .= "and directory_entries.entry_id = '$entry_id' ";
  $query .= "and directory_entries.user_id = ".$_SESSION['user_id'];

  connect_db();  // connect to the DB
  safe_query($query);

  $query  = "delete from directory_entries ";
  $query .= "where directory_entries.entry_id = '$entry_id' ";
  $query .= "and directory_entries.user_id = ".$_SESSION['user_id'];

  connect_db();  // connect to the DB
  safe_query($query);

  show_directory_entries();
}


function show_directory_entries()
{
  connect_db();  // connect to the DB
  $query = "select * from directory_entries where user_id = ".$_SESSION['user_id'];
  $result = safe_query($query);
  if ($result)
  {
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['firstname']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['lastname']."</b></td>\n";
    echo "</tr>\n";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['name']."</td>\n";
      echo "\t<td>".$row['lastname']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_directory_entries&entry_id=".$row['entry_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=mod_directory_entries&entry_id=".$row['entry_id']."\"><img src=\"images/mod_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=show_directory_entry_numbers&entry_id=".$row['entry_id']."\"><img src=\"images/dir_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['numbers']."\" title=\"".$_SESSION['lang']['numbers']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_directory_entries\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addentry']."</a>\n";
    mysql_free_result($result);
  }
}


function show_number_types()
{
  connect_db();  // connect to the DB
  $query = "select * from directory_types";
  $result = safe_query($query);
  if ($result)
  {
    echo "<div class=\"types\">\n";
    echo $_SESSION['lang']['deltypewarnmsg'];
    echo "</div>\n";
    echo "<br>\n";
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['numbertypes']."</b></td>\n";
    echo "</tr>\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['type']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_number_types&type_id=".$row['type_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=mod_number_types&type_id=".$row['type_id']."\"><img src=\"images/mod_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_number_types\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addtype']."</a>\n";
    mysql_free_result($result);
  }
}


function del_number_types($type_id)
{
  $query1 = "delete from directory_types where type_id = '$type_id'";
  $query2 = "delete from directory_numbers where type_id = '$type_id'";
  connect_db();  // connect to the DB
  safe_query($query1);
  safe_query($query2);
  show_number_types();
}


function insert_update_types($type_id, $type)
{
  if (empty($type_id))  {
  $query  = "insert into directory_types (type) ";
  $query .= "values ('$type')";
  } else {
  $query  = "update directory_types set ";
  $query .= "type='$type' ";
  $query .= "where type_id='$type_id'";
  }

  connect_db();  // connect to the DB
  safe_query($query);
  show_number_types();
}


function mod_number_types($type_id)
{
  $query = "select * from directory_types where type_id  = '$type_id'";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $type=$row['type'];
    }
  }
  include('add_type.inc.php');
  mysql_free_result($result);
}


function show_directory_entry_numbers($entry_id)
{
  connect_db();  // connect to the DB

  $query  = "select * from directory_types, directory_numbers, directory_entries ";
  $query .= "where directory_types.type_id = directory_numbers.type_id ";
  $query .= "AND directory_entries.entry_id = directory_numbers.entry_id ";
  $query .= "AND directory_numbers.entry_id = '$entry_id' ";
  $query .= "AND directory_entries.user_id = ".$_SESSION['user_id'];
  $result = safe_query($query);

  $query  = "select * from directory_entries ";
  $query .= "where entry_id = '$entry_id' ";
  $query .= "AND user_id = ".$_SESSION['user_id'];
  $name_result = safe_query($query);

  if ($result)
  {
    $name_row = mysql_fetch_array($name_result, MYSQL_ASSOC);
    if (empty($name_row['name'])) {
      show_directory_entries();
      return;
    } else {
      echo "<H3>".$name_row['name']." ".$name_row['lastname']."</H3>";
    }
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['numbertype']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['number']."</b></td>\n";
    echo "</tr>\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['type']."</td>\n";
      echo "\t<td>".$row['number']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_directory_entry_number&number_id=".$row['number_id']."&entry_id=".$row['entry_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=mod_directory_entry_numbers&number_id=".$row['number_id']."&entry_id=".$row['entry_id']."\"><img src=\"images/mod_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_directory_entry_numbers&entry_id=$entry_id\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addnumber']."</a>\n";
    mysql_free_result($result);
  }
}


function del_directory_entry_number($number_id, $entry_id)
{
  $query  = "delete from directory_numbers ";
  $query .= "using directory_numbers, directory_entries ";
  $query .= "where directory_numbers.entry_id = directory_entries.entry_id ";
  $query .= "and number_id = '$number_id' ";
  $query .= "and directory_entries.user_id = ".$_SESSION['user_id'];
  connect_db();  // connect to the DB
  safe_query($query);
  show_directory_entry_numbers($entry_id);
}

function mod_directory_entry_numbers($number_id, $entry_id)
{
  $query = "select * from directory_numbers where number_id  = '$number_id'";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $type_id=$row['type_id'];
      $number=$row['number'];
    }
  }
  $query  ="select * from directory_types";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  include('add_number.inc.php');

  mysql_free_result($result);
}

function add_directory_entry_numbers($entry_id)
{
  $query  ="select * from directory_types";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  include('add_number.inc.php');

  mysql_free_result($result);
}


function insert_update_entry_number($number_id, $type_id, $entry_id, $number)
{

  if (empty($number_id))  {
  $query  = "insert into directory_numbers (type_id, entry_id, number) ";
  $query .= "values ('$type_id', '$entry_id', '$number')";
  } else {
  $query  = "update directory_numbers set ";
  $query .= "type_id='$type_id', entry_id='$entry_id', number='$number' ";
  $query .= "where number_id='$number_id'";
  }

  connect_db();  // connect to the DB
  safe_query($query);
  show_directory_entry_numbers($entry_id);
}


function check_login($username, $password)
{
  connect_db();  // connect to the DB
  $query = "select * from directory_user where username = '$username' and password = password('$password')";
  $result = safe_query($query);
  $row = mysql_fetch_array($result, MYSQL_ASSOC);

  if (empty($row)) {
    $login=FALSE;
  }
  else
  {
    $login=$row;
  }
  mysql_free_result($result);
  return $login;
}
?>
 
Huiuiui, jetzt weiss ich wieder warum ich so gerne inkludiere...

Die index.php unterscheidet sich vom original des Downloads aus Post #1.
Original: 21777 Bytes und 708 Zeilen
Vorliegende index.php von dir: 22501 Bytes und 707 Zeilen
...irgendwas scheint da verrutscht.

Ein Syntaxcheck auf beide ergab...
Code:
php -l index.php
No syntax errors detected in index.php

Bevor ich mir einen Wolf suche schlage ich vor,
dass du es nochmal ganz vorsichtig runterlädst entpackst und ausprobierst.
...die Datenbank und Benutzer admin/admin muss nicht neu erstellt werden. ;)
 
Zuletzt bearbeitet:
Hier noch mal frisch entpackt. Bringt aber keine Änderung

PHP:
<?php

  // Initialize session data
  session_start();

  // IE 6 Fix
  header("Cache-control: private");

  // Lade die funktionen für den Zugriff auf die Datenbank
  require_once('baseFunction.inc.php');

  // Lade den oberen Teil der HTML Seite
  include('header.inc.php');

  // Bei einem Login prüfe Eingaben gegen die Datenbank wenn korrekt aktiviere die Session
  if ($_POST['action'] == "login")  {
    $login = check_login($_POST['username'], $_POST['password']);
    if ($login)  {
      $_SESSION['user_id'] = $login['user_id'];
      $_SESSION['username'] = $login['username'];
      $_SESSION['language'] = $login['language'];

      // Lade das Sprachenregister
      require ('lang/register.inc.php');
      require "lang/".$register['file'][$_SESSION['language']];
      $_SESSION['lang'] = $lang;
      $_GET['action'] = "show_directory_entries";
    }
  }

  // Prüfe ob die Session aktiv ist
  if (!empty($_SESSION['user_id']))  {

    // Lade die Navigationszeile
    include('navigation.inc.php');

    // verteile ja nach Aufruf in die entsprechenden Funktionen
    switch ($_GET['action'])  {

    // Dialog zur Eingabe neuer Nummern
    case "add_directory_entries":
      include('add_entry.inc.php');
    break;

    // neuen Eintrag in Datenbank schreiben oder vorhandenen aktualisieren
    case "insert_update_entry":
      insert_update_entry($_GET['entry_id'], $_POST['name'], $_POST['lastname']);
    break;

    // Eintrag aus Datenbank löschen
    case "del_directory_entries":
      del_directory_entries($_GET['entry_id']);
    break;

    // Dialog zum Ändern von Einträgen
    case "mod_directory_entries":
      mod_directory_entries($_GET['entry_id']);
    break;

    // zeige vorhanden Einträge
    case "show_directory_entries":
      show_directory_entries();
    break;
//******************************************************************************************************

    // Dialog zum Anzeigen der Rufnummern eines Eintrages
    case "show_directory_entry_numbers":
      show_directory_entry_numbers($_GET['entry_id']);
    break;

    // Dialog zum hinzufügen von Rufnummern
    case "del_directory_entry_number":
      del_directory_entry_number($_GET['number_id'], $_GET['entry_id']);
    break;

    // Dialog zum hinzufügen von Rufnummern
    case "mod_directory_entry_numbers":
      mod_directory_entry_numbers($_GET['number_id'], $_GET['entry_id']);
    break;

    // Dialog zum hinzufügen von Rufnummern
    case "add_directory_entry_numbers":
      add_directory_entry_numbers($_GET['entry_id']);
    break;

    // hinzufügen und ändern von rufnummern
    case "insert_update_entry_number":
      insert_update_entry_number($_GET['number_id'], $_POST['type_id'], $_POST['entry_id'], $_POST['number']);
    break;


    // zeige Telefone des Benutzers
    case "show_user_phones":
      show_user_phones();
    break;

    // Dialog zur Eingabe neuer Telefone
    case "add_user_phones":
      include('add_phone.inc.php');
    break;

    // neues Telefon in Datenbank speichern
    case "insert_user_phones":
      insert_user_phones($_POST['name']);
    break;

    // Lösche Telefon aus Datenbank
    case "del_user_phones":
      del_user_phones($_GET['phone_id']);
    break;

    // zeige dialog zum Ändern von Username/Password
    case "show_my_settings":
     mod_directory_user($_SESSION['user_id'], $_GET['action']);
    break;

    // geänderte Benutzerdaten in Datenbank speichern
    case "update_my_settings":
     insert_update_user($_SESSION['user_id'], $_POST['username'], $_POST['password'], $_POST['lang']);
    break;

    /* Zugriff nur für User mit ID 1
    zeige alle Benutzer des Directories  */
    case "show_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        show_directory_user();
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Anlegen neuer Benutzer
    case "add_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        unset($user_id, $username);                                       //register globals On Patch
        include('add_user.inc.php');
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // ändern oder hinzufügen von Nutzerdaten in Datenbank
    case "insert_update_user":
      if ($_SESSION['user_id'] == "1")  {
        insert_update_user($_GET['user_id'], $_POST['username'], $_POST['password'], $_POST['lang']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // lösche Benutzer
    case "del_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        del_directory_user($_GET['user_id']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Ändern von Nutzerdaten
    case "mod_directory_user":
      if ($_SESSION['user_id'] == "1")  {
        mod_directory_user($_GET['user_id'], $_GET['action']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // Zeige die Nummerntypen des Directory
    case "show_number_types":
      if ($_SESSION['user_id'] == "1")  {
        show_number_types();
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // lösche Nummerntyp
    case "del_number_types":
      if ($_SESSION['user_id'] == "1")  {
        del_number_types($_GET['type_id']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Anlegen neuer Nummerntypen
    case "add_number_types":
      if ($_SESSION['user_id'] == "1")  {
        include('add_type.inc.php');
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // ändern oder hinzufügen von Nummerntypen in Datenbank
    case "insert_update_types":
      if ($_SESSION['user_id'] == "1")  {
        insert_update_types($_GET['type_id'], $_POST['type']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;

    // zeige Dialog zum Ändern von Nummerntypen
    case "mod_number_types":
      if ($_SESSION['user_id'] == "1")  {
        mod_number_types($_GET['type_id']);
      } else {
        echo "Du bist nicht autorisiert";
      }
    break;


    // wenn keine action oder garbage im GET dann zeige das directory
    default:
      show_directory_entries();
    }

  // wenn Session nicht aktiv dann zeige Login Seite
  } else {
    include 'login_mask.inc.php';
  }

  // Lade den unteren Teil der HTMl Seite
  include('footer.inc.php');


















function insert_user_phones($name)
{
  $query  = "insert into directory_phones (user_id, name) ";
  $query .= "values (".$_SESSION['user_id'].", '$name')";
  connect_db();  // connect to the DB
  safe_query($query);
  show_user_phones();
}


function del_user_phones($phone_id)
{
  $query = "delete from directory_phones where phone_id = '$phone_id' AND user_id = " .$_SESSION['user_id'];
  connect_db();  // connect to the DB
  safe_query($query);
  show_user_phones();
}


function show_user_phones()
{
  connect_db();  // connect to the DB
  $query = "select * from directory_phones where user_id = ".$_SESSION['user_id'];
  $result = safe_query($query);
  if ($result)
  {
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['phonename']."</b></td>\n";
    echo "</tr>\n";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['name']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_user_phones&phone_id=".$row['phone_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_user_phones\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addphone']."</a>\n";
    mysql_free_result($result);
  }
}


function mod_directory_user($user_id, $call)
{
  $query = "select * from directory_user where user_id  = '$user_id'";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $username=$row['username'];
      $language=$row['language'];
    }
  }
  if ($call == "mod_directory_user") include('add_user.inc.php');
  if ($call == "show_my_settings") include('my_settings.inc.php');
  mysql_free_result($result);
}


function del_directory_user($user_id)
{
  $query1  = "delete from directory_user where user_id = '$user_id'";

  $query2  = "delete from directory_phones where user_id = '$user_id'";

  $query3  = "delete from directory_numbers ";
  $query3 .= "using directory_numbers, directory_entries ";
  $query3 .= "where directory_numbers.entry_id = directory_entries.entry_id ";
  $query3 .= "and directory_entries.user_id = '$user_id'";

  $query4  = "delete from directory_entries where user_id = '$user_id'";

  connect_db();  // connect to the DB
  safe_query($query1);
  safe_query($query2);
  safe_query($query3);
  safe_query($query4);
  show_directory_user();
}


function insert_update_user($user_id, $username, $password, $language)
{

  // Benutzer neu anlegen
  if (empty($user_id))  {
  $query  = "insert into directory_user (username, password) values ";
  $query .= "('$username', password('$password'))";
  }

  // bestehenden Benutzer Passwort und Sprache ändern
  if (!empty($user_id) && !empty($password))  {
  $query  = "update directory_user set ";
  $query .= "username='$username', password=password('$password'), language='$language' ";
  $query .= "where user_id='$user_id'";
  }

  // bestehenden Benutzer Sprache ändern
  if (!empty($user_id) && empty($password))  {
  $query  = "update directory_user set ";
  $query .= "username='$username', language='$language' ";
  $query .= "where user_id='$user_id'";
  }

  connect_db();  // connect to the DB
  safe_query($query);
  if ($_SESSION['user_id'] == "1")  {
    show_directory_user();
  } else {
    show_directory_entries();
  }
}


function show_directory_user()
{
  $query = "select * from directory_user";
  connect_db();  // connect to the DB
  $result = safe_query($query);
  if ($result)
  {
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['userid']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['username']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['pwdhash']."</b></td>\n";
    echo "</tr>\n";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['user_id']."</td>\n";
      echo "\t<td>".$row['username']."</td>\n";
      echo "\t<td>".$row['password']."</td>\n";

      if ($row['user_id'] != "1") {
        echo "\t<td><a href=\"index.php?action=del_directory_user&user_id=".$row['user_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
        echo "\t<td><a href=\"index.php?action=mod_directory_user&user_id=".$row['user_id']."\"><img src=\"images/mod_user.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      } else {
        echo "\t<td></td>\n";
        echo "\t<td><a href=\"index.php?action=mod_directory_user&user_id=".$row['user_id']."\"><img src=\"images/mod_user.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      }

      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_directory_user\"><img src=\"images/add_user.png\" border=\"0\">".$_SESSION['lang']['adduser']."</a>\n";
  }
  mysql_free_result($result);
}


function insert_update_entry($entry_id, $name, $lastname)
{

  if (empty($entry_id))  {
  $query  = "insert into directory_entries (user_id, name, lastname) ";
  $query .= "values (".$_SESSION['user_id'].", '$name', '$lastname')";
  } else {
  $query  = "update directory_entries set ";
  $query .= "name='$name', lastname='$lastname' ";
  $query .= "where entry_id='$entry_id' AND user_id = " .$_SESSION['user_id'];
  }

  connect_db();  // connect to the DB
  safe_query($query);
  show_directory_entries();
}


function mod_directory_entries($entry_id)
{
  $query = "select * from directory_entries where entry_id  = '$entry_id' AND user_id = " .$_SESSION['user_id'];
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $entry_id=$row['entry_id'];
      $name=$row['name'];
      $lastname=$row['lastname'];
    }
  }
  if (mysql_num_rows($result) > 0)  {
    include('add_entry.inc.php');
  } else {
    show_directory_entries();
  }
  mysql_free_result($result);
}



function del_directory_entries($entry_id)
{
  $query  = "delete from directory_numbers ";
  $query .= "using directory_numbers, directory_entries ";
  $query .= "where directory_numbers.entry_id = directory_entries.entry_id ";
  $query .= "and directory_entries.entry_id = '$entry_id' ";
  $query .= "and directory_entries.user_id = ".$_SESSION['user_id'];

  connect_db();  // connect to the DB
  safe_query($query);

  $query  = "delete from directory_entries ";
  $query .= "where directory_entries.entry_id = '$entry_id' ";
  $query .= "and directory_entries.user_id = ".$_SESSION['user_id'];

  connect_db();  // connect to the DB
  safe_query($query);

  show_directory_entries();
}


function show_directory_entries()
{
  connect_db();  // connect to the DB
  $query = "select * from directory_entries where user_id = ".$_SESSION['user_id'];
  $result = safe_query($query);
  if ($result)
  {
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['firstname']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['lastname']."</b></td>\n";
    echo "</tr>\n";

    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['name']."</td>\n";
      echo "\t<td>".$row['lastname']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_directory_entries&entry_id=".$row['entry_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=mod_directory_entries&entry_id=".$row['entry_id']."\"><img src=\"images/mod_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=show_directory_entry_numbers&entry_id=".$row['entry_id']."\"><img src=\"images/dir_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['numbers']."\" title=\"".$_SESSION['lang']['numbers']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_directory_entries\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addentry']."</a>\n";
    mysql_free_result($result);
  }
}


function show_number_types()
{
  connect_db();  // connect to the DB
  $query = "select * from directory_types";
  $result = safe_query($query);
  if ($result)
  {
    echo "<div class=\"types\">\n";
    echo $_SESSION['lang']['deltypewarnmsg'];
    echo "</div>\n";
    echo "<br>\n";
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['numbertypes']."</b></td>\n";
    echo "</tr>\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['type']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_number_types&type_id=".$row['type_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=mod_number_types&type_id=".$row['type_id']."\"><img src=\"images/mod_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_number_types\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addtype']."</a>\n";
    mysql_free_result($result);
  }
}


function del_number_types($type_id)
{
  $query1 = "delete from directory_types where type_id = '$type_id'";
  $query2 = "delete from directory_numbers where type_id = '$type_id'";
  connect_db();  // connect to the DB
  safe_query($query1);
  safe_query($query2);
  show_number_types();
}


function insert_update_types($type_id, $type)
{
  if (empty($type_id))  {
  $query  = "insert into directory_types (type) ";
  $query .= "values ('$type')";
  } else {
  $query  = "update directory_types set ";
  $query .= "type='$type' ";
  $query .= "where type_id='$type_id'";
  }

  connect_db();  // connect to the DB
  safe_query($query);
  show_number_types();
}


function mod_number_types($type_id)
{
  $query = "select * from directory_types where type_id  = '$type_id'";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $type=$row['type'];
    }
  }
  include('add_type.inc.php');
  mysql_free_result($result);
}


function show_directory_entry_numbers($entry_id)
{
  connect_db();  // connect to the DB

  $query  = "select * from directory_types, directory_numbers, directory_entries ";
  $query .= "where directory_types.type_id = directory_numbers.type_id ";
  $query .= "AND directory_entries.entry_id = directory_numbers.entry_id ";
  $query .= "AND directory_numbers.entry_id = '$entry_id' ";
  $query .= "AND directory_entries.user_id = ".$_SESSION['user_id'];
  $result = safe_query($query);

  $query  = "select * from directory_entries ";
  $query .= "where entry_id = '$entry_id' ";
  $query .= "AND user_id = ".$_SESSION['user_id'];
  $name_result = safe_query($query);

  if ($result)
  {
    $name_row = mysql_fetch_array($name_result, MYSQL_ASSOC);
    if (empty($name_row['name'])) {
      show_directory_entries();
      return;
    } else {
      echo "<H3>".$name_row['name']." ".$name_row['lastname']."</H3>";
    }
    echo "<table border=\"1\">\n";
    echo "<tr>\n";
    echo "\t<td><b>".$_SESSION['lang']['numbertype']."</b></td>\n";
    echo "\t<td><b>".$_SESSION['lang']['number']."</b></td>\n";
    echo "</tr>\n";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      echo "<tr>\n";
      echo "\t<td>".$row['type']."</td>\n";
      echo "\t<td>".$row['number']."</td>\n";
      echo "\t<td><a href=\"index.php?action=del_directory_entry_number&number_id=".$row['number_id']."&entry_id=".$row['entry_id']."\"><img src=\"images/del_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['delete']."\" title=\"".$_SESSION['lang']['delete']."\"></a></td>\n";
      echo "\t<td><a href=\"index.php?action=mod_directory_entry_numbers&number_id=".$row['number_id']."&entry_id=".$row['entry_id']."\"><img src=\"images/mod_entry.png\" border=\"0\" alt=\"".$_SESSION['lang']['edit']."\" title=\"".$_SESSION['lang']['edit']."\"></a></td>\n";
      echo "</tr>\n";
    }
    echo "</table>\n";
    echo "<br>\n";
    echo "<a href=\"index.php?action=add_directory_entry_numbers&entry_id=$entry_id\"><img src=\"images/add_entry.png\" border=\"0\" >".$_SESSION['lang']['addnumber']."</a>\n";
    mysql_free_result($result);
  }
}


function del_directory_entry_number($number_id, $entry_id)
{
  $query  = "delete from directory_numbers ";
  $query .= "using directory_numbers, directory_entries ";
  $query .= "where directory_numbers.entry_id = directory_entries.entry_id ";
  $query .= "and number_id = '$number_id' ";
  $query .= "and directory_entries.user_id = ".$_SESSION['user_id'];
  connect_db();  // connect to the DB
  safe_query($query);
  show_directory_entry_numbers($entry_id);
}

function mod_directory_entry_numbers($number_id, $entry_id)
{
  $query = "select * from directory_numbers where number_id  = '$number_id'";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  if ($result)
  {
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
      $type_id=$row['type_id'];
      $number=$row['number'];
    }
  }
  $query  ="select * from directory_types";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  include('add_number.inc.php');

  mysql_free_result($result);
}

function add_directory_entry_numbers($entry_id)
{
  $query  ="select * from directory_types";
  connect_db();  // connect to the DB
  $result = safe_query($query);

  include('add_number.inc.php');

  mysql_free_result($result);
}


function insert_update_entry_number($number_id, $type_id, $entry_id, $number)
{

  if (empty($number_id))  {
  $query  = "insert into directory_numbers (type_id, entry_id, number) ";
  $query .= "values ('$type_id', '$entry_id', '$number')";
  } else {
  $query  = "update directory_numbers set ";
  $query .= "type_id='$type_id', entry_id='$entry_id', number='$number' ";
  $query .= "where number_id='$number_id'";
  }

  connect_db();  // connect to the DB
  safe_query($query);
  show_directory_entry_numbers($entry_id);
}


function check_login($username, $password)
{
  connect_db();  // connect to the DB
  $query = "select * from directory_user where username = '$username' and password = password('$password')";
  $result = safe_query($query);
  $row = mysql_fetch_array($result, MYSQL_ASSOC);

  if (empty($row)) {
    $login=FALSE;
  }
  else
  {
    $login=$row;
  }
  mysql_free_result($result);
  return $login;
}
?>
 
Zuletzt bearbeitet:
Hm, komisch, bei mir siehts soweit gut aus.
Besonders wenn in der index.php am Anfang noch steht...
PHP:
<?php
error_reporting(0);

xdir_01.pngxdir_02.pngxdir_03.pngxdir_04.png

Geändert hab ich nur obiges und die hier angepasst auf mein System...
PHP:
<?
  $database_server  = "localhost";
  $database_user    = "admin";
  $database_pawd    = "admin";
  $database         = "xml_directory";
  $DirAbsoluteUri   = "http://localhost/directory/";
  $AvoidPhoneBug    = TRUE;
  $fallbacklanguage = 1;   // 1=de, 2=en
?>
...vielleicht erst mal eine gediegene Pause?
 
Zuletzt bearbeitet:
und beim Anlegen der SQL-Datenbank sind auch die o.g. Meldungen erschienen (kein Eintrag etc?)?
 
Wie bereits erwähnt, Datenbank, Tabellen und Benutzer musste ich nicht neuanlegen.
Alle Einträge wurden in die Datenbank geschrieben.
Die config.inc.php muss aber zwingend angepasst werden, wenn auch neu runtergeladen/entpackt/kopiert.
Falls du meine Installation mal testen möchtest: Anhang anzeigen directory.zip
 
Zuletzt bearbeitet:
Könntest Du mir dann nicht mal Deine Datenbank zur Verfügung stellen, in der Hoffnung, dass der Fehler in meiner Datenbank liegt?

Der Rest an Dateien und Einstellungen scheint ja exakt gleich zu sein, oder?
 
Übrigens, der Logout (logout.php) Button ruft...
PHP:
$DirAbsoluteUri   = "http://localhost/directory/";
...aus der config.inc.php auf.

Wenn dem nicht so ist: Browsercache löschen und/oder XAMPP neustarten.
 
Zuletzt bearbeitet:
Nachdem ich nur Deine directory ausgetauscht hatte, habe ich wieder die bekannten Fehler bekommen, ein Login war schon nicht mehr möglich

EDIT:

Danke für deine Datenbank, muss aber erstmal wieder den alten Zustand hinbekommen
 
Habe nun noch mal Deine directory benutzt. Jetzt heißt es, "kann Datenbank nicht selektieren", keine anderen Fehler mehr.

Habe nun noch Deine SQL-Datenbank "importieren" wollen, dabei kommt der Fehler

PHP:
Fehler
SQL-Befehl:




--
-- Datenbank: `xml_directory`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `directory_entries`
--

CREATE TABLE IF NOT EXISTS `directory_entries` (
  `entry_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL DEFAULT '',
  `lastname` varchar(255) NOT NULL DEFAULT '',
  KEY `entry_key` (`entry_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
MySQL meldet: Dokumentation

#1046 - No database selected
 
Mir ist aufgefallen, dass in Deiner config.inc.php, die Du hier eingestellt hast, auch das "php" fehlt.
Wie konntest Du mit dieser Datei Erfolg haben, ich aber nicht?

Deine SQL-Datenbank habe ich leider bisher nicht zum Laufen gebracht, wegen dem in #39 genannten Fehler.
 
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.