[advanced search]
Results from the most recent live auction are here.
26 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 08-01-2007, 02:28 PM   · #1
Daniel
Danltn.com
 
Daniel's Avatar
 
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Trader Rating: (65)
Join Date: May 2007
Posts: 1,185
NP$: 681.56 (Donate)
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
Ethan Allen Fund Ethan Allen Fund
*FUN* Contact Me script

One file only.

This is all a bit of fun really. Demo is at http://neville.tk/form

PHP Code:
<?php $myemail = 'you@you.com'; ?>
<head><style>
body { margin:0px;padding:0px;text-align:center; }
#mail { margin-left:20px; }
#borat { position: absolute;    right: 0;    bottom: 0; }
#thanks { font-size:24; }
#lines { margin-bottom:5px; }
a { color:black; }
a:link { color:black; }
a:hover { color:black; }
a:visited { color:black; }
a:active { color:black; }
</style></head>
<body>

<?php
  $pageUR1  
= ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
  
$pageURL  = str_replace("www.", "", $pageUR1);
?>
<!-- <div style="position:absolute;top:0;left:0;height:98%;width:98  %;margin:1%;padding:0px;background-color:#C9F9F9"> -->
<div style="text-transform:capitalize;height:90px;background-color:#F9F9F9;font-size:72px;padding:5px;text-align:center;"><?php echo $pageURL; ?></div>
<div id="mail">
<?php


$subject
= "Message from $pageURL";

$op = $_POST[op];

