Jump to content

[SOLVED] i need to make a member feature


mybluehair

Recommended Posts

i am making a chat room using only php and mysql. and i want it to be so you have to make a account (simple username and password account) to be able to access the chat room. except i dont know how. i need to make a registration page, and a login page. i can make the registration page were whatever they entered for the username and password will be put into my mysql DB, but thats really all i know how to do. can someone teach me? here is my chat room code:

 

<?

$database = "*************";

$username = "**********";

$password = "***********";

 

$message=$_POST['message'];

 

 

echo '

<center><a href="logintoap.html">Admin panel</a></center><br>

 

<form action="allinone.php" method="post"> <br>

chat message:<br> <textarea rows="12" cols="65" name="message" id="message"></textarea> <br><br>

<input type="submit"><br>';

 

 

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die ( "unable to connect");

if ($message == '') {

$message = false;

} else {

$query = "INSERT INTO contacts VALUES ('', '$message', NOW())";

}

 

 

mysql_query($query);

 

 

mysql_close();

 

echo '<hr>';

 

 

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die ( "unable to connect");

$query="SELECT * FROM `contacts` ORDER by 'datetime' DESC ";

$result=mysql_query($query);

 

 

$num=mysql_numrows($result);

 

mysql_close();

 

echo "<b><center>chats:</center></b><br><br><br>";

 

$i=0;

while ($i < $num) {

 

$message=mysql_result($result,$i,"message");

 

 

echo "<b>$message</b><br><hr><br>";

 

$i++;

}

 

?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.