PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my settings
my profile
Public Pastes
Dag Mensen
PHP | 13 sec ago
while not terminat...
4 sec ago
Abelia - Very Stre...
15 sec ago
jQuery Menu problem
10 sec ago
Guitar Pro v6 0 7 ...
10 sec ago
Untitled
13 sec ago
Watch!! Accenture ...
31 sec ago
!!!Tv Link !!!Paki...
46 sec ago
New Paste
<?php /* ** Ok. This script may require some editing at different points along it. ** It's been made very easy to edit when you find the right area. It's ** commented very well at important sections, so you shouldn't have ** any trouble getting things the way you want them. You can support ** any number of form elemets, and format them any way you like in a very ** easy manner. You can also format the 'thank you' page easily as well. ** Look through the script and find what you want to change and/or edit. ** Recommended things to look for are: ** $recipient_email //Email of person getting this email ** $redirect_page //The URL to redirect to after the thanks is displayed ** $redirect_wait //How long to wait on the thanks page ** $thanks_text //Text displayed to user after email successfully sent ** $require_fields //Form fields required before email will be sent ** $subject //Subject of email being sent ** $newsletter //This is just interesting ** $message //Text of the email being sent */ /* ** This function used from http://snipplr.com/view/25/format-phone-number/ */ function format_phone($phone) { $phone = preg_replace("/[^0-9]/", "", $phone); if(strlen($phone) == 7) return preg_replace("/([0-9]{3})([0-9]{4})/", "$1-$2", $phone); elseif(strlen($phone) == 10) return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "($1) $2-$3", $phone); else return $phone; } /* **This makes all the form fields into variables in the form of ** $f_<form field name>. ** Example: ** If I had a field on my form as: ** <input type="text" name="email" /> ** I could access it in this script with: ** $f_email */ import_request_variables("gp","f_"); //Your email address $recipient_email = "name@example.com"; /* ** This is the page your user will be sent to after they send an email. ** Uncomment or edit this option as you see fit. If you comment it out ** the user will not be given a return link or automatically redirected. */ //$redirect_page = "/"; //Return the user to your homepage. //$redirect_page = "http://url.com/path/to/page.html"; //Send user to a specific webpage. //$redirect_page="http://google.com"; /* ** Time (in seconds) to wait before redirect. If $thanks_page is commented ** out, this does nothing. Don't comment this out. */ $redirect_wait = 5; /* ** The text you put between <<<REDIR and REDIR; will be shown to the user ** as a thank you page. If you have defined $thanks_page above, a link ** will be automatically appended to the end of this. */ $thanks_text = <<<REDIR <h2>Thanks</h2> Thanks for sending your email to us! REDIR; /* ** This array stores a list of required fields. If you put a field name here ** it just means that it must be included in the form and not be blank. ** This does no error or validity checking. That must be handled on an ** individual field basis further on in the script. ** ** This is NOT handled by the variable import at the begginning of the file. ** These names should be exactly as they are in your html file. */ $require_fields = array("email","first","last"); $errors = array(); /* ** Make sure all required fields are filled in. Set the required && fields at the top of this script. */ foreach($require_fields as $value) { if(!isset($_REQUEST[$value]) || $_REQUEST[$value] == "") $errors[] = "The field '<strong>" . $value . "</strong>' is required!"; } /* ** Validate the email address */ if(isset($f_email) && $f_email != "") { $emailregex = "/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/"; if(!$val=preg_match($emailregex,$f_email)) $errors[] = "Email address is invalid."; } /* ** Format a message to email */ //Subject of the email to send $subject = "Mail from my website"; //Let's make $f_newsletter look a bit more friendly in the email. $newsletter = $f_newsletter?"Yes":"No"; //Let's make $f_phone a little prettier $phone = format_phone($f_phone); /* **Format the email between the <<<EMAIL and EMAIL; **It should be emailed exactly as shown between those tags. If you want **a newline, press return. You can use $f_<form element name> to get the **strings of your form elements. */ $message = <<<EMAIL <p><strong>Name:</strong> $f_title $f_first $f_last $f_suffix</p> <p><strong>Email:</strong> $f_email</p> <p><strong>Phone:</strong> $phone</p> <p><strong>Address:</strong><br /> <div style="margin-left:5em;"> $f_address1<br /> $f_address2<br /> $f_city, $f_state $f_zip </div></p> <p><strong>Newsletter:</strong> $newsletter</p> <p><strong>Comments:</strong> $f_comments</p> EMAIL; $headers = <<<HEAD MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 From: $f_title $f_first $f_last $f_suffix <$f_email> Reply-To: $f_email HEAD; if(!count($errors)) { if($result = mail($recipient_email,$subject,$message,$headers)) { echo <<<HTMLS <html> <head> HTMLS; if(isset($redirect_page) && $redirect_page != "") echo "<meta http-equiv=\"refresh\" content=\"".$redirect_wait.";".$redirect_page."\">"; echo <<<HTMLM </head> <body> $thanks_text HTMLM; if(isset($redirect_page) && $redirect_page != "") echo "<p>Click <a href=\"".$redirect_page."\">here</a> to continue</p>"; echo <<<HTMLF </body> </html> HTMLF; } else { $errors[] = "Mail failed to send! Please contact the webmaster if this happens repeatedly."; } } /* ** Show all errors */ if(count($errors)) { echo "<h2>Error</h2>"; echo "<p>The following errors exist. Please press the browser's back button to correct them.</p>"; foreach($errors as $value) { echo $value . "<br />"; } } ?>
Optional Paste Settings
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
HTML 5
Java
JavaScript
Lua
None
Perl
PHP
Python
Rails
-------------
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
ActionScript
ActionScript 3
Ada
ALGOL 68
Apache Log
AppleScript
APT Sources
ASM (NASM)
ASP
autoconf
Autohotkey
AutoIt
Avisynth
Awk
BASCOM AVR
Bash
Basic4GL
BibTeX
Blitz Basic
BNF
BOO
BrainFuck
C
C for Macs
C Intermediate Language
C#
C++
C++ (with QT extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
ChaiScript
Clojure
Clone C
Clone C++
CMake
COBOL
CoffeeScript
ColdFusion
CSS
Cuesheet
D
DCS
Delphi
Delphi Prism (Oxygene)
Diff
DIV
DOS
DOT
E
ECMAScript
Eiffel
Email
EPC
Erlang
F#
Falcon
FO Language
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
Game Maker
GDB
Genero
Genie
GetText
Go
Groovy
GwBasic
Haskell
HicEst
HQ9 Plus
HTML
HTML 5
Icon
IDL
INI file
Inno Script
INTERCAL
IO
J
Java
Java 5
JavaScript
jQuery
KiXtart
Latex
Liberty BASIC
Linden Scripting
Lisp
LLVM
Loco Basic
Logtalk
LOL Code
Lotus Formulas
Lotus Script
LScript
Lua
M68000 Assembler
MagikSF
Make
MapBasic
MatLab
mIRC
MIX Assembler
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MPASM
MXML
MySQL
newLISP
None
NullSoft Installer
Oberon 2
Objeck Programming Langua
Objective C
OCalm Brief
OCaml
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
Pascal
PAWN
PCRE
Per
Perl
Perl 6
PHP
PHP Brief
Pic 16
Pike
Pixel Bender
PL/SQL
PostgreSQL
POV-Ray
Power Shell
PowerBuilder
ProFTPd
Progress
Prolog
Properties
ProvideX
PureBasic
PyCon
Python
q/kdb+
QBasic
R
Rails
REBOL
REG
Robots
RPM Spec
Ruby
Ruby Gnuplot
SAS
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
SQL
SystemVerilog
T-SQL
TCL
Tera Term
thinBasic
TypoScript
Unicon
UnrealScript
Vala
VB.NET
VeriLog
VHDL
VIM
Visual Pro Log
VisualBasic
VisualFoxPro
WhiteSpace
WHOIS
Winbatch
XBasic
XML
Xorg Config
XPP
YAML
Z80 Assembler
ZXBasic
Paste Expiration:
Never
10 Minutes
1 Hour
1 Day
1 Month
Paste Exposure:
Public
Unlisted
Private (members only)
Paste Name / Title:
Hello
Guest
Sign Up
or
Login
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login