Skocz do zawartości

orton21

Użytkownicy
  • Zawartość

    45
  • Rejestracja

  • Ostatnio

Posty napisane przez orton21


  1. Poprawiłem zapytanie,tylko że mam teraz tak

    <?php
    
    // rozpoczęcie buforowania (jest to potrzebne by nie mieć błędów typu headers already sent)
    ob_start();
    
    // start sesji
    session_start();
    
    // połączenie z mysql
    mysql_connect('xxx', 'xxx', 'Jxxx')
        or die('Nieudane polaczenie z baza danych...');
    
    // wybór bazy danych
    mysql_select_db('xxxk')    
        or die('Nie udalo sie wybrac bazy danych...');
    
    // nagłówek
    echo '<center><h2>Logowanie</h2></center>';
    
    // sprawdzamy czy user jest już zalogowany
    if($_SESSION['logged']) echo 'Już jestes zalogowany!';
    else
    {
        // tworzymy prosty formularz
        
        echo '<center><form action="index.php" method="POST">
        Nick: <br />
        <input type="text" name="nick"><br />
        Hasło: <br />
        <input type="password" name="pass"><br />
        <input type="submit" name="ok" value="Zaloguj">
        </form></center>';
         // jeśli zostanie naciśnięty przycisk "Zaloguj"
         if(isset($_POST['ok']))
         {
            $nick = trim($_POST['nick']);
            $pass = trim($_POST['pass']);
     
          
            // sprawdzamy czy wszystkie dane zostały podane
            if(empty($nick) || empty($pass)) echo 'Wpisz wszystkie pola!';
           
             // jeśli tak...
            else
            {
                // filtrujemy dane
                $nick = strip_tags( mysql_real_escape_string( HTMLSpecialChars($nick)));
                $pass = strip_tags( mysql_real_escape_string( HTMLSpecialChars($pass)));
               
                 // kodujemy hasło
            $pass = md5(strtoupper(md5($pass)));
       
                
                // sprawdzamy czy istnieje użytkownik z takim loginem i hasłem
                
         
                     $result = mysql_query ("SELECT * FROM `players` WHERE `nick`='$nick' AND `password`='$pass'");
                                 
                 // jeśli nie istnieje
                if(mysql_num_rows($result)==0) echo 'Niestety podałes niepoprawne dane!';
             
                 // jeśli tak...
                else
                {
                    // dodajemy wynik zapytania do tablicy
                    $row = mysql_fetch_array($result);
               
                     // ustawianie sesji że użytkownik jest zalogowany
                    $_SESSION['logged'] = true;
    
                    // dodawanie do sesji id użytkownika, login oraz datę rejestracji
                    $_SESSION['nick'] = $row['nick'];
    
                   
                     // wyświetlenie komunikatu oznaczającego poprawne logowanie
                    echo 'Zostałes poprawnie zalogowany! Możesz teraz przejsć na <a href="index.php">stronę główna</a>';
                    }
                }
            }
        }
    // rozłączenie z bazą danych
    mysql_close();
    
    // koniec buforowania
    ob_end_flush();
    ?>

    To dalej piszę niepoprawne dane. ;/


  2. Cześć,korzystając poradnika wyszło mi takie coś

     

     

    	
    		<?php
    		// rozpoczęcie buforowania (jest to potrzebne by nie mieć błędów typu headers already sent)
    		ob_start();
    		
    		// start sesji
    		session_start();
    		
    		// połączenie z mysql
    		mysql_connect('localhost', 'xxxxxx', 'xxxxxxxx')
    		    or die('Nieudane polaczenie z baza danych...');
    		
    		// wybór bazy danych
    		mysql_select_db('xxxxxxx')
    		    or die('Nie udalo sie wybrac bazy danych...');
    		
    		// nagłówek
    		echo '<center><h2>Logowanie</h2></center>';
    		
    		// sprawdzamy czy user jest już zalogowany
    		if($_SESSION['logged']) echo 'Już jestes zalogowany!';
    		else
    		{
    		    // tworzymy prosty formularz
    		   
    		    echo '<center><form action="index.php" method="POST">
    		    Nick: <br />
    		    <input type="text" name="nick"><br />
    		    Hasło: <br />
    		    <input type="password" name="pass"><br />
    		    <input type="submit" name="ok" value="Zaloguj">
    		    </form></center>';
    		     // jeśli zostanie naciśnięty przycisk "Zaloguj"
    		     if(isset($_POST['ok']))
    		     {
    		        $nick = trim($_POST['nick']);
    		        $pass = trim($_POST['pass']);
    		     
    		        // sprawdzamy czy wszystkie dane zostały podane
    		        if(empty($nick) || empty($pass)) echo 'Wpisz wszystkie pola!';
    		       
    		         // jeśli tak...
    		        else
    		        {
    		            // filtrujemy dane
    		            $nick = strip_tags( mysql_real_escape_string( HTMLSpecialChars($nick)));
    		            $pass = strip_tags( mysql_real_escape_string( HTMLSpecialChars($pass)));
    		           
    		             // kodujemy hasło
    		            $pass = md5($pass);
    		           
    		            // sprawdzamy czy istnieje użytkownik z takim loginem i hasłem
    		            $result = mysql_query ("SELECT * FROM 'players' WHERE 'nick' = '{$nick}' AND 'pass' = '{$password}'");
    		                          
    		             // jeśli nie istnieje
    		            if(mysql_num_rows($result)==0) echo 'Niestety podałes niepoprawne dane!';
    		         
    		             // jeśli tak...
    		            else
    		            {
    		                // dodajemy wynik zapytania do tablicy
    		                $row = mysql_fetch_array($result);
    		           
    		                 // ustawianie sesji że użytkownik jest zalogowany
    		                $_SESSION['logged'] = true;
    		
    		                // dodawanie do sesji nick
    		                $_SESSION['nick'] = $row['nick'];
    		
    		               
    		                 // wyświetlenie komunikatu oznaczającego poprawne logowanie
    		                echo 'Zostałes poprawnie zalogowany! Możesz teraz przejsć na <a href="index.php">stronę główna</a>';
    		                }
    		            }
    		        }
    		    }
    		// rozłączenie z bazą danych
    		mysql_close();
    		
    		// koniec buforowania
    		ob_end_flush();
    		?>
    	
    		
    Tylko teraz gdy wpisuję poprawny login i hasło piszę że są niepoprawne dane. W bazie mam tak w tabeli players:
    Nick Password
    Test 6F56E9B0A9ADE2FEBFC78EC7370EA165



    Nie wczytuje hasła bo jest zakodowane? Jeśli tak to jak mogę zrobić żeby logowanie działało? Z góry dziękuje za pomoc :)

  3. Cześć. Nie wiem czy to dobry dział,jeśli nie to proszę o przeniesienie. Mam takie pytanko,czy jeśli na stronie http://npl.teamspeakusa.com/ts3npl.php widnieje taki komunikat

     

     

     

    This website is for obtaining a NON-PROFIT license for your TeamSpeak 3 server.

    WE DO NOT PROVIDE TEAMSPEAK SERVER HOSTING.

    Non-Profit License registration is for NON-PROFIT entities who wish to increase their TeamSpeak 3 Server's capacity to allow a maximum of 10 virtual servers and 512 slots. Non-profit entities include but are not limited to organizations such as online gaming clans, guilds, or friends and family who utilize TeamSpeak software in a manner in which profit or gain of any kind is NOT intended.

     

     

    To czy jest jakaś inna szansa,aby uzyskać za darmo licencję od nich?


  4.  

    
    
    root@fp:~# apt-get purge apache2*
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    E: Unable to locate package apache2.2-common_2.2.16-6+squeeze11_i386.deb
    
    E: Couldn't find any package by regex 'apache2.2-common_2.2.16-6+squeeze11_i386.deb'
    
    E: Unable to locate package apache2.conf
    
    E: Couldn't find any package by regex 'apache2.conf'
    
    root@fp:~# apt-get install apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    apache2 is already the newest version.
    
    0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.

  5.  

    
    
    root@fp:~# apt-get purge apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    The following packages will be REMOVED:
    
      apache2*
    
    0 upgraded, 0 newly installed, 1 to remove and 40 not upgraded.
    
    After this operation, 36.9 kB disk space will be freed.
    
    Do you want to continue [Y/n]? y
    
    (Reading database ... 38261 files and directories currently installed.)
    
    Removing apache2 ...
    
    root@fp:~# apt-get install apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    The following NEW packages will be installed:
    
      apache2
    
    0 upgraded, 1 newly installed, 0 to remove and 40 not upgraded.
    
    Need to get 0 B/1394 B of archives.
    
    After this operation, 36.9 kB of additional disk space will be used.
    
    Selecting previously deselected package apache2.
    
    (Reading database ... 38257 files and directories currently installed.)
    
    Unpacking apache2 (from .../apache2_2.2.16-6+squeeze11_i386.deb) ...
    
    Setting up apache2 (2.2.16-6+squeeze11) ...
    
    root@fp:~# /etc/init.d/apache2 restart
    
    Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using
    
    .

     

    Niestety i to nie pomogło,by strona od phpmyadmina się wyświetlała


  6.  

    
    
    root@fp:~# APACHE_PKGS=`dpkg --get-selections | grep apache | cut -f 1`
    
    root@fp:~# apt-get remove --purge $APACHE_PKGS
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    Some packages could not be installed. This may mean that you have
    
    requested an impossible situation or if you are using the unstable
    
    distribution that some required packages have not yet been created
    
    or been moved out of Incoming.
    
    The following information may help to resolve the situation:
    
    
    
    The following packages have unmet dependencies:
    
     apache2.2-common : Depends: apache2-utils but it is not going to be installed
    
    E: Broken packages
    
    root@fp:~# apt-get install apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    apache2 is already the newest version.
    
    0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.

  7.  

    root@fp:~# apt-get purge apache2.2-common
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    The following extra packages will be installed:
    
      apache2-mpm-itk libapache2-mod-php5filter
    
    Suggested packages:
    
      php-pear
    
    The following packages will be REMOVED:
    
      apache2-mpm-prefork* libapache2-mod-php5*
    
    The following NEW packages will be installed:
    
      apache2-mpm-itk libapache2-mod-php5filter
    
    0 upgraded, 2 newly installed, 2 to remove and 40 not upgraded.
    
    Need to get 0 B/2892 kB of archives.
    
    After this operation, 0 B of additional disk space will be used.
    
    Do you want to continue [Y/n]? y
    
    dpkg: apache2-mpm-prefork: dependency problems, but removing anyway as you requested:
    
     libapache2-mod-php5 depends on apache2-mpm-prefork (>> 2.0.52) | apache2-mpm-itk; however:
    
      Package apache2-mpm-prefork is to be removed.
    
      Package apache2-mpm-itk is not installed.
    
     apache2 depends on apache2-mpm-worker (= 2.2.16-6+squeeze11) | apache2-mpm-prefork (= 2.2.16-6+squeeze11) | apache2-mpm-event (= 2.2.16-6+squeeze11) | apache2-mpm-itk (= 2.2.16-6+squeeze11); however:
    
      Package apache2-mpm-worker is not installed.
    
      Package apache2-mpm-prefork is to be removed.
    
      Package apache2-mpm-event is not installed.
    
      Package apache2-mpm-itk is not installed.
    
    (Reading database ... 38261 files and directories currently installed.)
    
    Removing apache2-mpm-prefork ...
    
    Stopping web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 80.72.43.201 for ServerName
    
     ... waiting .
    
    Selecting previously deselected package apache2-mpm-itk.
    
    (Reading database ... 38256 files and directories currently installed.)
    
    Unpacking apache2-mpm-itk (from .../apache2-mpm-itk_2.2.16-6+squeeze11_i386.deb) ...
    
    Setting up apache2-mpm-itk (2.2.16-6+squeeze11) ...
    
    Starting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 80.72.43.201 for ServerName
    
    .
    
    dpkg: libapache2-mod-php5: dependency problems, but removing anyway as you requested:
    
     php5 depends on libapache2-mod-php5 (>= 5.3.3-7+squeeze15) | libapache2-mod-php5filter (>= 5.3.3-7+squeeze15) | php5-cgi (>= 5.3.3-7+squeeze15); however:
    
      Package libapache2-mod-php5 is to be removed.
    
      Package libapache2-mod-php5filter is not installed.
    
      Package php5-cgi is not installed.
    
    (Reading database ... 38261 files and directories currently installed.)
    
    Removing libapache2-mod-php5 ...
    
    Module php5 disabled.
    
    Run '/etc/init.d/apache2 restart' to activate new configuration!
    
    Purging configuration files for libapache2-mod-php5 ...
    
    dpkg: warning: while removing libapache2-mod-php5, directory '/etc/php5/apache2' not empty so not removed.
    
    Selecting previously deselected package libapache2-mod-php5filter.
    
    (Reading database ... 38254 files and directories currently installed.)
    
    Unpacking libapache2-mod-php5filter (from .../libapache2-mod-php5filter_5.3.3-7+squeeze15_i386.deb) ...
    
    Setting up libapache2-mod-php5filter (5.3.3-7+squeeze15) ...
    
    
    
    Creating config file /etc/php5/apache2filter/php.ini with new version
    
    Reloading web server config: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 80.72.43.201 for ServerName
    
    .
    
    root@fp:~# apt-get install apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    apache2 is already the newest version.
    
    0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
    
    root@fp:~# /etc/init.d/apache2 restart
    
    Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 80.72.43.201 for ServerName
    
     ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 80.72.43.201 for ServerName
    
    .
    
    root@fp:~#

     

    Dalej się nie wyświetla


  8. A czy jeśli nie zrobiłem najświeższej kopi z phpmyadmin i jeśli go zreinstaluje to strace wszystkie dane?

    Bo przy wcześniejszej opercji co robiłem zgodnie z instrukcją na innym forum o debianie pisało tak

    (Reading database ... 39630 files and directories currently installed.)Removing apache2 ...(Reading database ... 39626 files and directories currently installed.)Removing phpmyadmin ...Removing php5 ...

    A więc jeśli ponownie zainstaluje to będę musiał wszystko od nowa?

     


  9. Teraz problem znowu.

     

     

    root@fp:~# apt-get install apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    The following NEW packages will be installed:
    
      apache2
    
    0 upgraded, 1 newly installed, 0 to remove and 40 not upgraded.
    
    Need to get 0 B/1394 B of archives.
    
    After this operation, 36.9 kB of additional disk space will be used.
    
    Selecting previously deselected package apache2.
    
    (Reading database ... 39626 files and directories currently installed.)
    
    Unpacking apache2 (from .../apache2_2.2.16-6+squeeze11_i386.deb) ...
    
    Setting up apache2 (2.2.16-6+squeeze11) ...
    
    
    
    root@fp:~# cd /etc/init.d/apache2
    
    -bash: cd: /etc/init.d/apache2: Not a directory
    
    root@fp:~# /etc/init.d/apache2 restart
    
    .: 51: Can't open /etc/apache2/envvars
    
    root@fp:~#

    na dodatek nie mogę się dostać do phpmyadmina przez to ;/


  10. 
    
    root@fp:~# apt-get install apache2 --reinstall
    
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 40 not upgraded.
    
    Need to get 0 B/1394 B of archives.
    
    After this operation, 0 B of additional disk space will be used.
    
    (Reading database ... 39609 files and directories currently installed.)
    
    Preparing to replace apache2 2.2.16-6+squeeze11 (using .../apache2_2.2.16-6+squeeze11_i386.deb) ...
    
    Unpacking replacement apache2 ...
    
    Setting up apache2 (2.2.16-6+squeeze11) ...

    i potem znowu

     

     

    root@fp:~# /etc/init.d/apache2 restart
    
    -bash: /etc/init.d/apache2: /bin/sh^M: bad interpreter: No such file or directory

    Próbowalem jeszcze tak

     

     

    
    
    root@fp:~# apt-get remove apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    The following packages will be REMOVED:
    
      apache2
    
    0 upgraded, 0 newly installed, 1 to remove and 40 not upgraded.
    
    After this operation, 36.9 kB disk space will be freed.
    
    Do you want to continue [Y/n]? y
    
    (Reading database ... 39609 files and directories currently installed.)
    
    Removing apache2 ...
    
    root@fp:~# apt-get install apache2
    
    Reading package lists... Done
    
    Building dependency tree
    
    Reading state information... Done
    
    The following NEW packages will be installed:
    
      apache2
    
    0 upgraded, 1 newly installed, 0 to remove and 40 not upgraded.
    
    Need to get 0 B/1394 B of archives.
    
    After this operation, 36.9 kB of additional disk space will be used.
    
    Selecting previously deselected package apache2.
    
    (Reading database ... 39605 files and directories currently installed.)
    
    Unpacking apache2 (from .../apache2_2.2.16-6+squeeze11_i386.deb) ...
    
    Setting up apache2 (2.2.16-6+squeeze11) ...
    
    root@fp:~# /etc/init.d/apache2 restart
    
    -bash: /etc/init.d/apache2: /bin/sh^M: bad interpreter: No such file or directory
×