Hej Udvikleren jeg har ledt og ledt efter et dansk forum for udviklere og har virkelig brug for hjælp med den her kode, jeg er kørt helt død i den og forstår ikke hvad der er galt med den.
fejlen består i at den åbner den åbner database delen, når man så indsætter data i den og trykker insert går den tilbage til database delen
http://www.ank.vacau.com/install.php- <?php
- session_start();
- //laver to variabler med værdien session
- $ses_connect = $_SESSION['connect'];
- $ses_settings = $_SESSION['settings'];
- $custom = $_SESSION['custom'];
- $user = $_SESSION['account'];
- $details = $_SESSION['details'];
-
-
-
- if (isset($_POST['connect'])) {
- $host = $_POST['db_host'];
- $user = $_POST['db_user'];
- $passwd = $_POST['db_pass'];
- $db = $_POST['db'];
-
- //variablerne bliver brugt her til at rette i databasen.
- $ret = mysql_connect($host, $user, $passwd); // Forsøger at få login på mysql
- if (!$ret) {
- die("Could not connect to the database: " . mysql_error()); // Login fejlede
- } else {
- //Login oprettet
- $dbselect=mysql_select_db($db, $ret); // Forsøger at forbinde til databasen
- if (!$dbselect) {
- die("Could not connect to the database: " . mysql_error()); //Forbindelse fejlede
- }else{
- $handle1 = fopen( "include/config.php", "r"); // Åbner og læser config.php
- while($fileData1 = fgets($handle1, 1024)) {
- $filedata .= $fileData1;
- }
- fclose($handle1); // Lukker filen
-
- $filedata = str_replace('[HOST]', $host, $filedata);
- $filedata = str_replace('[USER]', $user, $filedata);
- $filedata = str_replace('[PASSWD]', $passwd, $filedata);
- $filedata = str_replace('[DB]', $db, $filedata);
-
- $handle = fopen( "include/config.php", "w"); // Åbner og skriver config.php
- fwrite($handle, $filedata); // Gemmer ændringer
- fclose($handle); // Lukker filen
-
- $msg = "Connection established.\\n"; //Forbindelse ok
- $_SESSION['connect'] = 1;
- $msg .= "Installing information in `config.php`.\\n";
- $msg .= "Installation complete.\\n";
- $msg2 = "<script language=\"javascript\" type=\"text/javascript\">alert('".$msg."');location.href=\"install.php\";</script>\n";
- }
- }
- }
-
- if (isset($_POST['user'])) {
- $username = $_POST['username'];
- $password = sha1($_POST['password']);
- include('include/config.php');
-
- $ret = mysql_connect($db_host, $db_user, $db_code); // Forsøger at få login på mysql
- $sql = 'DROP TABLE IF EXISTS `members`'; // Sletter members hvis den findes
- mysql_query( $sql, $ret );
-
- $sql = "CREATE TABLE `members` (
- `id` int(8) NOT NULL auto_increment,
- `username` varchar(100) NOT NULL default '',
- `password` varchar(100) NOT NULL default '',
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=21 ;";
- $msg = "Opretter table: `Members`....\\n";
- mysql_query( $sql, $ret ); // Opretter sb_jokesystem
- $sql="INSERT INTO `members` VALUES (1, '$username', '$password');";
- mysql_query( $sql, $ret ) or die (mysql_error());
- $msg .= "Inserting you data to `Members`....\\n";
- $_SESSION['user'] = 1;
- $_SESSION['connect'] = "";
-
- }
-
-
- if (isset($_POST['install'])) {
- $author = $_POST['author'];
- $descr = $_POST['description'];
- $web = $_POST['website'];
- $lang = $_POST['lang'];
- $mail = $_POST['mail'];
- include('include/config.php');
-
- $ret = mysql_connect($db_host, $db_user, $db_code); // Forsøger at få login på mysql
- $sql = 'DROP TABLE IF EXISTS `details`'; // Sletter members hvis den findes
- mysql_query( $sql, $ret );
-
- $sql = "CREATE TABLE `details` (
- `id` int(11) NOT NULL auto_increment,
- `author` varchar(255) NOT NULL,
- `description` varchar(255) NOT NULL,
- `website` varchar(255) NOT NULL,
- `language` varchar(255) NOT NULL,
- `email` varchar(255) NOT NULL,
- PRIMARY KEY (`id`),
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;";
-
- $msg = "Creating table: `details`....\\n";
- mysql_query( $sql, $ret ); // Opretter details
-
- if ($style == 1) {
- $_SESSION['custom'] = 1;
- $_SESSION['user'] = "";
- } else {
- $_SESSION['ses_settings'] = 1;
- $_SESSION['user'] = "";
- }
- }
-
- if (isset($_POST['custom'])) {
- $visibility = $_POST['visibility'];
-
-
-
-
-
-
-
- $handle1 = fopen( "include/config.php", "r"); // Åbner og læser config.php
- while($fileData1 = fgets($handle1, 1024)) {
- $filedata .= $fileData1;
- }
- fclose($handle1); // Lukker filen
-
- $filedata = str_replace('[table]', $row1, $filedata);
- $filedata = str_replace('[menu]', $row2, $filedata);
- $filedata = str_replace('[visibility]', $visibility, $filedata);
- // $filedata = str_replace('[bg]', $bg, $filedata);
- $handle = fopen( "include/config.php", "w"); // Åbner og skriver config.php
- fwrite($handle, $filedata); // Gemmer ændringer
- fclose($handle); // Lukker filen
-
- $msg .= "Installing data in `config.php`.\\n";
- $msg .= "Installation complete.\\n";
- $_SESSION['settings'] = 1;
- $_SESSION['connect'] = "";
- $msg2 = "<script language=\"javascript\" type=\"text/javascript\">alert('".$msg."');location.href=\"install.php\";</script>\n";
-
- }
- ?>
- <html>
- <head>
- <title>Flaashing's Blog install v1</title>
- <style>
- body, table, input, textarea, select
- {
- background-color: #FFFFFF;
- color: #000000;
- font-size: 11px;
- font-family: Verdana;
- }
- a:link, a:visited, a:active
- {
- font-family: Verdana;
- font-size: 11px;
- text-decoration: none;
- color: #000000;
- }
- a:hover
- {
- font-family: Verdana;
- font-size: 11px;
- text-decoration: none;
- color: #FF0000;
- }
- </style>
- <script language="javascript">
- function showEks(row) {
- color = document.getElementById('v'+row).value;
- document.getElementById(row).style.background = color;
- }
- </script>
- </head>
-
- <body>
- <!--DATABASE OPTIONS-->
-
- <?php
- print $msg2;
- if (empty($ses_connect) && empty($ses_settings) && empty($custom) && empty($user)) {
- ?>
- <form name="connecter" method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
- <table width="500px" align="center" cellpadding="2" cellspacing="0" style="border-right: 1px solid #6699FF;border-left: 1px solid #6699FF;border-bottom: 1px solid #6699FF;">
- <tr bgcolor="#6699FF">
- <td width="200px" height="40px"><font size="4" color="#FFFFFF">Database info!</font></td><td width="300px"> </td>
- </tr>
- <tr>
- <td>HOST</td><td><input type="text" name="db_host" value="localhost" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Username</td><td><input type="text" name="db_user" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Password</td><td><input type="password" name="db_pass" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Database</td><td><input type="text" name="db" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td> </td><td><input type="submit" name="connect" value="Connect" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- </table>
- <?php
- }
- if ($ses_connect == 1) {
- ?>
- <!--ACCOUNT DETAILS-->
- <form name="account" method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
- <table width="500px" align="center" cellpadding="2" cellspacing="0" style="border-right: 1px solid #6699FF;border-left: 1px solid #6699FF;border-bottom: 1px solid #6699FF;">
- <tr bgcolor="#6699FF">
- <td width="200px" height="40px"><font size="4" color="#FFFFFF">Account details(<a href="#" onClick="alert('Account:\nThe account details are for the blogger, so you can log in and write blogs. \n the link to login is in the bottom of everysite, in the copyright string.');">?</a>)</font></td><td width="300px"> </td>
- </tr>
- <tr>
- <td>Username</td><td><input type="text" name="username" value="username" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Password</td><td><input type="text" name="password" value="password" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td><td><input type="radio" name="account" value="1" checked="checked"></td>
- </tr>
- <tr>
- <td> </td><td><input type="submit" name="user" value="Connect" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- </table>
-
- <?php
- }
- if ($user == 1) {
- ?>
- <!--WEBSITE DETAILS-->
- <form name="details" method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
- <table width="500px" align="center" cellpadding="2" cellspacing="0" style="border-right: 1px solid #6699FF;border-left: 1px solid #6699FF;border-bottom: 1px solid #6699FF;">
- <tr bgcolor="#6699FF">
- <td width="200px" height="40px"><font size="4" color="#FFFFFF">Details About your site.</font></td><td width="300px"> </td>
- </tr>
- <tr>
- <td>Author(<a href="#" onClick="alert('Author:\nWho owns, runs, writes in this blog? write your name or nickname! \nthis will be shown under all you blogs. ');">?</a>)</td><td><input type="text" name="author" value="Webmaster" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Description(<a href="#" onClick="alert('Description:\nThis is used for meta tags and to the RSS feed.\n Just write what you are going to blog about!');">?</a>)</td><td><input type="text" name="description" width="100px" height="100px" value="eksample: This is my blog, where i will write about my family whats going on in my life and how i feel about diffrent things." style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Website URL</td><td><input type="text" name="website" value="yoursite.com" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Language(<a href="#" onClick="alert('Language:\nChoose between:\'\nen-us and dk, \nOBS! \nif you dont know what this is just leave it as it is!');">?</a>)</td><td><input type="text" name="lang" value="en-us" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Email</td><td><input type="text" name="mail" value="webmaster@yoursite.com" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- <tr>
- <td>Do you wanna style your site?(<a href="#" onClick="alert('Style:\nIf you want to deside what colour your site should have mark the button\'yes\'\n\nOBS! \nyou can edit this anytime in the database!');">?</a>)</td><td><input type="radio" name="style" value="1" checked="checked"> Yes <input type="radio" name="style" value="0"> No</td>
- </tr>
- <tr>
- <td> </td><td><input type="submit" name="install" value="Connect" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- </table>
-
- <?php
- }
- if ($custom == 1) {
- ?>
- <!-- STYLING DETAILS-->
- <form name="styling" method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
- <table width="500px" align="center" cellpadding="2" cellspacing="0" style="border-right: 1px solid #6699FF;border-left: 1px solid #6699FF;border-bottom: 1px solid #6699FF;">
- <tr bgcolor="#6699FF">
- <td width="200px" height="40px"><font size="4" color="#FFFFFF">Installation!</font></td><td width="300px"> </td>
- </tr>
- <tr>
- <td> </td><td><b>Details</b></td>
- </tr>
- <tr style="background:#FFFFFF">
- <td>Table visibility(<a href="#" onClick="alert('visibility:\n The body is semi-transparrent, if you want the site to be 100% your color type 100%\n if you want the users to see the bg picture through the body type any %\n <b>IMPORTANT</b>\n dont type any nuber above 100!');">?</a>)</td><td><input type="text" name="visibility" style="border: 1px solid;border-color: #000000;" value="#FFFFFF" maxlength="3"></td>
- </tr>
- <tr>
- <td> </td><td><b>Color</b></td>
- </tr>
- <tr id="row1" style="background:#FFFFFF">
- <td>Bg color</td><td><input type="text" name="row1" id="vrow1" style="border: 1px solid;border-color: #000000;" value="#FFFFFF" maxlength="7" onKeyUp="showEks('row1');"></td>
- </tr>
- <tr id="row2" style="background:#CCCCCC">
- <td>menu color</td><td><input type="text" name="row2" id="vrow2" style="border: 1px solid;border-color: #000000;" value="#CCCCCC" maxlength="7" onKeyUp="showEks('row2');"></td>
- </tr>
- <tr>
- <td> </td><td><input type="submit" name="custom" value="Install" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- </table>
-
- <?php
- }
- if ($ses_settings == 1) {
- ?>
- <!--FINISH-->
- <form name="details" method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
- <table width="500px" align="center" cellpadding="2" cellspacing="0" style="border-right: 1px solid #6699FF;border-left: 1px solid #6699FF;border-bottom: 1px solid #6699FF;">
- <tr bgcolor="#6699FF">
- <td width="500px" height="40px"><font size="4" color="#FFFFFF">Install complete!</font></td>
- </tr>
- <tr>
- <td>
- <b>Congratulations!</b><br />
- <br />
- Flashing's Blog system have been installed correctly.
- <br />
- <br />
- Following files are required for this Blog system to run correctly:<br>
- <ul>
-
- <li>blogs.php</li>
- <li>check.php</li>
- <li>feed.php</li>
- <li>header.php</li>
- <li>index.php</li>
- <li>install.php</li>
- <li>login.php</li>
- <li>logout.php</li>
- <li>opret.php</li>
- <li>rediger.php</li>
- <li>slet_alt.php</li>
- <li>slet_indlaeg.php</li>
- <li>sucess.php</li>
- <li>/include/</li>
- <li>/include/config.php</li>
- <li>/include/bg.jpg</li>
- <li>/include/style.css</li>
- <li>/include/chromestyle.css</li>
- <li>/include/logo.jpg</li>
- </ul>
- Slet eller omdøb venligst filen `install.php`.<br />
- <br />
- Fejerskov.hostei.com og Anders Fejerskov er de eneste der har rettigheder til at lægge dette system til download.<br />
- <br />
- Ellers må du gerne bruge mit system så meget du vil ;).<br />
- <div align="right">©<a href="http://rowl.dk/User/261" target="_blank">Stefan Bols</a> - <a href="http://facebook.com/iBols" target="_blank">Facebook: Stefan Bols</a></div>
- </td>
- </tr>
- <tr>
- <td><input type="button" onClick="location.href='index.php'" value="Færdig" style="border: 1px solid;border-color: #000000;"></td>
- </tr>
- </table>
- <?php
- }
- session_destroy();
- ?>
- </form>
- </body>
- </html>
Indlæg senest redigeret d. 09.06.2011 10:24 af Bruger #16660