Drivers Profiel maken

Status
Niet open voor verdere reacties.
Ja allemaal gedaan, het probleem zit echt in het script.
De standaard werkt gewoon, alleen de aangepaste versie met meer vragen werkt gewoon niet.

Ik denk dat het te maken heeft me de extra formulier items, die jij hebt toegevoegd.
daar zit hem de fout in.
Het ligt niet aan de server want als ik de standaard script over de jouwe script heen zet in ik upload de php dan werkt hij helemaal.
 
Laatst bewerkt door een moderator:
oke dan proberen we het stap voor stap.
ik zal eerst 3 velden doen daarna uitbreiden met 2.
work in progress.
I'll let u know ;)

Byee VRC
 
Laatst bewerkt door een moderator:
oke probeer dit script

PHP:
<?php
	# You must set this correctly to a
	# location where you are allowed to
	# create a file! 
	$guestbook = 'guestbook.dat';
	# Choose your own password
	$adminPassword = 'test123';
        # Hide harmless warning messages that confuse users.
        # If you have problems and you don't know why,
        # comment this line out for a while to get more
        # information from PHP
        error_reporting (E_ALL ^ (E_NOTICE | E_WARNING));

	# No changes required below here

	$admin = 0;
	if ($adminPassword == 'CHANGEME') {
		die("You need to change \$adminPassword first.");
	}

	# Undo magic quotes - useless for flat files,
	# and inadequate and therefore dangerous for databases. See:
	# http://www.boutell.com/newfaq/creating/magicquotes.html
	
	function stripslashes_nested($v)
	{
		if (is_array($v)) {
			return array_map('stripslashes_nested', $v);
		} else {
			return stripslashes($v);
		}
	}

	if (get_magic_quotes_gpc()) {
		$_GET = stripslashes_nested($_GET);
		$_POST = stripslashes_nested($_POST);
	}
?>
<html>
<head>
<title>Rally drivers profile page</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style3 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<h1 align="center" class="style1">Rally drivers profile page</h1>
<div align="center">
<?php
	$password = "";
	if ($_POST['password'] == $adminPassword) {
		$admin = 1;
		$password = $adminPassword;
	} else if (strlen($_POST['password'])) {
		echo("<h2>Login Failed (Bad Password)</h2>\n");
	}
?>	
<table width="600" border="1" cellpadding="3" cellspacing="3">
<tr>

		<th>
			<span class="style1">Name driver</span>
		</th>
		<th>
			<span class="style1">Since</span>
		</th>
		<th>
			<span class="style1">Country</span>
		</th>
		<!--
		<th>
			<span class="style1">Co drivers</span>
		</th>
		<th>
			<span class="style1">Latest rally car</span>
		</th>
		-->
<?php
	if ($admin) {
		echo "<th>Controls</th>";
	}
