dobry den som zaciatocnik v php a potreboval by som poradit z php popripade ak by mal niekto zaujem tak by sme sa mohli dohodnut na nejakej odmene za upravanie ci dokoncenie webu.moj problem je tam ze by som potrebova formular v php zarovnat na stred a už sa stim pomerne dlho trapim prikladam nahlad php dokumentu vopred dakujem
<?php
$conn = mysqli_connect("xxxxx", "xxxx", "mxxx", "dbxxxxet");
if (mysqli_connect_errno()) {
echo "Connection to DB failed" . mysqli_connect_error();
}
if(isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['pw'];
$username = mysqli_real_escape_string($conn, $username);
$password = mysqli_real_escape_string($conn, $password);
$enc_pass = md5($password);
//check for duplicate usernames
$dupName = mysqli_query($conn, "SELECT * FROM users WHERE user = '$username'");
$rowName = mysqli_num_rows($dupName);
if ($rowName != 0) {
$message = "Username is already in use, pick another";
} else {
mysqli_query($conn, "INSERT INTO users (user, pw) VALUES ('$username', '$enc_pass')");
$message = "Account Successfully Created";
mysqli_close($conn);
}
}
?>
<html>
<body>
<h1>Register for Bictcoins!</h1>
<form name="register" method="post" action="register.php">
Username: <input type="text" name="username" maxlength="15" />
Password: <input type="password" name="pw" />
<input type="submit" name="submit" value="Register" />
</form>
<?php echo $message; ?>
<a rel="nofollow" href="login.php">Already Registered? Login Here <a/>
</body>
</html>