login script mit corenews2 verknüpfen

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • login script mit corenews2 verknüpfen

    Hi,

    da ich nicht viel Ahnung von php und co habe, nutze ich die vorgefertigten Scripts die man überall runterladen kann.

    Nun habe ich ein Loginscript, das ich mit corenews2 verbinden möchte (um genauer zu sein, möchte ich, dass wenn man sich im loginscript einloggt, auch gleich bei corenews2 eingeloggt ist.)

    Zuerst einmal das Loginscript:
    PHP-Code:
    <?php
    session_start
    ();

    //copyright für hier entfernt, weil thread zu lang war

    require("connect.inc.php");
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <?php if(!isset($_POST['submit'])) { ?>
    <form action="<?php $PHP_SELF ?>" method="post">
    <table width="400" bgcolor="#000000" border="0" cellpadding="5" cellspacing="1" align="center">
        <tr>
            <td bgcolor="#e7e7e7" align="center" colspan="2">
            <b>Bitte erst anmelden</b>
            </td>
        </tr>
        <tr>
            <td width="170" bgcolor="#e7e7e7">Benutzername</td>
            <td width="230" bgcolor="#ffffff"><input type="text" name="username" size="20" class="input"<?php if($_POST['username'] != "") {echo ' value="'.$_POST['username'].'"';} ?>></td>
        </tr>
        <tr>
            <td width="170" bgcolor="#e7e7e7">Passwort</td>
            <td width="230" bgcolor="#ffffff"><input type="password" name="password" size="20" class="input"></td>
        </tr>
        <tr>
            <td bgcolor="#e7e7e7" align="center" colspan="2">
            <input type="submit" name="submit" value="Anmelden" class="button">
            </td>
        </tr>
        <tr>
            <td bgcolor="#e7e7e7" align="center" colspan="2">
            Copyright &copy; 2003 by <a href="mailto:andy@mg-umschulung.de?subject=Dein LogIn-Skript">Andreas Zimare</a><br>
            <a href="http://www.mg-umschulung.de" target="_blank">[url]www.mg-umschulung.de[/url]</a> - Alle Rechte vorbehalten
            </td>
        </tr>
    </table>
    </form>
    <?php
    }elseif(!isset($_POST['username']) || $_POST['username'] == "") {
        echo 
    '<p align="center">Einen Benutzernamen brauchen wir schon ;-)<br><br><a href="index.php">Zur&uuml;ck</a></p>';
    }elseif(!
    $_POST['password'] || $_POST['password'] == "") {
        echo 
    '<form action="index.php" method="post">';
        echo 
    '<p align="center">Ein Passwort brauchen wir schon ;-)<br><br>';
        echo 
    '<input type="hidden" name="username" value="'.$_POST['username'].'">';
        echo 
    '<input type="submit" name="zurueck" value="Zur&uuml;ck">';
        echo 
    '</p>';
        echo 
    '</form>';
    }else{
        
    $password md5($password);
        
    $query = @mysql_query("SELECT user, pass FROM users WHERE user = '".$_POST['username']."'") or die('Select ist fehlgeschlagen!');
        
    $result = @mysql_fetch_array($query) or die('<p align="center">Sorry, aber dieser Benutzername existiert nicht!<br><a href="index.php">Zur&uuml;ck</a></p>');
        if(
    $password != $result['pass']){
            echo 
    '<form action="index.php" method="post">';
            echo 
    '<p align="center">Sorry, aber dieses Passwort ist falsch!<br><br>';
            echo 
    '<input type="hidden" name="username" value="'.$_POST['username'].'">';
            echo 
    '<input type="submit" name="zurueck" value="Zur&uuml;ck"></p>';
            echo 
    '</form>';
            die;
        }else{
            
    $user $result['user'];
            
    session_register('user');
            echo 
    '<p align="center">LogIn erfolgreich!!!!!!<br><br><a href="../news/">Weiter</a></p>';
            
    ?>
            <script language="JavaScript">
            window.setTimeout('window.location.href="sichere_seite.php"','3000')
            </script>
            <?php
        
    }
    }
    ?>
    dann die adminpage von corenews2:
    PHP-Code:
    <?php
        
        
    function showLogin()
        {
            print 
    "<h1>Login</h1>\n";
            print 
    "Bitte gib deinen Loginnamen und das Passwort ein:\n<p>\n";
            print 
    "<form action=\"\" method=\"post\">\n";
            print 
    "<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">\n";
            print 
    "<tr>\n";
            print 
    "\t<td>Login:</td>\n";
            print 
    "\t<td><input type=\"text\" name=\"login\"></td>\n";
            print 
    "</tr>\n";
            print 
    "<tr>\n";
            print 
    "\t<td>Passwort:</td>\n";
            print 
    "\t<td><input type=\"password\" name=\"password\"></td>\n";
            print 
    "</tr>\n";
            print 
    "<tr>\n";
            print 
    "\t<td></td>\n";
            print 
    "\t<td><input type=\"submit\" value=\"enter\"></td>\n";
            print 
    "</tr>\n";
            print 
    "</table>\n";
            print 
    "</form>\n";
        }
        
        
    session_start();
        
        
    $extension explode("."$PHP_SELF);
        
    $ext_count count($extension);
        
    $extension "." $extension[$ext_count-1];
        
        require(
    "config".$extension);
        require(
    "coresql".$extension);
        
        
    $dbconn = new Coresql($db_server$db_database$db_account$db_password);
        
    $corenews_options $dbconn->fetchArray("SELECT * FROM $optionstable");
        
    $close $dbconn->close();
        
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>

        <title>:::[Corenews 2.0.1]</title>

    <style type="text/css">

    //style enfternt, da der thread zu lang war

    </style>

    <script language="JavaScript">
        function confirmdelete(titel, url) 
        {
        if (confirm("Soll '" + titel + "' wirklich gelöscht werden?")) 
            parent.location.href = url; 
        }
        
        function Preview()
        {
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.target = "preview";
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.mode.value = "preview";
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.action = "preview<?php print $extension?>";
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.submit();
        }
        
        function Save()
        {
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.target = "_self";
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.mode.value = "save";
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.action = "<?php print "?show=$show"?>";
            document.forms.<?php if ((isset($show)) && ($show != "")) { print $show; } else { print "fnord"; }?>.submit();
        }
    </script>

    </head>

    <body scroll="auto" bgcolor="#E5E5E5">

    <table border="0" width="580" height="500" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
    <tr>
        <td height="30" bgcolor="#000000"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="30"></td>
        <td height="30">
            <div align="center">
                [<a href="?show=postnews">News posten</a>]
                [<a href="?show=editdeletenews">News editieren / löschen</a>]
                [<a href="?show=adminusers">User verwalten</a>]
                [<a href="?show=adminicons">Icons verwalten</a>]
                [<a href="?show=admincomments">Kommentare</a>]
                [<a href="?show=adminstyles">Styles</a>]
                [<a href="?show=options">Einstellungen</a>]
                [<a href="?show=news">Neuigkeiten</a>]
                [<a href="?show=logout">Logout</a>]
            </div>
        </td>
        <td height="30"></td>
        <td height="30"><img src="gfx/pixel.gif" width="1" height="1"></td>
    </tr>

    <tr>
        <td height="388"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="388"></td>
        <td height="388" valign="top">
            
            <?php
                
    if ((isset($login)) && (isset($password))) {
                    
                    
    $dbconn = new Coresql($db_server$db_database$db_account$db_password);
                    
    $user $dbconn->fetchArray("SELECT * FROM $usertable WHERE login = '$login'");
                    
    $close $dbconn->close();
                    
                    if ((
    $login == $user[login]) && (md5($password) == $user[password])) {
                        
                        if ((!
    session_is_registered("login")) && (!session_is_registered("password"))) {
                            
    session_register("login");
                            
    session_register("password");
                        }
                        
                        
    $filename $show $extension;
                        if ((isset(
    $show)) && ($show != "")) {
                            include(
    $filename);
                        } else {
                            include(
    "menu" $extension);
                        }
                        
                    } else {
                        
    showLogin();
                        print 
    "<h1>Login / Passwort falsch!</h1>\n";
                    }
                } else {
                    
    showLogin();
                }
            
    ?>
            
        </td>
        <td height="388"></td>
        <td height="388"><img src="gfx/pixel.gif" width="1" height="1"></td>
    </tr>
    <tr>
        <td height="10"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="10"></td>
        <td height="10"></td>
        <td height="10"></td>
        <td height="10"><img src="gfx/pixel.gif" width="1" height="1"></td>
    </tr>
    <tr>
        <td height="1"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="1"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="1"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="1"><img src="gfx/pixel.gif" width="1" height="1"></td>
        <td height="1"><img src="gfx/pixel.gif" width="1" height="1"></td>
    </tr>
    </table>

    </body>
    </html>

    meine Frage bezieht sich eher auf die session, die beim Loginscript gestartet wird, ich möchte, dass wenn man nach dem login des Loginscriptes auf die adminpage des corenews2 scriptes geht, dass man dort schon eingeloggt ist.

    würde mich auf einen fertigen code freuen, aber ein Tipp würde es auch machen

    mfg ernstaugust
Lädt...
X