that's the php functions for the login:
function connectMaBase(){
$base = mysql_connect ('websitename', 'user', 'pass');
if (!$base) {
die('cannot connect to the database, data error' );
}
$db_selected = mysql_select_db ('website', $base) ;
if (!$db_selected) {
die ('cannot connect to the database, database does not exist' );
}
}
function login($usern,$psd)
{
connectMaBase();
$pass="";
$int=0;
$result1 = mysql_query("select count(username) from user where username='".$usern."'");
while ($row = mysql_fetch_array($result1)) {
$int=$row{'count(username)'};
}
if($int!=0){
$result = mysql_query("SELECT Password FROM user where Username='".$usern."'");
//fetch that data from the database
while ($row = mysql_fetch_array($result)) {
$pass=$row{'Password'};
}
if($psd==$pass && $pass!="")
{
echo "<script type=\"text/javascript\">
window.location.replace(\"http://nextpageurl\");
</script>";
}
elseif($psd!=$pass && $psd!="")
{
echo "wrong password";
}
}
else
{
echo "you are not a registered user";
}
//close the connection
mysql_close();
}
and that's the get function in the other page where I am inserting note=note' in the url ...
function finddata($ntn){
connectMaBase();
$int=0;
$txt="";
$result1 = mysql_query("select count(NoteName) from Note where NoteName='".$ntn."'");
while ($row = mysql_fetch_array($result1)) {
$int=$row{'count(NoteName)'};
}
if($int==0){
$txt="this note does not exist";
}
else{
$result2 = mysql_query("select NoteText from Note where NoteName='".$ntn."'");
while ($row = mysql_fetch_array($result2)) {
$txt=$row{'NoteText'};
}
}
mysql_close();
return $txt;
}
and I have a get form where I have a textarea and a textbox in the textbox you insert the name of the note and you press the find key that executes the findata function and gets you the text of this note....