K I have the
following email
script that
include members
system stuff
Code:
<?
ob_start();
session_start(
);
require_once($_
SERVER['DOCUMEN
T_ROOT'].'/db_c
onnect.php');
//check
cookie
if
($_SESSION['log
ged_in'] != 1
&&
isset($_COOKIE[
'login_cookie']
)) {
list($user,
$pass) =
explode('[]',
$_COOKIE['login
_cookie']);
$qu =
mysql_query(&qu
ot;SELECT
`user_password`
FROM `members`
WHERE
`username` =
'".addslas
hes($user).&quo
t;'");
if
(mysql_num_rows
($qu) == 1)
{
$passw
=
mysql_fetch_obj
ect($qu);
if
($passw->use
r_password ==
$pass) {
$_SESSION['logg
ed_in'] = 1;
$_SESSION['user
name'] =
$user;
$_SESSION['pass
word'] =
$pass;
}
}
}
if(!isset($_SES
SION['username'
]) &&
!isset($_SESSIO
N['password']))
{
$_SESSION['logg
ed_in'] = 0;
$user =
"Guest&quo
t;;
}
?>
<html>
<body
BGcolor="#
262626"
text="#FFF
FFF"
LINK="#FF0
000"
VLINK="#FF
0000"
ALINK="#FF
0000"><
br />
<h1><c
enter>Contac
t
Solphate</ce
nter></h1
>
<?php
if
(isset($_REQUES
T['email']))
//if
"email&quo
t; is filled
out, send
email
{
//send
email
$email =
$_REQUEST['emai
l'] ;
$subject =
$_REQUEST['subj
ect'] ;
$message =
$_REQUEST['mess
age'] ;
mail(
"someone@e
xample.com"
;,
"Subject:
$subject",
$message,
"From:
$email"
);
echo
"Thank you
for using our
mail
form";
}
else
//if
"email&quo
t; is not
filled out,
display the
form
{
echo
"<form
method='post'
action='mailfor
m.php'>
Email:
<input
name='email'
type='text'
/><br
/>
Subject:
<input
name='subject'
type='text'
/><br
/>
Message:<br
/>
<textarea
name='message'
rows='15'
cols='40'>
</textarea&g
t;<br
/>
<input
type='submit'
/>
</form>&q
uot;;
}
?></body&
gt;
</html>
I would like to
know how to
make if that if
the user is
logged in to
put their
username in a
name field and
if they are not
put a blank
name field.
If you can help
Post It
It me it me |