if(
$op == 'contact')
{
    
$name = stripslashes($_POST[name]);
    
$email = stripslashes($_POST[email]);
    
$text = stripslashes($_POST[text]);
    
$referer = $_POST[referer];
    
$remote_host = $_SERVER[REMOTE_ADDR];
    
$server = $pageURL;
    
$browser = $_SERVER[HTTP_USER_AGENT];
    
    if(!
$name || !$text || !$email)
    
    {
      echo
"<img src=\"http://neville.tk/form/smiley.gif\" style=\"margin-bottom:15px;\">";
      }

    if(!
eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",$email))
    {
        
$status = "<div id=\"lines\">Whao dude - That ain't cool! You <em>SO</em> entered an invalid email!</div>";
    }
    if(!
$name)
    {
        
$status .= "<div id=\"lines\">Hey mate, I wanna know your name! I know you have one</div>";
    }
    if(!
$text)
    {
        
$status .= "<div id=\"lines\">So you thought you'd just come, and not leave a message? Foo!</div>";
    }

    if(!
$status)
    {
        
$header = "From: \"$name\" <$email> \n";
        
$message = "
            Name: $name
            Referer: $referer
            Site: $server
            Remote Host: $remote_host
            Remote Browser: $browser

            $text
        "
;

        if(
mail($myemail, $subject, $message, $header))
        {
            
$status = "<div align=\"center\" style=\"margin-bottom:15px;\"><img src=\"http://neville.tk/form/happy.gif\"></div>";
            
$status .= "Thanks $name - I have like <em>TOTALLY</em> received your mail.<br /><br />Wanna send me <a href=\"" . $_SERVER['SCRIPT_NAME'] . "\">another</a>?";
            
$topleft = "<div id=\"borat\"><img src=\"http://mf1.us/bulklist/borat.png\"></div>";
            
$firstcom = "<!--";
            
$secondcom = "-->";
        }
        else
        {
            
$status = "There was a problem sending your feedback, please try again later.<br><br>";
        }

    }
    else
    {
        
$status .= "<div id=\"lines\">I totally can't believe you did that, try again below or press <u><a href=\"\" onMouseover=\"history.go(-1)\">back</a></u>.</div><br />";
    }
}    

// Now check the referer page and ensure it's a proper URL

$referer = $_SERVER[HTTP_REFERER];

if(!
preg_match('#^http\:\/\/[a-z0-9-]+.([a-z0-9-]+.)?[a-z]+#i', $referer))
{
    unset(
$referer);
}

?>
<div id='thanks'>
<?php echo $status; echo $topleft; echo $firstcom; ?>


<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<input type="hidden" name="op" value="contact">
<input type="hidden" name="referer" value="<?php print $referer; ?>">
<div style="margin-top:10px;"><label for="name" style="font-size:24px;">Name:</label></div> <input name="name" size="35" style="padding-left:0;margin-left:10px;font-size:24px;width:90%;text-align:center;">
<div style="margin-top:10px;"><label for="email" style="font-size:24px;">Email:</label></div> <input name="email" size="35" style="padding-left:0;margin-left:10px;font-size:24px;width:90%;text-align:center;">
<div style="margin-top:10px;"><label for="text" style="font-size:24px;">Message:</label><br /><textarea name="text" style="padding-left:0;margin-left:10px;height:200px;width:90%;font-size:24px;font-weight:700;"></textarea><br />
<div style="margin-top:10px;"><input type="submit" value="Send message!" style="font-size:24px;"></div>
</form>

<?php echo $secondcom; ?>


</div>
  
</div>
</body>
</html>


It should all work on upload, get images, show your domain, etc. Just need to have feedback to see if it works 'as is'.

- Dan

P.S. Enjoy.


Please register or log-in into NamePros to hide ads

Last edited by Danltn : 08-02-2007 at 06:26 AM.
Daniel is offline   Reply With Quote
Old 08-01-2007, 07:45 PM   · #2
champ_rock
Senior Member
 
champ_rock's Avatar
 
Name: Akshay Jain
Location: http://uck.in
Trader Rating: (101)
Join Date: Oct 2006
Posts: 2,707
NP$: 12279.80 (Donate)
champ_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond reputechamp_rock has a reputation beyond repute
lol.. one more improvement

Quote:
We're glad that you're fond of this member, but please give some rep points to some other members before giving it to Danltn again.

__________________
Akshay Jain
......................
champ_rock is offline   Reply With Quote
Old 08-02-2007, 01:56 AM   · #3
Xyzer
Steven
 
Xyzer's Avatar
 
Name: Steven Gibbons
Location: United Kindom
Trader Rating: (45)
Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 (Donate)
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
Tsunami Relief AIDS/HIV
Nice script there, works ok for me. Rep added.
Xyzer is offline   Reply With Quote
Old 08-02-2007, 06:10 AM   · #4
Daniel
Danltn.com
 
Daniel's Avatar
 
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Trader Rating: (65)
Join Date: May 2007
Posts: 1,185
NP$: 681.56 (Donate)
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
Ethan Allen Fund Ethan Allen Fund
Just an update:

Edit: And another

PHP Code:
<?php $myemail = 'you@you.com'; ?>
<head><style>
body { margin:0px;padding:0px;text-align:center; }
#mail { margin-left:20px; }
#borat { position: absolute;    right: 0;    bottom: 0; }
#thanks { font-size:24; }
#lines { margin-bottom:5px; }
a { color:black; }
a:link { color:black; }
a:hover { color:black; }
a:visited { color:black; }
a:active { color:black; }
</style></head>
<body>

<?php
  $pageUR1  
= ereg_replace("/(.+)", "", $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]);
  
$pageURL  = str_replace("www.", "", $pageUR1);
?>
<!-- <div style="position:absolute;top:0;left:0;height:98%;width:98  %;margin:1%;padding:0px;background-color:#C9F9F9"> -->
<div style="text-transform:capitalize;height:90px;background-color:#F9F9F9;font-size:72px;padding:5px;text-align:center;"><?php echo $pageURL; ?></div>
<div id="mail">
<?php


$subject
= "Message from $pageURL";

$op = $_POST[op];