?>
</tr>
<?php
	if ($_POST['submit']) {
		$file = fopen($guestbook, "a");
		if (!$file) {
			die("Can't write to guestbook file");
		}
		$date = date('j-m-Y G:i:s');
		$id = rand();
		
		$driverName = $_POST['driverName'];
		$since = $_POST['since'];
		$country = $_POST['country'];
		//$coDrivers = $_POST['coDrivers']; 
		//$latestRallyCar = $_POST['latestRallyCar']; 
		
		$driverName = clean($driverName, 40);
		$since = clean($since, 40);
		$country = clean($country, 40);
		//$coDrivers = clean($coDrivers, 40);
		//$latestRallyCar = clean($latestRallyCar, 40);
		
		//fwrite($file, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$id\n");
		fwrite($file, "$date\t$driverName\t$since\t$country\t$id\n");
		fclose($file);	
	}
	$file = fopen($guestbook, 'r');
	$tfile = null;
	$delete = 0;
	$deleteId = '';
	if ($admin && $_POST['delete']) {
		$delete = 1;
		$deleteId = $_POST['id'];
		$tfile = @fopen("$guestbook.tmp", 'w');
		if (!$tfile) {
			die("Can't create temporary file for delete operation");
		}
	}
	if ($file) {
		while (!feof($file)) {
			$line = fgets($file);
			$line = trim($line);
			//list ($date, $driverName, $since, $country, $coDrivers, $latestRallyCar, $id) = 
			list ($date, $driverName, $since, $country, $id) = 
				split("\t", $line, 7);
			if (!strlen($date)) {
				break;
			}
			if (!strlen($id)) {
				// Support my old version
				$id = $date;
			}	
			if ($delete) {
				if ($id == $deleteId) {
					continue;
				} else {
					//fwrite($tfile, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$id\n");
					fwrite($tfile, "$date\t$driverName\t$since\t$country\t$id\n");
				}
			}
			echo "<tr>";
			echo "<td> 	$driverName 	</td>";
			echo "<td> 	$since 			</td>";
			echo "<td> 	$country 		</td>"; 
			//echo "<td>	$coDrivers		</td>";
			//echo "<td>	$latestRallyCar	</td>";
			
			if ($admin) {
				echo "<td>";
				echo "<form action=\"guestbook.php\" " .
					"method=\"POST\">";
				passwordField();
				hiddenField('id', $id);
				echo "<input type=\"submit\" " .
					"value=\"Delete\" " .
					"name=\"delete\">";
				echo "</form>";
				echo "</td>";
			}
			echo "</tr>\n";
		}
		fclose($file);
		if ($delete) {
			fclose($tfile);
			unlink($guestbook);
			rename("$guestbook.tmp", $guestbook);
		}	
	}
	function clean($name, $max) {
		# Turn tabs and CRs into spaces so they can't 
		# fake other fields or extra entries
		$name = ereg_replace("[[:space:]]", ' ', $name);
		# Escape < > and and & so they 
		# can't mess withour HTML markup
		$name = ereg_replace('&', '&amp;', $name);
		$name = ereg_replace('<', '&lt;', $name);
		$name = ereg_replace('>', '&gt;', $name);
		# Don't allow excessively long entries
		$name = substr($name, 0, $max);
		# Undo PHP's "magic quotes" feature, which has
		# inserted a \ in front of any " characters.
		# We undo this because we're using a file, not a
		# database, so we don't want " escaped. Those
		# using databases should do the opposite:
		# call addslashes if get_magic_quotes_gpc()
		# returns false.
		return $name;
	}
	function passwordField() {
		global $admin;
		global $password;
		if (!$admin) {
			return;
		}
		hiddenField('password', $password);
	}
	function hiddenField($name, $value) {
		echo "<input type=\"hidden\" " .
			"name=\"$name\" value=\"$value\">";
	}
?>
</table>
<?php
	if (!$admin) {
?>
<form action="guestbook.php" method="POST">
<span class="style3">Admin Login</span>
<br>
<input type="password" name="password">
<input type="submit" name="login" value="Log In">
</form>
<?php
	}
?>
<form action="guestbook.php" method="POST">
<table width="600" border="0" cellpadding="5" cellspacing="5">
<tr>
<th>Name driver</th><td><input id="driverName" name="driverName" maxlength="40"></td>
</tr>
<tr>
<th>Since</th><td><input id="since" name="since" maxlength="40"></td>
</tr>
<tr>
<th>Country</th><td><input id="country" name="country" maxlength="40"></td>
</tr>
<tr>
<th>Co drivers</th><td><input disabled="true" id="coDrivers" name="coDrivers" maxlength="40"></td>
</tr>
<tr>
<th>Latest rally car</th><td><input disabled="true" id="latestRallyCar" name="latestRallyCar" maxlength="40"></td>
</tr>
<tr>
<th colspan="2">
<input type="submit" name="submit" value="Voeg profiel toe / Add profile">
</th>
</tr>
</table>
<?php
	passwordField();
?>
</form>
</div>
</body>
</html>
 
try this.
1 uitbreiding
PHP:
<?php
	# You must set this correctly to a
	# location where you are allowed to
	# create a file! 
	$guestbook = 'guestbook.dat';
	# Choose your own password
	$adminPassword = 'test123';
        # Hide harmless warning messages that confuse users.
        # If you have problems and you don't know why,
        # comment this line out for a while to get more
        # information from PHP
        error_reporting (E_ALL ^ (E_NOTICE | E_WARNING));

	# No changes required below here

	$admin = 0;
	if ($adminPassword == 'CHANGEME') {
		die("You need to change \$adminPassword first.");
	}

	# Undo magic quotes - useless for flat files,
	# and inadequate and therefore dangerous for databases. See:
	# http://www.boutell.com/newfaq/creating/magicquotes.html
	
	function stripslashes_nested($v)
	{
		if (is_array($v)) {
			return array_map('stripslashes_nested', $v);
		} else {
			return stripslashes($v);
		}
	}

	if (get_magic_quotes_gpc()) {
		$_GET = stripslashes_nested($_GET);
		$_POST = stripslashes_nested($_POST);
	}
