dani342us
19-03-2006, 11:50 PM
This is actually very simple to do. All you have to know is a bit of MySQL and PHP and thats all. Anyways, lets start. First, make a Database then add this table to it
CREATE TABLE `djsays` (
`message` varchar(250) NOT NULL default 'No Message',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Next we will need to connect to that database and that user. Use this.
<?
ob_start(); // allows you to use cookies
$conn = mysql_connect("localhost","DATABASE USERNAME","DATABASE PASSWORD");
mysql_select_db(DATABASE NAME) or die(mysql_error());
//fill in the above lines where there are capital letters.
$logged = MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]' AND password = '$_COOKIE[pass]'");
$logged = mysql_fetch_array($logged);
//the above lines get the user's information from the database.
?>
Save that as config.php
Next we will need the page for the DJ to send the message. This part is simple. Here we go.
<?
ob_start();
include("config.php");
<form method=\"POST\">
<tr>
<td align=\"right\" width=\"25%\">
Location
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"djsays\" value=\"$djsays[djsays]\"></td>
</tr>
<td align=\"left\">
<input type=\"submit\" name=\"update\" value=\"Update\"></td>
</tr>
</table>
</form>
</center>");
}
else
{
$djsays = htmlspecialchars($_POST[djsays]);
// the above lines get rid of all html.
echo ("Your profile has been updated!");
$update = mysql_query("Update users set djsays = '$djsays'
// updates the information in the database.
?>
Okay, save that as djsaysform.php
Easy yes?
Next we need to make a page that will say the message, thats very simple aswell, trust me.
Just make a page called djmessage.php and in it put
<?php
ob_start();
include("config.php");
echo ("DJ Says: $djsays[djsays]<br />
");
?>
Now if you want this to appear somewhere withouth having to have it as an iframe just put
<?
include("djmessage.php");
?>
where ever you want it be.
By the way this is my first tutorial ever. Hopefully you all like it and it works.
Oh, by the way I really dont know if this works I just wrote it from the top of my head. Just test it to see.
CREATE TABLE `djsays` (
`message` varchar(250) NOT NULL default 'No Message',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Next we will need to connect to that database and that user. Use this.
<?
ob_start(); // allows you to use cookies
$conn = mysql_connect("localhost","DATABASE USERNAME","DATABASE PASSWORD");
mysql_select_db(DATABASE NAME) or die(mysql_error());
//fill in the above lines where there are capital letters.
$logged = MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]' AND password = '$_COOKIE[pass]'");
$logged = mysql_fetch_array($logged);
//the above lines get the user's information from the database.
?>
Save that as config.php
Next we will need the page for the DJ to send the message. This part is simple. Here we go.
<?
ob_start();
include("config.php");
<form method=\"POST\">
<tr>
<td align=\"right\" width=\"25%\">
Location
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"djsays\" value=\"$djsays[djsays]\"></td>
</tr>
<td align=\"left\">
<input type=\"submit\" name=\"update\" value=\"Update\"></td>
</tr>
</table>
</form>
</center>");
}
else
{
$djsays = htmlspecialchars($_POST[djsays]);
// the above lines get rid of all html.
echo ("Your profile has been updated!");
$update = mysql_query("Update users set djsays = '$djsays'
// updates the information in the database.
?>
Okay, save that as djsaysform.php
Easy yes?
Next we need to make a page that will say the message, thats very simple aswell, trust me.
Just make a page called djmessage.php and in it put
<?php
ob_start();
include("config.php");
echo ("DJ Says: $djsays[djsays]<br />
");
?>
Now if you want this to appear somewhere withouth having to have it as an iframe just put
<?
include("djmessage.php");
?>
where ever you want it be.
By the way this is my first tutorial ever. Hopefully you all like it and it works.
Oh, by the way I really dont know if this works I just wrote it from the top of my head. Just test it to see.