if(
$op == 'contact')
{
    
$name = stripslashes($_POST[name]);
    
$email = stripslashes($_POST[email]);
    
$text = stripslashes($_POST[text]);
    
$referer = $_POST[referer];
    
$remote_host = $_SERVER[REMOTE_ADDR];
    
$server = $pageURL;
    
$browser = $_SERVER[HTTP_USER_AGENT];
    
    if(!
$name || !$text || !$email)
    
    {
      echo
"<img src=\"http://neville.tk/form/smiley.gif\" style=\"margin-bottom:15px;\">";
      }

    if(!
eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",$email))
    {
        
$status = "<div id=\"lines\">Whao dude - That ain't cool! You <em>SO</em> entered an invalid email!</div>";
    }
    if(!
$name)
    {
        
$status .= "<div id=\"lines\">Hey mate, I wanna know your name! I know you have one</div>";
    }
    if(!
$text)
    {
        
$status .= "<div id=\"lines\">So you thought you'd just come, and not leave a message? Foo!</div>";
    }

    if(!
$status)
    {
        
$header = "From: \"$name\" <$email> \n";
        
$message = "
            Name: $name
            Referer: $referer
            Site: $server
            Remote Host: $remote_host
            Remote Browser: $browser

            $text
        "
;

        if(
mail($myemail, $subject, $message, $header))
        {
            
$status = "<div align=\"center\" style=\"margin-bottom:15px;\"><img src=\"http://neville.tk/form/happy.gif\"></div>";
            
$status .= "Thanks $name - I have like <em>TOTALLY</em> received your mail.<br /><br />Wanna send me <a href=\"" . $_SERVER['SCRIPT_NAME'] . "\">another</a>?";
            
$topleft = "<div id=\"borat\"><img src=\"http://mf1.us/bulklist/borat.png\"></div>";
            
$firstcom = "<!--";
            
$secondcom = "-->";
        }
        else
        {
            
$status = "There was a problem sending your feedback, please try again later.<br><br>";
        }

    }
    else
    {
        
$status .= "<div id=\"lines\">I totally can't believe you did that, try again below or press <u><a href=\"\" onMouseover=\"history.go(-1)\">back</a></u>.</div><br />";
    }
}    

// Now check the referer page and ensure it's a proper URL

$referer = $_SERVER[HTTP_REFERER];

if(!
preg_match('#^http\:\/\/[a-z0-9-]+.([a-z0-9-]+.)?[a-z]+#i', $referer))
{
    unset(
$referer);
}

?>
<div id='thanks'>
<?php echo $status; echo $topleft; echo $firstcom; ?>


<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<input type="hidden" name="op" value="contact">
<input type="hidden" name="referer" value="<?php print $referer; ?>">
<div style="margin-top:10px;"><label for="name" style="font-size:24px;">Name:</label></div> <input name="name" size="35" style="padding-left:0;margin-left:10px;font-size:24px;width:90%;text-align:center;">
<div style="margin-top:10px;"><label for="email" style="font-size:24px;">Email:</label></div> <input name="email" size="35" style="padding-left:0;margin-left:10px;font-size:24px;width:90%;text-align:center;">
<div style="margin-top:10px;"><label for="text" style="font-size:24px;">Message:</label><br /><textarea name="text" style="padding-left:0;margin-left:10px;height:200px;width:90%;font-size:24px;font-weight:700;"></textarea><br />
<div style="margin-top:10px;"><input type="submit" value="Send message!" style="font-size:24px;"></div>
</form>

<?php echo $secondcom; ?>


</div>
  
</div>
</body>
</html>

Last edited by Danltn : 08-02-2007 at 06:26 AM.
Daniel is offline   Reply With Quote
Old 08-02-2007, 08:16 AM   · #5
gengolia
NamePros Regular
 
Trader Rating: (17)
Join Date: Jun 2007
Posts: 336
NP$: 49.90 (Donate)
gengolia is a jewel in the roughgengolia is a jewel in the roughgengolia is a jewel in the rough
really nice one Danltn. congrats for that
gengolia is offline   Reply With Quote
Old 08-07-2007, 04:00 AM   · #6
ellisd
NamePros Member
 
ellisd's Avatar
 
Trader Rating: (0)
Join Date: Aug 2007
Posts: 49
NP$: 150.00 (Donate)
ellisd is an unknown quantity at this point
ok,

i just tested it and yes it made me
ellisd is offline   Reply With Quote
Old 08-13-2007, 01:40 AM   · #7
Daniel
Danltn.com
 
Daniel's Avatar
 
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Trader Rating: (65)
Join Date: May 2007
Posts: 1,185
NP$: 681.56 (Donate)
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
Ethan Allen Fund Ethan Allen Fund
Wow, the [CODE] forum really is dead.
Daniel is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
http://www.internetinvestments.com/ http://www.dnfinder.com http://www.mobisitetrader.com/
Advertise your business at NamePros
All times are GMT -7. The time now is 02:00 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0