Moin, nu kann ich mal Helfen ^^
Hab da ein Script gefunden, der hier auch gehen müsste:
Dieser Script leuf,t na, wie soll es wohl am besten sein? Genau, über eine SQL Datenbank ^^’
Vorraussetzung:
[ul]
SQL Datenbank
PHP 4 oder höher
Wildcard[/ul]
SQL Befehl:
CREATE TABLE `pp_subdomain` (
`subdomainID` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT ,
`subdomain` VARCHAR( 120 ) NOT NULL ,
`destination` VARCHAR( 255 ) NOT NULL ,
`comment` VARCHAR( 180 ) NOT NULL ,
PRIMARY KEY ( `subdomainID` ),
UNIQUE KEY `subdomain` (`subdomain`)
) TYPE = MYISAM COMMENT = 'unbegrenzt Subdomains mit pp_subdomain von http://www.philipweb.de'
Die Datei mit dem Script solte index.php heißen.
Und hier der php Code:[code]
<?php
$cfg = array();
/* --- Einstellungen ----------- */
$cfg['server'] = "localhost"; // MySQL-Server
$cfg['username'] = "username"; // MySQL-Username
$cfg['password'] = "password"; // MySQL-Passwort
$cfg['database'] = "database"; // MySQL-Datenbank
$cfg['standard'] = "http://www.domain.tld/"; // Standardziel
/* --- hier nichts mehr ändern - */
/* --- MySQL-Verbindung -------- */
@mysql_connect ( $cfg['server'], $cfg['username'], $cfg['password'] )
or die ( "
Keine Verbindung zum MySQL-Server!
\n#".mysql_errno().": ".mysql_error()."" );
@mysql_select_db ( $cfg['database'] )
or die ( "
Konnte Datenbank nicht auswählen!
\n#".mysql_errno().": ".mysql_error()."" );
/* --- URL-Zerlegung ----------- */
list ( $sub, , ) = explode ( ".", $_SERVER['HTTP_HOST'] );
/* --- Daten holen ------------- */
$sql = mysql_query ( "SELECT * FROM pp_subdomain WHERE subdomain = '".addslashes($sub)."'" );
$row = mysql_fetch_array ( $sql );
if ( $row['destination'] == "" ) $row['destination'] = $cfg['standard'];
if ( strpos ( $row['destination'], "http://" ) === false ) $row['destination'] = $cfg['standard'] . $row['destination'];
/* --- Weiterleitung ----------- */
mysql_close();
header ( "location: ".$row['destination']."" );
exit();
?>
[/code]
Zum Schluss die Anleitung:
[quote]<?php
/********************************************************
*
- pp_subdomain 0.1
- © 2003 - 2007 Philip Pötsch
- pcoding.com
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of
- the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- MA 02111-1307, USA.
-
-
- Readme - Installationsanleitung (2 Minuten)
-
-
- Über phpMyAdmin SQL befehl ausführen.
-
- Neue Subdomains über phpMyAdmin in die erzeugte
- Tabelle einfügen.
-
- Eine Wildcard-Subdomain (*.domain.tld) erzeugen und auf
- diese Datei bzw. den Ordner, in der sich diese Datei befindet,
- umleiten. (Hier nicht nötig, wen die Datei im Hauptverzeichniss ist)
-
- MySQL-Zugangsdaten in dieser Datei und Standardziel festlegen.
- Sollte eine Subdomain nicht verfügbar sein, wird auf dieses
- weitergeleitet (hier: domain.tld).
- Soll außerdem auf einen Unterordner von domain.tld weitergeleitet
- werden, muss der Pfad erst oberhalb davon in die SQL-Tabelle geschrieben
- werden. Beispiel: auf domain.tld/test/mich/ soll weiter-
- geleitet werden. In die Tabelle muss als „destination“ nur noch
- „test/mich/“ eingegeben werden.
-
- Fertig.
-
********************************************************/
[/quote]
Vom wehm der Script ist, steht in der Anleitung trin ^^
Er bietet diesen Script zum Download an.
Hier noch einmal der Link
http://www.philipweb.de/webdesign.html
Und dort nach
suchen.
Gruß, Kaey