?>
<html>
<head>
<title>Rally drivers profile page</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style3 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9px;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<h1 align="center" class="style1">Rally drivers profile page</h1>
<div align="center">
<?php
	$password = "";
	if ($_POST['password'] == $adminPassword) {
		$admin = 1;
		$password = $adminPassword;
	} else if (strlen($_POST['password'])) {
		echo("<h2>Login Failed (Bad Password)</h2>\n");
	}
?>	
<table width="600" border="1" cellpadding="3" cellspacing="3">
<tr>

		<th>
			<span class="style1">Name driver</span>
		</th>
		<th>
			<span class="style1">Since</span>
		</th>
		<th>
			<span class="style1">Country</span>
		</th>
		<th>
			<span class="style1">Co drivers</span>
		</th>
		<!--
		<th>
			<span class="style1">Latest rally car</span>
		</th>
		-->
<?php
	if ($admin) {
		echo "<th>Controls</th>";
	}
?>
</tr>
<?php
	if ($_POST['submit']) {
		$file = fopen($guestbook, "a");
		if (!$file) {
			die("Can't write to guestbook file");
		}
		$date = date('j-m-Y G:i:s');
		$id = rand();
		
		$driverName = $_POST['driverName'];
		$since = $_POST['since'];
		$country = $_POST['country'];
		$coDrivers = $_POST['coDrivers']; 
		//$latestRallyCar = $_POST['latestRallyCar']; 
		
		$driverName = clean($driverName, 40);
		$since = clean($since, 40);
		$country = clean($country, 40);
		$coDrivers = clean($coDrivers, 40);
		//$latestRallyCar = clean($latestRallyCar, 40);
		
		//fwrite($file, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$id\n");
		fwrite($file, "$date\t$driverName\t$since\t$country\t$coDrivers\t$id\n");
		fclose($file);	
	}
	$file = fopen($guestbook, 'r');
	$tfile = null;
	$delete = 0;
	$deleteId = '';
	if ($admin && $_POST['delete']) {
		$delete = 1;
		$deleteId = $_POST['id'];
		$tfile = @fopen("$guestbook.tmp", 'w');
		if (!$tfile) {
			die("Can't create temporary file for delete operation");
		}
	}
	if ($file) {
		while (!feof($file)) {
			$line = fgets($file);
			$line = trim($line);
			//list ($date, $driverName, $since, $country, $coDrivers, $latestRallyCar, $id) = 
			list ($date, $driverName, $since, $country, $coDrivers, $id) = 
				split("\t", $line, 7);
			if (!strlen($date)) {
				break;
			}
			if (!strlen($id)) {
				// Support my old version
				$id = $date;
			}	
			if ($delete) {
				if ($id == $deleteId) {
					continue;
				} else {
					//fwrite($tfile, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$id\n");
					fwrite($tfile, "$date\t$driverName\t$since\t$country\t$coDrivers\t$id\n");
				}
			}
			echo "<tr>";
			echo "<td> 	$driverName 	</td>";
			echo "<td> 	$since 			</td>";
			echo "<td> 	$country 		</td>"; 
			echo "<td>	$coDrivers		</td>";
			//echo "<td>	$latestRallyCar	</td>";
			
			if ($admin) {
				echo "<td>";
				echo "<form action=\"guestbook.php\" " .
					"method=\"POST\">";
				passwordField();
				hiddenField('id', $id);
				echo "<input type=\"submit\" " .
					"value=\"Delete\" " .
					"name=\"delete\">";
				echo "</form>";
				echo "</td>";
			}
			echo "</tr>\n";
		}
		fclose($file);
		if ($delete) {
			fclose($tfile);
			unlink($guestbook);
			rename("$guestbook.tmp", $guestbook);
		}	
	}
	function clean($name, $max) {
		# Turn tabs and CRs into spaces so they can't 
		# fake other fields or extra entries
		$name = ereg_replace("[[:space:]]", ' ', $name);
		# Escape < > and and & so they 
		# can't mess withour HTML markup
		$name = ereg_replace('&', '&amp;', $name);
		$name = ereg_replace('<', '&lt;', $name);
		$name = ereg_replace('>', '&gt;', $name);
		# Don't allow excessively long entries
		$name = substr($name, 0, $max);
		# Undo PHP's "magic quotes" feature, which has
		# inserted a \ in front of any " characters.
		# We undo this because we're using a file, not a
		# database, so we don't want " escaped. Those
		# using databases should do the opposite:
		# call addslashes if get_magic_quotes_gpc()
		# returns false.
		return $name;
	}
	function passwordField() {
		global $admin;
		global $password;
		if (!$admin) {
			return;
		}
		hiddenField('password', $password);
	}
	function hiddenField($name, $value) {
		echo "<input type=\"hidden\" " .
			"name=\"$name\" value=\"$value\">";
	}
