Using the mail function, I show you how to create a very basic script. With a little tweaking of our php.ini file, we can send an email from php very easily!
Posts Tagged ‘With’
What’s Wrong With My Php Script?
September 9th, 2009
phpmoz mySearch.php
<?php
if (isset($_POST['submit'])) {
if ( ($_POST['username'] == 'myUsername') && ($_POST['password'] == 'myPassword') ) {
header ("Location: http://www.mysite.com/search.html");
}
else {
echo "
The submitted username and password do not match those on file!Go back and try again.
“;
}
}
else {
echo “
Please make sure you enter a username and a password!Go back and try again.
“;
}
}
?>
/*the user logs in, if successful they will go to the search page*/
What’s Wrong With My Php Script?
September 9th, 2009
phpmoz mySearch.php
<?php
if (isset($_POST['submit'])) {
if ( ($_POST['username'] == 'myUsername') && ($_POST['password'] == 'myPassword') ) {
header ("Location: http://www.mysite.com/search.html");
}
else {
echo "
The submitted username and password do not match those on file!Go back and try again.
“;
}
}
else {
echo “
Please make sure you enter a username and a password!Go back and try again.
“;
}
}
?>
/*the user logs in, if successful they will go to the search page*/
Help With Php, Sending Text To Flat File?
September 3rd, 2009
phpmoz Im trying to make my script so that it sends the text from 2 text boxes to the top, but i can only get it to bottom
the send.php
<?php
$thedate = date("F d, Y");
$filename = "downloads.php";
$user = $_GET["name"];
$message = $_GET["message"];
$out = fopen($filename, "a");
if (!$out)
{
print("Could not append to file");
exit;
}
fputs ($out,implode,("\n"));
fwrite($out,"$thedate – $name“);
fclose($out);
?>
in html file to send to code:
Php: Issue With Deleting Files From Server?
September 3rd, 2009
phpmoz I have a file called removepics.php which lists all the pictures a user has on my server and gives the options to delete any one (using a form and submit button which calls removepics2.php).
removepics2.php removes the file from the server successfully, and then redirects back to removepics.php so the user can remove another picture (it does this using a form and submit button again).
But when removepics.php is reloaded, the deleted picture is still there. I’m thinking it has something to do with cookies?
I want the deleted picture to not be there. Any help would be greatly appreciated.
Here is my code for removepics2.php:
————————————–…
<?php
$PicNum = $_POST['picnum'];
$HouseNum = $_POST['housenum'];
$EmailAddress = $_POST['emailaddress'];
unlink('../forms/uploaded_files/'.
$HouseNum.'-'.$PicNum.'.jpg');
echo '’;
echo ”;
echo ‘
‘;
echo ”;
echo ‘document.myform.submit();’;
echo ”;
?>
————————————–…
Problem With Php And Arranging Output?
September 2nd, 2009
phpmoz (file = top.php)
(file = pagecalled.php)
My problem is simple. “pagecalled.php” performs various actions on a user account and in case above sets $something to 1, the included file “top.php” displays information about a users account and shows the state of $something. The pagecalled actions are processed and the echo of $something in the page will show correctly but as the top is included prior to the actions that wont show the new state of $something, but I need it to.
I have two solutions :
#1 : Use divs to display the content of top at the top of the screen, the content of pagecalled underneath and include top at the bottom of page called.
#2 : Use array to store content of pagecalled and then implode echo that content after including top.php.
Is there any other way to get the results I want without using any client side scripting (EG: JS) ?
Problem With Php Form Processor?
August 30th, 2009
phpmoz I have uploaded both of my html form file and php form processor on my server.
you can find my form on http://toolsandtutorials.com/form/Untitled-1.html.html
when I press submit button, instead of sending email and going to thank you page, it shows the php file. How can I fix it?
my documents are as follows:
1- html
<form id="form1" name="form1" method="post" action="http://www.toolsandtutorials.com…
|
|
|
|
|
|
|
|
|
|
Budget:
|
Less than $1,000 $1,000- $2,500 $2,500- $5,000 $5,000- $10,000 $10,000 + |
|
|
Choose… |
|
|
|
|
|
|
|
|
|
2-php
<?php
/* Subject and Email Variables */
$emailSubject = ' Crazy PHP Scripting! ' ;
$webMaster = ' pourya_webdesign@yahoo.com ' ;
/* Gathering Data Variables */
$emailField = $_POST ['email'] ;
$nameField = $_POST ['name'] ;
$phoneField = $_POST ['phone'] ;
$budgetField = $_POST ['budget'] ;
$travelersField = $_POST ['travelers'] ;
$commentsField = $_POST ['comments'] ;
$newsletterField = $_POST ['newsletter'] ;
$body = <<<EOD
Email: $email
Name: $name
Phone Number: $phone
Budget: $budget
Number of Travelers: $travelers
Comments: $comments
Newsletter: $newsletter
EOD;
$headers = “Form: $email\r\n”;
$headers .= “content-type: text/html\r\n”;
$success = mail ($webMaster, $emailsubject, $budy,
$headers) ;
/* results rendered as HTML */
$theResults = <<<EOD
<titl
Help Uploading Files With Php?
August 29th, 2009
phpmoz I looked around on Google for tutorials on uploading files to my server with PHP, but when I use the scripts, it doesn’t do anything.
Shouldn’t there be a username/password/host involved? None of the scripts seemed to mention it at all.
Here are my files:
– input.html –
– /input.html –
– input.php –
0)
{
echo “Error: ” . $_FILES["file"]["error"] . “”;
}
else
{
echo “Upload: ” . $_FILES["file"]["name"] . “”;
echo “Type: ” . $_FILES["file"]["type"] . “”;
echo “Size: ” . ($_FILES["file"]["size"] / 1024) . ” Kb”;
echo “Stored in: ” . $_FILES["file"]["tmp_name"];
}
?>
– /input.php –
Need Help With A Php Script.?
August 27th, 2009
phpmoz I know very little about PHP and was hoping I could find some help here. I have one piece of PHP built into my html that reads:
I Need Help With Php Login Script?
August 26th, 2009
phpmoz Okay I have the script working I have the database working and everything to do with it All I WANT NOW IS HOW DO I RESTRICT ACCESS TO NON-MEMBERS.
I’ve seen something some where that says something like $user=’true’
yeah don’t know how that works but I have these scripts so far
Connect.php
(this works great)
Register.php
Members.php
<?php
session_start();
require_once("connect.php");
// Check his status.
if (!empty($_SESSION[username])) // he got it.
{
echo "You are currently logged in, $_SESSION[username].”;
}
else // bad info.
{
echo “You are currently NOT logged in.”;
}
?>
Login.php
Okay if you see anything that I could change tell me and if this was kind of useless info then just tell me is there just a simple variable that I can put in or whatever just please help me

Posted in
Tags:

