Quantcast
Channel: Tech Support Guy
Viewing all articles
Browse latest Browse all 29110

PhP code showing in browser

$
0
0
Hi,
Im trying to put php in so that people can upload images onto the site, but when I click go to chrome in the editor notepad++ then , the php code is showing in on the site and not the form actually.
Ive changed the purchase.html to purchase.php. this is the page the form is on at the moment.
the site is mainly css/html, just this php for the form uplaod file part.

If anyone can help me, please.

here is the webpage code":
<!DOCTYPE HTML PUBLIC"..//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3org/html/loose.dtd">
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>ALL CRAFTY THINGS</title>
<meta name="description" content="allcraftythings">
<meta name="keywords" content="all things crafty and different, unusual, creative and odd.">
<style type="text/css">
<meta name="description" content="all crafts and things that are unusual and creative, odd"/>


body {
background-image:url ("antbackground.gif") repeat-xy; background-position:center; z-index:2; width:1000px; height:1000px;
}
h1 { display:block; position:absolute; z-index:4; top:15px; left:400px; color:#a7od7c; font-family:Curlz MT;
}
#bankp { display:block; position:absolute; z-index:3; left:450px; top:200px; width:400px;
}
span { color:red; font-size:30px; font-weight:50px;
}
#leftimage1 { display:block; position:absolute; z-index:3; left:16px; top:115px; width:150px; height:899px;
}
#topimage { display:block; position:absolute; z-index:3; left:10px; top:10px;
}
#nav { display:block; position:absolute; z-index:4; left:50px; top:35px; width:500px; color:#d7bb49; text-decoration:none;
}
#nav li { display:inline; position:relative; z-index:4; left:100px; top:35px; width:500px; word-spacing:10px; padding:30px; color:#d7bb49; text-decoration:none;
}
#rightsideimage: { display:block; position:absolute; z-index:2; float:right;
}
#form { display:block; position:absolute; z-index:3; top:200px; left:180px; text-color:red;
}
#instruction { display:block; position:absolute; z-index:3; top:130px; left:200px;
}


</style>
</head>
<script type="text/javascript">
window.ondbclick=do_dblclick;

function do_click(str)
{ alert("thankyou"); }


function do_dbclick()
{alert("Double Clicked"); }

</script>


<body><img src="webpics/antbackground.gif"; width="100%" height="100%">
<h1>ALL CRAFTY THINGS</h1>
<div id="leftimage1"><img src="webpics/leftimage1.gif"; width="150px" height="899px"; alt="leftimage"></div>
<div id="topimage"><img src="webpics/topimage.gif"; width="1000px" height="100px"; alt="topimage"></div>
<div id="nav"><ul><li><a href="Index.html">Home</li><li><a href="Products.html">Products</a></li><li><a href="Purchase."html">Purchase</a></li><li><a href="articles.html">Articles</a></li><li><a href="allcontact.html">Contact</a></li></ul></div>
<div id="instruction">PLEASE FILL IN FORM BY CLICKING CONTACT BUTTON</div><br>
<div id="form">
<a href="http://www.123contactform.com/form-714132/Contact-Lead-Form" class="blueLink13">Contact us</a><br>
<a href="http://www.123contactform.com/form-714132/Contact-Lead-Form" ><img border="0" src="http://www.123contactform.com/images3/contactbutton.gif"></a><br>
</div>

<div id="bankp">
When submitted, Proceed to Purchase<br>
Invoice will be sent to your email after purchase.<p>
Shipping and Payment:
Dispatching within 48hours of Receipt of Payment<br><p>
* Post Office Counter to Counter R40<br>
* Registered Airmail Foreign Rest of The World R100.00<br>
* Insurance: Add 2.00% of the order value
<br>
<p>BANK DEPOSITS. Please write name of item for Reference on Deposit slip.<br>
S.Halstead<br>
STANDARD BANK<br>
ACCOUNT NUMBER: 035358718100150<br>
SORTING CODE: 19701.<br>
SOUTH-AFRICA.<br></p>

<p>PAYPAL: <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="WFHLPD4K2KWB6">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="50" height="50"></form></div>
<p>

<?php
$allowedExts = array("gif", "jpeg", "jpg", "png");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/jpg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "image/x-png")
|| ($_FILES["file"]["type"] == "image/png"))
&& ($_FILES["file"]["size"] < 20000)
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";

if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>

<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>

</body>
</html>

Viewing all articles
Browse latest Browse all 29110

Trending Articles