?>
</table>
<?php
	if (!$admin) {
?>
<form action="guestbook.php" method="POST">
<span class="style3">Admin Login</span>
<br>
<input type="password" name="password">
<input type="submit" name="login" value="Log In">
</form>
<?php
	}
?>
<form action="guestbook.php" method="POST">
<table width="600" border="0" cellpadding="5" cellspacing="5">
<tr>
<th>Name driver</th><td><input id="driverName" name="driverName" maxlength="40"></td>
</tr>
<tr>
<th>Since</th><td><input id="since" name="since" maxlength="40"></td>
</tr>
<tr>
<th>Country</th><td><input id="country" name="country" maxlength="40"></td>
</tr>
<tr>
<th>Co drivers</th><td><input id="coDrivers" name="coDrivers" maxlength="40"></td>
</tr>
<tr>
<th>Latest rally car</th><td><input disabled="true" id="latestRallyCar" name="latestRallyCar" maxlength="40"></td>
</tr>
<tr>
<th colspan="2">
<input type="submit" name="submit" value="Voeg profiel toe / Add profile">
</th>
</tr>
</table>
<?php
	passwordField();
?>
</form>
</div>
</body>
</html>
 
Laatst bewerkt door een moderator:
hey,

mooi man!

werkt ook.
kun je die andere ook nog aanpassen?

zou je misschien de vraag ''leeg1'' en ''leeg2'' ook willen aanmaken.
dan kan ik die opzoeken in het script en als ik nog een vraag bedenk hem zo vervangen.

daarna kunnen we misschien nog wat spelen met de opmaak.
 
als alles werkt, moeten we de opmaak veranderen.

ik heb je toen een mail gestuurd met een screen shot.

zo moet hij uiteindelijk eruit komen zien.

Elke invoer moet min om meer een eigen kolom worden.

geen idee of dit werkt maar goed.

zo ziet hij er nog een beetje duf uit.

moet meer informatie in kwijt kunnen.
 
sgoed kzal er later naar kijke.
kga nu ff ete.
kzal meteen opmaak veranderen .

maar eerlijk gezegd heb ik niet veel veranderd met mijn oude volledige script.
alleen variables eruit gegooid dus kvind echt raar. vergelijk de code maar.
maar dit zijn er 4 he.
kijke wat ie bij 5 doet.
iig kfix euhm later voor je. kga nu eten.
probeer jij in tussentijd te fixen dan leer je het ook ;)

byee vrc
 
Laatst bewerkt door een moderator:
Weer een paar scroll wieltjes bespaard door de topic te halveren qua tekst.:rolleyes: Het is niet nodig te citeren als je direct reageert. De topics worden anders zo lang, met dezelfde tekst. Vrijwel elk bericht in deze topic was direct daarna geciteerd.:confused:
 
Weer een paar scroll wieltjes bespaard door de topic te halveren qua tekst.:rolleyes: Het is niet nodig te citeren als je direct reageert. De topics worden anders zo lang, met dezelfde tekst. Vrijwel elk bericht in deze topic was direct daarna geciteerd.:confused:

Sorry crash, we zullen er op letten.
 
http://www.rally-web.nl/Guestbook/guestbook.php
we komen er wel, he nu zelf iets aangepast. Alleen zit die stomme code nu in de laatste kolum... Die moet toch weg kunnen?

misschien heeft dit iets te maken met de \t$id ?

