Hej jeg har et lille problem med at skralle en php kode..jeg skal have skrelllet den ene kode
og bagefter skal jeg have samlet det i en anden kode hvergang jeg prøver ænder det med fejle
men vis der er en gæv gut/gutind der ude som som kunne finde på at hjælpe mig.
vil jeg blive meget glad da det skal værer færdig omkring 21 Aug. 2003 .
Her kommer så koderne..
Den her kode skal jeg kun bruge password og bruger + kryptonering
<?php
require('../db_connect.php'); // database connect script.
?>
<html>
<head>
<title>Register an Account</title>
</head>
<body>
<?php
if (isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they supposed to,
passwords matched, username
isn't already taken, etc. */
if (!$_POST['uname'] | !$_POST['passwd'] | !$_POST['passwd_again'] | !$_POST['email']) {
die('You did not fill in a required field.');
}
// check if username exists in database.
if (!get_magic_quotes_gpc()) {
$_POST['uname'] = addslashes($_POST['uname']);
}
$name_check = $db_object->query("SELECT username FROM users WHERE username = '".$_POST['uname']."'");
if (DB::isError($name_check)) {
die($name_check->getMessage());
}
$name_checkk = $name_check->numRows();
if ($name_checkk != 0) {
die('Sorry, the username: <strong>'.$_POST['uname'].'</strong> is already taken, please pick another one.');
}
// check passwords match
if ($_POST['passwd'] != $_POST['passwd_again']) {
die('Passwords did not match.');
}
// check e-mail format
if (!preg_match("/.*@.*..*/", $_POST['email']) | preg_match("/(<|>)/", $_POST['email'])) {
die('Invalid e-mail address.');
}
// no HTML tags in username, website, location, password
$_POST['uname'] = strip_tags($_POST['uname']);
$_POST['passwd'] = strip_tags($_POST['passwd']);
$_POST['website'] = strip_tags($_POST['website']);
$_POST['location'] = strip_tags($_POST['location']);
// check show_email data
if ($_POST['show_email'] != 0 & $_POST['show_email'] != 1) {
die('Nope');
}
/* the rest of the information is optional, the only thing we need to
check is if they submitted a website,
and if so, check the format is ok. */
if ($_POST['website'] != '' & !preg_match("/^(http|ftp):\\/\\//", $_POST['website'])) {
$_POST['website'] = 'http://'.$_POST['website'];
}
// now we can add them to the database.
// encrypt password
$_POST['passwd'] = md5($_POST['passwd']);
if (!get_magic_quotes_gpc()) {
$_POST['passwd'] = addslashes($_POST['passwd']);
$_POST['email'] = addslashes($_POST['email']);
$_POST['website'] = addslashes($_POST['website']);
$_POST['location'] = addslashes($_POST['location']);
}
$regdate = date('m d, Y');
$insert = "INSERT INTO users (
username,
password,
regdate,
email,
website,
location,
show_email,
last_login)
VALUES (
'".$_POST['uname']."',
'".$_POST['passwd']."',
'$regdate',
'".$_POST['email']."',
'".$_POST['website']."',
'".$_POST['location']."',
'".$_POST['show_email']."',
'Never')";
$add_member = $db_object->query($insert);
if (DB::isError($add_member)) {
die($add_member->getMessage());
}
$db_object->disconnect();
?>
<h1>Registered</h1>
<p>Thank you, your information has been added to the database, you may now <a href="login.php" title="Login">log in</a>.</p>
<?php
} else { // if form hasn't been submitted
?>
<h1>Register</h1>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table align="center" border="1" cellspacing="0" cellpadding="3">
<tr><td>Username*:</td><td>
<input type="text" name="uname" maxlength="40">
</td></tr>
<tr><td>Password*:</td><td>
<input type="password" name="passwd" maxlength="50">
</td></tr>
<tr><td>Confirm Password*:</td><td>
<input type="password" name="passwd_again" maxlength="50">
</td></tr>
<tr><td>E-Mail*:</td><td>
<input type="text" name="email" maxlength="100">
</td></tr>
<tr><td>Website:</td><td>
<input type="text" name="website" maxlength="150">
</td></tr>
<tr><td>Location</td><td>
<input type="text" name="location" maxlength="150">
</td></tr>
<tr><td>Show E-Mail?</td><td>
<select name="show_email">
<option value="1" selected="selected">Yes</option>
<option value="0">No</option></select>
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Sign Up">
</td></tr>
</table>
</form>
<?php
}
?>
</body>
</html>
her er så den kode som jeg gerne vil have det smidt sammen med
<?
if($kode == "XXXXXXX"){
echo "Medlemmet, '$gx_nick', er blevet oprettet!";
$db = mysql_connect("XXXXXX", "XXXXXX", "XXXXXX");
mysql_select_db("gb2490", $db);
mysql_query("INSERT INTO GX_users (gx_nick, gx_name, gx_age, gx_city, gx_mail, gx_membertype, gx_msn, gx_icq, gx_internet, gx_map, gx_gun, gx_pistol, gx_quote, gx_spec)
VALUES ('$gx_nick', '$gx_name', '$gx_age', '$gx_city', '$gx_mail', '$gx_membertype', '$gx_msn', '$gx_icq', '$gx_internet', '$gx_map', '$gx_gun', '$gx_pistol', '$gx_quote', '$gx_spec')");
} else {
?>
<div align="center">
<form method="post" action="<? echo $php_self; ?>">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC">
<tr>
<td width="90">Nick :</td>
<td width="25%"><input type="tekst" name="gx_nick" size="20" value="Not available"></td>
<td width="108">Name</td>
<td width="25%"><input type="tekst" name="gx_name" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">Age :</td>
<td width="25%"><input type="tekst" name="gx_age" size="2" maxlength="2"></td>
<td width="108">City</td>
<td width="25%"><input type="tekst" name="gx_city" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">E-mail :</td>
<td width="25%"><input type="tekst" name="gx_mail" size="20" value="Not available"></td>
<td width="108">Member type</td>
<td width="25%"><select name="gx_membertype" size="1">
<option value="Clan leader / Webmaster">Clan leader / Webmaster</option>
<option value="Co Clan leader">Co Clan leader</option>
<option value="Member">Member</option>
<option value="Try" selected>Try</option>
</select></td>
</tr>
<tr>
<td width="90">MSN :</td>
<td width="25%"><input type="tekst" name="gx_msn" size="20" value="Not available"></td>
<td width="108">ICQ</td>
<td width="25%"><input type="tekst" name="gx_icq" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">Internet:</td>
<td width="25%"><input type="tekst" name="gx_internet" size="20" value="Not available"></td>
<td width="108">Favorit map(s):</td>
<td width="25%"><input type="tekst" name="gx_map" size="20" value="AS_ CS_ DE_"></td>
</tr>
<tr>
<td width="90">Favorit gun(s):</td>
<td width="25%"><input type="tekst" name="gx_gun" size="20" value="Not available"></td>
<td width="108">Favorit pistol(s):</td>
<td width="25%"><input type="tekst" name="gx_pistol" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">Quote:</td>
<td width="25%"><input type="tekst" name="gx_quote" size="20" value="Not available"></td>
<td width="108">Cpu :</td>
<td width="25%"><input type="tekst" name="gx_cpu" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">Ram :</td>
<td width="25%"><input type="tekst" name="gx_ram" size="20" value="Not available"></td>
<td width="108">Monitor :</td>
<td width="25%"><input type="tekst" name="gx_monitor" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">HDD :</td>
<td width="25%"><input type="tekst" name="gx_hdd" size="20" value="Not available"></td>
<td width="108">Display adapter :</td>
<td width="25%"><input type="tekst" name="gx_display" size="20" value="Not available"></td>
</tr>
<tr>
<td width="90">Mouse :</td>
<td width="25%"><input type="tekst" name="gx_mouse" size="20" value="Not available"></td>
<td width="108"></td>
<td width="25%"></td>
</tr>
</table>
Kodeord: <input type="password" name="kode" size="20">
<input type="submit" value="Opret" style="width: 60">
</form>
</div>
<?
}
?>
På forhånd tak
//Barney Smaasten
//www.generationx.dk
[Redigeret d. 13/08-03 12:19:04 af Mark S. Johansen]