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
https://forums.phpfreaks.com/topic/76879-solved-i-need-to-make-a-member-feature/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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