PHP:
<?php
    # You must set this correctly to a
    # location where you are allowed to
    # create a file! 
    $guestbook = 'guestbook.dat';
    # Choose your own password
    $adminPassword = 'test123';
        # Hide harmless warning messages that confuse users.
        # If you have problems and you don't know why,
        # comment this line out for a while to get more
        # information from PHP
        error_reporting (E_ALL ^ (E_NOTICE | E_WARNING));
 
    # No changes required below here
 
    $admin = 0;
    if ($adminPassword == 'CHANGEME') {
        die("You need to change \$adminPassword first.");
    }
 
    # Undo magic quotes - useless for flat files,
    # and inadequate and therefore dangerous for databases. See:
    # http://www.boutell.com/newfaq/creating/magicquotes.html
    
    function stripslashes_nested($v)
    {
        if (is_array($v)) {
            return array_map('stripslashes_nested', $v);
        } else {
            return stripslashes($v);
        }
    }
 
    if (get_magic_quotes_gpc()) {
        $_GET = stripslashes_nested($_GET);
        $_POST = stripslashes_nested($_POST);
    }
?>
<html>
<head>
<title>Rally drivers profile page</title>
<style type="text/css">
<!--
.style1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #FFCC00;
}
.style3 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-weight: bold;
}
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style8 {color: #FFFFFF}
body {
	background-color: #000000;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<h1 align="center" class="style1">Rally drivers profile page</h1>
<div align="center">
<?php
    $password = "";
    if ($_POST['password'] == $adminPassword) {
        $admin = 1;
        $password = $adminPassword;
    } else if (strlen($_POST['password'])) {
        echo("<h2>Login Failed (Bad Password)</h2>\n");
    }
?>  
<table width="800" border="1" cellpadding="3" cellspacing="3" bordercolor="#333333" bgcolor="#FFFFFF">
<tr>
 
        <th bgcolor="#666666">
            <span class="style5">Name driver</span>        </th>
        <th bgcolor="#666666">
            <span class="style5">Since</span>        </th>
        <th bgcolor="#666666">
            <span class="style5">Country</span>        </th>
        <th bgcolor="#666666">
            <span class="style5">Co drivers</span>        </th>
        <th bgcolor="#666666">
            <span class="style5">Latest rally car</span>        </th>
		 <th bgcolor="#666666">
            <span class="style5">Favourite rally</span>        </th>
        
<?php
    if ($admin) {
        echo "<th>Controls</th>";
    }
?>
</tr>
<?php
    if ($_POST['submit']) {
        $file = fopen($guestbook, "a");
        if (!$file) {
            die("Can't write to guestbook file");
        }
        $date = date('j-m-Y G:i:s');
        $id = rand();
        
        $driverName = $_POST['driverName'];
        $since = $_POST['since'];
        $country = $_POST['country'];
        $coDrivers = $_POST['coDrivers']; 
        $latestRallyCar = $_POST['latestRallyCar']; 
		$Favouriterally = $_POST['Favouriterally']; 
        
        $driverName = clean($driverName, 40);
        $since = clean($since, 40);
        $country = clean($country, 40);
        $coDrivers = clean($coDrivers, 40);
        $latestRallyCar = clean($latestRallyCar, 40);
		$Favouriterally = clean($Favouriterally, 40);
        
        fwrite($file, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$Favouriterally\t$id\n");
        //fwrite($file, "$date\t$driverName\t$since\t$country\t$coDrivers\t$Favouriterally\t$id\n");
        fclose($file);  
    }
    $file = fopen($guestbook, 'r');
    $tfile = null;
    $delete = 0;
    $deleteId = '';
    if ($admin && $_POST['delete']) {
        $delete = 1;
        $deleteId = $_POST['id'];
        $tfile = @fopen("$guestbook.tmp", 'w');
        if (!$tfile) {
            die("Can't create temporary file for delete operation");
        }
    }
    if ($file) {
        while (!feof($file)) {
            $line = fgets($file);
            $line = trim($line);
            list ($date, $driverName, $since, $country, $coDrivers, $latestRallyCar, $Favouriterally, $id) = 
            //list ($date, $driverName, $since, $country, $coDrivers, $Favouriterally, $id) = 
                split("\t", $line, 7);
            if (!strlen($date)) {
                break;
            }
            if (!strlen($id)) {
                // Support my old version
                $id = $date;
            }   
            if ($delete) {
                if ($id == $deleteId) {
                    continue;
                } else {
                    fwrite($tfile, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$Favouriterally\t$id\n");
                    //fwrite($tfile, "$date\t$driverName\t$since\t$country\t$coDrivers\t$id\n");
                }
            }
            echo "<tr>";
            echo "<td>  $driverName     </td>";
            echo "<td>  $since          </td>";
            echo "<td>  $country        </td>"; 
            echo "<td>  $coDrivers      </td>";
            echo "<td>  $latestRallyCar </td>";
			echo "<td>  $Favouriterally </td>";
            
            if ($admin) {
                echo "<td>";
                echo "<form action=\"guestbook.php\" " .
                    "method=\"POST\">";
                passwordField();
                hiddenField('id', $id);
                echo "<input type=\"submit\" " .
                    "value=\"Delete\" " .
                    "name=\"delete\">";
                echo "</form>";
                echo "</td>";
            }
            echo "</tr>\n";
        }
        fclose($file);
        if ($delete) {
            fclose($tfile);
            unlink($guestbook);
            rename("$guestbook.tmp", $guestbook);
        }   
    }
    function clean($name, $max) {
        # Turn tabs and CRs into spaces so they can't 
        # fake other fields or extra entries
        $name = ereg_replace("[[:space:]]", ' ', $name);
        # Escape < > and and & so they 
        # can't mess withour HTML markup
        $name = ereg_replace('&', '&amp;', $name);
        $name = ereg_replace('<', '&lt;', $name);
        $name = ereg_replace('>', '&gt;', $name);
        # Don't allow excessively long entries
        $name = substr($name, 0, $max);
        # Undo PHP's "magic quotes" feature, which has
        # inserted a \ in front of any " characters.
        # We undo this because we're using a file, not a
        # database, so we don't want " escaped. Those
        # using databases should do the opposite:
        # call addslashes if get_magic_quotes_gpc()
        # returns false.
        return $name;
    }
    function passwordField() {
        global $admin;
        global $password;
        if (!$admin) {
            return;
        }
        hiddenField('password', $password);
    }
    function hiddenField($name, $value) {
        echo "<input type=\"hidden\" " .
            "name=\"$name\" value=\"$value\">";
    }
?>
</table>
<?php
    if (!$admin) {
?>
<form action="guestbook.php" method="POST" class="style8">
<span class="style3">Admin Login</span>
<br>
<input type="password" name="password">
<input type="submit" name="login" value="Log In">
</form>
<?php
    }
?>
<form action="guestbook.php" method="POST">
<table width="600" border="0" cellpadding="5" cellspacing="5">
<tr>
<th bgcolor="#666666"><span class="style8">Name driver</span></th>
<td><input id="driverName" name="driverName" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Since</span></th>
<td><input id="since" name="since" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Country</span></th>
<td><input id="country" name="country" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Co drivers</span></th>
<td><input id="coDrivers" name="coDrivers" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Latest rally car</span></th>
<td><input id="latestRallyCar" name="latestRallyCar" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Favourite rally</span></th>
<td><input id="Favouriterally" name="Favouriterally" maxlength="40"></td>
</tr>
<tr bgcolor="#666666">
<th colspan="2">
<input name="submit" type="submit" value="Voeg profiel toe / Add profile"></th>
</tr>
</table>
<?php
    passwordField();
?>
</form>
</div>
</body>
</html>
 
Laatst bewerkt:
oke ik heb ernaar gekeken.
khad beetje afgelopen dagen druk maarre in je laatste script van 8 april 2010 20:55 zit geen bug(met datums enz..) die ik zie op je site
enigste wat je voor de bug(id in laatste kolom) moet veranderen is dit(regel 139 bij de list)

oude code
PHP:
split("\t", $line, 7);

nieuwe code
PHP:
split("\t", $line, 8);

dat is voor de bug. ik zal nu je opmaak veranderen zoals in je mail en deze krijg je bij de nieuwe post. work in progress again ;)
 
Laatst bewerkt:
Voila.
code aangepast + opgeschoond.
brackets verplaatst en lege regels geplaatst voor leesbaarheid.
jouw spans verwijderd en css verwijzing in td gezet.
waarom je zoveel classes hebt in je css hebt weet ik niet.
kzou aanraden duidelijke namen te geven.
style 6 aangemaakt.
style 5 width toegevoegd.

PHP:
<?php
    $guestbook = 'guestbook.dat';
    $adminPassword = 'test123';
	$admin = 0;
	
	error_reporting (E_ALL ^ (E_NOTICE | E_WARNING));
 
    function stripslashes_nested($v)
    {
        if (is_array($v)) 
		{
            return array_map('stripslashes_nested', $v);
        } 
		else 
		{
            return stripslashes($v);
        }
    }
 
    if (get_magic_quotes_gpc()) 
	{
        $_GET = stripslashes_nested($_GET);
        $_POST = stripslashes_nested($_POST);
    }
	
	function clean($name, $max) 
	{
        # Turn tabs and CRs into spaces so they can't 
        # fake other fields or extra entries
        $name = ereg_replace("[[:space:]]", ' ', $name);
        # Escape < > and and & so they 
        # can't mess withour HTML markup
        $name = ereg_replace('&', '&amp;', $name);
        $name = ereg_replace('<', '&lt;', $name);
        $name = ereg_replace('>', '&gt;', $name);
        # Don't allow excessively long entries
        $name = substr($name, 0, $max);
        # Undo PHP's "magic quotes" feature, which has
        # inserted a \ in front of any " characters.
        # We undo this because we're using a file, not a
        # database, so we don't want " escaped. Those
        # using databases should do the opposite:
        # call addslashes if get_magic_quotes_gpc()
        # returns false.
        return $name;
    }
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Rally drivers profile page</title>

<style type="text/css">
<!--
.style1 
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #FFCC00;
}

.style3 
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-weight: bold;
}

.style5 
{
	font-family: Verdana, Arial, Helvetica, sans-serif; 
	color: #FFFFFF; 
	width: 175;
}

.style6
{
	width: 550;
}

.style8 
{
	color: #FFFFFF
}

body 
{
    background-color: #000000;
}
-->
</style>

</head>
<body>
<h1 align="center" class="style1">Rally drivers profile page</h1>
<div align="center">

<?php
    $password = "";
    if ($_POST['password'] == $adminPassword) 
	{
        $admin = 1;
        $password = $adminPassword;
    } 
	else if (strlen($_POST['password'])) 
	{
        echo("<h2>Login Failed (Bad Password)</h2>\n");
    }
?>  

<?php
    if ($_POST['submit']) 
	{
        $file = fopen($guestbook, "a");
		
        if (!$file) 
		{
            die("Can't write to guestbook file");
        }
		
        $date = date('j-m-Y G:i:s');
        $id = rand();
        
        $driverName = $_POST['driverName'];
        $since = $_POST['since'];
        $country = $_POST['country'];
        $coDrivers = $_POST['coDrivers']; 
        $latestRallyCar = $_POST['latestRallyCar']; 
        $Favouriterally = $_POST['Favouriterally']; 
        
        $driverName = clean($driverName, 40);
        $since = clean($since, 40);
        $country = clean($country, 40);
        $coDrivers = clean($coDrivers, 40);
        $latestRallyCar = clean($latestRallyCar, 40);
        $Favouriterally = clean($Favouriterally, 40);
        
		
        fwrite($file, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$Favouriterally\t$id\n");
        fclose($file);  
    }
	
    $file = fopen($guestbook, 'r');
    $tfile = null;
    $delete = 0;
    $deleteId = '';
	
    if ($admin && $_POST['delete']) 
	{
        $delete = 1;
        $deleteId = $_POST['id'];
        $tfile = @fopen("$guestbook.tmp", 'w');
        if (!$tfile) 
		{
            die("Can't create temporary file for delete operation");
        }
    }
	
    if ($file) 
	{
        while (!feof($file)) 
		{
            $line = fgets($file);
            $line = trim($line);
            list ($date, $driverName, $since, $country, $coDrivers, $latestRallyCar, $Favouriterally, $id) = split("\t", $line, 8);
            
			if (!strlen($date)) 
			{
                break;
            }
            
			if (!strlen($id)) 
			{
                // Support my old version
                $id = $date;
            }   
            
			if ($delete) 
			{
                if ($id == $deleteId) 
				{
                    continue;
                } 
				else 
				{
                    fwrite($tfile, "$date\t$driverName\t$since\t$country\t$coDrivers\t$latestRallyCar\t$Favouriterally\t$id\n");
                }
            }
			
			# Table
			echo "<table width=\"800\" border=\"1\" cellpadding=\"3\" cellspacing=\"3\" bordercolor=\"#333333\" bgcolor=\"#FFFFFF\">";
			echo "<tr bgcolor=\"#666666\">";
			echo "<td class=\"style5\">Name driver</td>";
			echo "<td class=\"style6\">$driverName</td>";

			if ($admin) 
			{
                echo "<td rowspan=6>";
                echo "<form action=\"guestbook.php\" method=\"POST\">";
				
                passwordField();			
                hiddenField('id', $id);
				
                echo "<input type=\"submit\" value=\"Delete\" name=\"delete\">";
                echo "</form>";
                echo "</td>";
            }

			echo "</tr>";
			
			echo "<tr bgcolor=\"#666666\"><td class=\"style5\">Since</td>";
			echo "<td class=\"style6\">$since</td>";
			echo "</tr>";
			
			echo "<tr bgcolor=\"#666666\"><td class=\"style5\">Country</td>";
			echo "<td class=\"style6\">$country</td>"; 
			echo "</tr>";
			
			echo "<tr bgcolor=\"#666666\"><td class=\"style5\">Co drivers</td>";
			echo "<td class=\"style6\">$coDrivers</td>";
			echo "</tr>";
			
			echo "<tr bgcolor=\"#666666\"><td class=\"style5\">Latest rally car</td>";
			echo "<td class=\"style6\">$latestRallyCar</td>";
			echo "</tr>";
			
			echo "<tr bgcolor=\"#666666\"><td class=\"style5\">Favourite rally</td>";
			echo "<td class=\"style6\">$Favouriterally</td>";
            echo "</tr>";
			echo "</table>";
        }
		
        fclose($file);
		
        if ($delete) 
		{
            fclose($tfile);
            unlink($guestbook);
            rename("$guestbook.tmp", $guestbook);
        }   
    }

    function passwordField() 
	{
        global $admin;
        global $password;
		
        if (!$admin) 
		{
            return;
        }
		
        hiddenField('password', $password);
    }
	
    function hiddenField($name, $value) 
	{
        echo "<input type=\"hidden\" name=\"$name\" value=\"$value\">";
    }

    if (!$admin) 
	{
?>

<form action="guestbook.php" method="POST" class="style8">
<span class="style3">Admin Login</span>
<br>
<input type="password" name="password">
<input type="submit" name="login" value="Log In">
</form>

<?php
    }
?>

<form action="guestbook.php" method="POST">
<table width="600" border="0" cellpadding="5" cellspacing="5">
<tr>
<th bgcolor="#666666"><span class="style8">Name driver</span></th>
<td><input id="driverName" name="driverName" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Since</span></th>
<td><input id="since" name="since" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Country</span></th>
<td><input id="country" name="country" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Co drivers</span></th>
<td><input id="coDrivers" name="coDrivers" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Latest rally car</span></th>
<td><input id="latestRallyCar" name="latestRallyCar" maxlength="40"></td>
</tr>
<tr>
<th bgcolor="#666666"><span class="style8">Favourite rally</span></th>
<td><input id="Favouriterally" name="Favouriterally" maxlength="40"></td>
</tr>
<tr bgcolor="#666666">
<th colspan="2">
<input name="submit" type="submit" value="Voeg profiel toe / Add profile"></th>
</tr>
</table>
<?php
    passwordField();
?>
</form>
</div>
</body>
</html>
 
hartstikke mooi man!!

ziet er super uit!

alleen moeten we even die tussen ruimte, tussen de berichtje iets vergroten.
en het lettertype grote iets verkleinen.
anders wordt het allemaal wel heel onoverzichtelijk.

zou natuurlijk nog mooier zijn als men nog een plaatje kan uploaden en mensen kunnen zoeken.

weet niet of dit heel veel werk is?
 
goed werk visha!!!!

het is helemaal gelukt!!!

dankjewel voor alles!
bedankt voor je tijd en energie!!!

ik maak hem verder af, en ga hem zeker gebruiken op mijn website.

hou de website maar in de gaten ;)
kan nog wel even duren want we zijn ineens ontzettend druk

http://www.rally-web.nl

THANKS visha !
 
goed werk visha!!!!

het is helemaal gelukt!!!

dankjewel voor alles!
bedankt voor je tijd en energie!!!

ik maak hem verder af, en ga hem zeker gebruiken op mijn website.

hou de website maar in de gaten ;)
kan nog wel even duren want we zijn ineens ontzettend druk

http://www.rally-web.nl

THANKS visha !

graag gedaan jurre
ik had gekeken op de site maar kan onze pagina niet vinden.
maar verder veel succes met de site
Byee VRC
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan