Jump to content
MakeWebGames

Recommended Posts

Posted

ok i was a bit lazy because im still new to all this but here goes. can you help me fix it when i click submit it dont work

 

<?php

echo "<h3>Register here for free account</h3>";

$submit = $_POST['submit'];

//form data

$username = strip_tags($POST['username']);

$password = md5(strip_tags($POST['password']));

$repeatpassword = md5(strip_tags($POST['repeatpassword']));

 

if ($submit)

{

echo $username;

}

?>

<html>

<form action='register.php' method='POST'>

<table>

<tr>

<td>

Choose a username:

</td>

<td>

<input type='text' name='username'>

</td>

</tr>

<tr>

<td>

Choose a Password:

</td>

<td>

<input type='password' name='password'>

</td>

</tr>

<tr>

<td>

Repeat Password:

</td>

<td>

<input type='password' name='repeatpassword'>

</td>

</tr>

</table>

<p>

<input type='submit' name='submit' value='register'>

</form

</html>

Posted
if ($_POST['submit'])
{
$username = strip_tags($_POST['username']);
$password = md5(strip_tags($_POST['password']));
$repeatpassword = md5(strip_tags($_POST['repeatpassword']));
echo $username;

}
?>

 

That should do it I think, kinda tired, if it's wrong i'll relook it over when i get up

Posted

well trying to teach my self. so far im doing prity good for the frist time codeing i looked up

w3shools.com

 

i learned a little of there. but some times i dont understand what i need to put in

Posted

It took me over a year to get my game together and I had already been coding for quite some time.

You just need to learn before continuing. Roll through tutorials which will give you the basics and then go through them again after reading on security and better methods to employ.

For example I would not use the code iExze posted.

Posted
if ($_POST['submit'])
{
$username = strip_tags($_POST['username']);
$password = md5(strip_tags($_POST['password']));
$repeatpassword = md5(strip_tags($_POST['repeatpassword']));
echo $username;

}
?>

 

That should do it I think, kinda tired, if it's wrong i'll relook it over when i get up

Why not use mres?

Posted (edited)

do you have an INSERT INTO VALUES if not then you wont be able to register as it not posting any input to the db

 

$username = strip_tags($_POST['username']);
$password = md5(strip_tags($_POST['password']));
$repeatpassword = md5(strip_tags($_POST['repeatpassword']));
echo $username;

$sql= "INSERT INTO `user db` ( username, password)"."VALUES ('$username', '$password');
echo 'Your account has been created successfully! <meta http-equiv="refresh" content="0; url=home.php">';
}
Edited by grant
Posted (edited)
It took me over a year to get my game together and I had already been coding for quite some time.

You just need to learn before continuing. Roll through tutorials which will give you the basics and then go through them again after reading on security and better methods to employ.

For example I would not use the code iExze posted.

 

I wouldn't use my code, I was just re arranging the given code correctly.

 

@Grant that wouldn't insert into the db either as you never called $sql.

 

mysql_query("INSERT INTO `users` (`username`, `password`) VALUES ('".$username."', '".$password."')") or die(mysql_error());
Edited by Guest
Posted
I wouldn't use my code, I was just re arranging the given code correctly.

 

@Grant that wouldn't insert into the db either as you never called $sql.

 

mysql_query("INSERT INTO `users` (`username`, `password`) VALUES ('".$username."', '".$password."')") or die(mysql_error());

was just example to show him how you do it lol

Posted
If you are going to show him , atleast do it properly so he doesn't get mis-lead on what to do

dont see you helping so dont comment on my post inless your going to help him

Posted
was just example to show him how you do it lol

Haha sorry if it sounded harsh

 

If you are going to show him , atleast do it properly so he doesn't get mis-lead on what to do

If you are going to complain please contribute to the thread.

Posted

im confused. do i add my db info to mysql_query("INSERT INTO `user` (`username`, `password`) VALUES ('".$username."', '".$password."')") or die(mysql_error());

 

if so where

Posted

the db info is before via a mysql connect.

BTW don't use mysql_query, those are old functions. If you start from scratch I would strongly suggest to use MySQLi which allows to make your code safer. (Doesn't mean you cannot be safe with the older functions, it just require more work).

Posted
the db info is before via a mysql connect.

BTW don't use mysql_query, those are old functions. If you start from scratch I would strongly suggest to use MySQLi which allows to make your code safer. (Doesn't mean you cannot be safe with the older functions, it just require more work).

lol he cant use mysql_query yet so going to take him some time to use mysqli .i have learned php by myself and i still have some issues back and forwords stabs just google tuts on how to code php and you will soon pick it up
Posted
LOL grant like your the expert. You dont need to learn mysql first to learn mysqli and its probably better you dont. Just go with mysqli and you will be in a much better position.
never says i was an expert say it would be easy for him to understand better
Posted

This is my register.php code. when i click register thisshows you account created sucessful but when i go to database nothing there?

i dont understand

<html>

<title></title>

<body>

<center><img src="http://.photobucket.com/albums/ii513//Untitled-4.jpg" border="0" alt=".com"></a></center>

<head>

<style type="text/css"><!--

body {scrollbar-3dlight-color:silver;

scrollbar-arrow-color:white;

scrollbar-track-color:black;

scrollbar-darkshadow-color:gray;

scrollbar-face-color:gray;

scrollbar-highlight-color:gray;

scrollbar-shadow-color:black}

body { background-color:#404040; }

 

--></style>

</head>

</html>

<p><?php echo date("F j, g:i:s a"); ?></p>

<?php

echo "<h3>Register here for free account</h3>";

$submit = $_POST['submit'];

//form data

if ($_POST['submit'])

{

$username = strip_tags($_POST['username']);

$password = md5(strip_tags($_POST['password']));

$repeatpassword = md5(strip_tags($_POST['repeatpassword']));

echo $username;

error_reporting(0);

require "connect.php";

$write = mysql_query("INSERT INTO mysql_xxxxxxxxx VALUES('username','password')");

echo"<p><b>Account created sucessful</b>";

}

?>

<html>

<form action='register.php' method='POST'>

<table>

<tr>

<td>

Choose a username:

</td>

<td>

<input type='text' name='username'>

</td>

</tr>

<tr>

<td>

Choose a Password:

</td>

<td>

<input type='password' name='password'>

</td>

</tr>

<tr>

<td>

Repeat Password:

</td>

<td>

<input type='password' name='repeatpassword'>

</td>

</tr>

</table>

<p>

<left><input type='submit' name='submit' value='Register'>

</form

<p><a href='index.html'><u><b>Back to log in page</b></u></a></p>

</html>

this is my connect.php

<?php

$connect = mysql_connect("xxxxxxxx", "xxxxxxxx", "xxxxxxxx") or die ("Couldnt connect");

mysql_select_db("xxxxxxxxl") or die ("Couldnt find database");

echo "connection successful";

?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...