Search
Left Quote    Treat your password like your toothbrush. Don't let anybody else use it, and get a new one every six months.
- Clifford Stoll    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Email Script
  This user is offline  solphate
  Subject: "Email Script" Posted: @ 1:50 am on Feb 21 2008   
Member #: 581
Rank: User - (24)
Since: 02/18/08
Posts: 24

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
    Viewed: 3,316 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Email Script" Posted: @ 7:52 pm on Feb 21 2008    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

if($_SESSION[' logged_in'] == 1)
echo($_SESSION[ 'username']);




-bs0d | AllSyntax.com

    Viewed: 3,301 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2017; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank