Forum Moderators: coopster
Here is the source code:
<?php
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="mywebsite.com" content="mywebsite.com - Useful small business statistics.">
<meta name="description" content="mywebsite.com - Industry Specific Business Statistics">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="Keywords" content="mywebsite, mywebsite.com, statistics, business statistics, small business, small business statistics, corporations, partnerships, proprietorships, business ratios, financial ratios, financial statistics, tax statistics, benchmarking, industry, industries, income statement, contractors, retailers, retailing, service industries, businesses, Income, profit, healthcare, business analysis, industrial ratios, debt to equity, number of businesses, market size, size of market, industry profitability, sales, sales to assets">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>mywebsite.com - Useful Business Statistics online</title>
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="none, default">
<style type="text/css">
<!--
.style10 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
-->
</style>
</head><body vlink="#0000FF">
<div align="center">
<center>
<table border="1" cellspacing="1" style="border-collapse: collapse; border-left-width: 0; border-right-width: 0; border-top-width: 0" bordercolor="#111111" width="90%" id="AutoNumber44">
<tr>
<td width="30%" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1" align="center">
<font size="6" color="#0000FF" face="Arial"><br>
mywebsite.com</font></td>
<td width="13%" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1">
<img border="0" src="graph.gif" width="100" height="101" align="left"></td>
<td width="45%" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1" align="center">
<p align="left">
<font size="5" color="#FF0000" face="Arial">No Chat ... Just Stats!<br>
</font><b><font face="Arial" size="2">Instant
access to useful financial ratios, business statistics and benchmarks. Effective and understandable analysis of businesses & industries.
</font></b></td>
</tr>
</table>
<p> </p><?
$success_msg = '<p align="center" class="style10"><strong>Your PIN code has been sent to the email address you registered with.</strong></p><p align="center" class="style10">Thank you for using mywebsite.com.</p><p align="center"> <a href="login.php" class="style10">Login</a></p>';$nologin_msg = '<p align="center" class="style10"><strong>That email address does not exist in our database.</strong></p><p align="center" class="style10">Please try again with the email address you registered with.</p><p align="center" class="style10">If you continue to have problems, please contact <a href="mailto:webmaster@mywebsite.com">webmaster@mywebsite.com</a>.</p>';
$emailerror_msg = '<p align="center" class="style10"><strong>There has been an unknown problem emailing your PIN code.</p><p align="center" class="style10">Please contact <a href="mailto:webmaster@mywebsite.com">webmaster@mywebsite.com</a>.</p>';
if($_POST['submit'])
{
require_once 'mydatabasefile.php';
$email = trim($_POST['email']);
$rcdquery = "select pc.pin as pincode
from profiles p, orders o, pin_codes pc
where pc.enabled = '1' and pc.item_id = '16133'
and pc.order_id = o.order_id and o.status = 'P'
and o.order_id = p.order_id and p.login = '".$email."'";
//print $rcdquery.'<br>';$rcdresult = @mysql_query($rcdquery);
if ($rcdresult)
{
$row = @mysql_fetch_array($rcdresult);
if($row['pincode'])
{
$headers = '';
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= 'From: mywebsite.com <webmaster@mywebsite.com>';
$headers.= "\r\nBCC:webmaster@mywebsite.com";$subject = 'Your PIN Code';
$space = '';
$trtd_open = '<tr><td width="100%" valign="top" align="left" class="tdfont">';
$trtd_close = '</td></tr>';
$message = '';
$message = $message.'<html><head><title>Your PIN Code</title>';
$message = $message.'<STYLE>td {font-size:11px; font-family: Verdana}</STYLE></head>';
$message = $message.'<body>';
$message = $message.'<table style="border-collapse:collapse" width="100%" border="1" cellpadding="3" bordercolor="#FFFFFF">';
$message = $message.$trtd_open.'Your or someone using your email address requested your PIN Code to login to mywebsite.com.'.$trtd_close;
$message = $message.$trtd_open.'Your PIN Code: <strong>'.$row['pincode'].'</strong>'.$trtd_close;
$message = $message.$trtd_open.'You may login at <a href="http://wwWebmasterWorldebsite.com/login.php">http://wwWebmasterWorldebsite.com/login.php</a>.'.$trtd_close;
$message = $message.$trtd_open.'Thank you for using mywebsite.com.'.$trtd_close;
$message = $message.'</table></body></html>';
$message = wordwrap($message, 72);
if ( mail($email,$subject,$message,$headers) ) { print $success_msg; }
else { print $emailerror_msg; }
}
else { print $nologin_msg; }
}
else { print $nologin_msg; }
}
else
{
?>
<form name="form" action="forgot_pincode.php" method="POST">
<table width="500" align="center" valign="top">
<tr>
<td valign="bottom" height="25">
<p><font face="Arial"><strong>Please enter your email </strong> </font></td>
<td valign="bottom" height="25"> <input name="email" type="text" size="20">
</td>
</tr>
<tr>
<td colspan="2" height="25">
<p> </p>
<p align="center">
<input type="submit" name="submit" value="Login">
</p>
</td>
</tr>
</table>
</form>
<?
}
?><p align="center"><font face="Arial"><font size="2"> </font> <span style="background-color: #FFFFFF">
<font size="2"><a href="disclosures.htm">Disclosures</a> </font> </span>
<font size="1"> </font><font size="1"> </font><font size="1">
© 2004
<script language="JavaScript">
var d=new Date();
yr=d.getFullYear();
if (yr!=2004)
document.write("- "+yr);
</script> <a href="http://wwWebmasterWorldebsite.com/">mywebsite.com</a> <b> </b>
</font>
<span style="background-color: #FFFFFF">
<a href="aboutus.htm"><font size="2">About Us</font></a></span></font></p>
</body></html>
But when I go to view the page, this is what I see:
mywebsite.comNo Chat ... Just Stats!
Instant access to useful financial ratios, business statistics and benchmarks. Effective and understandable analysis of businesses & industries.
Your PIN code has been sent to the email address you registered with.Thank you for using mywebsite.com.
Login
'; $nologin_msg = 'That email address does not exist in our database.
Please try again with the email address you registered with.
If you continue to have problems, please contact webmaster@mywebsite.com.
'; $emailerror_msg = 'There has been an unknown problem emailing your PIN code.
Please contact webmaster@mywebsite.com.
'; if($_POST['submit']) { require_once 'includes/dbconn.php'; $email = trim($_POST['email']); $rcdquery = "select pc.pin as pincode from xlite_profiles p, xlite_orders o, xlite_pin_codes pc where pc.enabled = '1' and pc.item_id = '16133' and pc.order_id = o.order_id and o.status = 'P' and o.order_id = p.order_id and p.login = '".$email."'"; //print $rcdquery.'
'; $rcdresult = @mysql_query($rcdquery); if ($rcdresult) { $row = @mysql_fetch_array($rcdresult); if($row['pincode']) { $headers = ''; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= 'From: mywebsite.com '; $headers.= "\r\nBCC:webmaster@mywebsite.com"; $subject = 'Your PIN Code'; $space = ''; $trtd_open = ''; $trtd_close = ''; $message = ''; $message = $message.''; $message = $message.''; $message = $message.''; $message = $message.''; $message = $message.$trtd_open.'Your or someone using your email address requested your PIN Code to login to mywebsite.com.'.$trtd_close; $message = $message.$trtd_open.'Your PIN Code: '.$row['pincode'].''.$trtd_close; $message = $message.$trtd_open.'You may login at [wwWebmasterWorldebsite.com...] $message = $message.$trtd_open.'Thank you for using mywebsite.com.'.$trtd_close; $message = $message.'
'; $message = wordwrap($message, 72); if ( mail($email,$subject,$message,$headers) ) { print $success_msg; } else { print $emailerror_msg; } } else { print $nologin_msg; } } else { print $nologin_msg; } } else {?>Please enter your email
Disclosures © 2004 - 2006 mywebsite.com About Us
What seems to be happening is that instead of assigning the value to the variable $success_msg, it's being printed instead, and then it doesn't stop printing until the end of the page. It is as if the page ends in .htm instead of .php (I tried that, and they looked the same). What could cause the server to not parse this file? If I enter an email, I get a PIN code sent, so then it does seem as if the code is being processed by the server.
Anyone have any ideas?
Oh, and sorry I didn't print this as code. I can't get the code tags to work.
[edited by: coopster at 2:24 pm (utc) on Mar. 6, 2006]
[edit reason] fixed sidescroll [/edit]
Are you sure the problem isn't with "forgot_pincode.php?"
JK
thanks for taking the time to review this!
Jolly, the file you copied and ran *is* the forgot_pincode.php file! I literally copied the source code into there (removing the site's name, of course). And Habtom, I do have php running on the system. I've already installed a private directory that has to be logged into and a shopping cart. This was the last little bit I was working on.
Anyway, I've looked over the code, my hubby's looked over the code...there's only 3 pairs of opening and closing PHP parsing tags, and all are correct (you could see it in the posted code anyways).
Thanks again.
figured it out. Apparently, my opening php tags (after the first one) were only
<?
I do that all the time, so why it broke now is beyond me. Anyway, one of the first things I did to fix it yesterday, before I posted here, was change all opening tags to
<?php
But that didn't work. Then just now, fiddling with the code more, I realized I had a space after the opening tags. As soon as I removed them, voila, the page displays correctly!
Does anyone know what versions of php require a full opening tag, no space, why, etc? I program on various host servers, php 4 and 5, with various versions in between, and I've never had this happen before! I just remember reading something somewhere about the space, but never worrying about it as it never seemed to affect me before.
Thanks everyone!
short_open_tag [php.net]
Basic Syntax [php.net]
I never use them personally
I should clarify here as well -- this is a personal choice. The main reason being ... well, the manual page really says it best once again:
Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.
I do a lot of contract programming. It's just a lot easier when you are creating XML/XHTML as well. Glad you got it sorted ;)
I guess this is one of the drawbacks of learning programming from other people's code.
:-)
This thread is going to save my rear some day!
bomburmusicmallet: I'm just sorry that your pain has lead to my further education. :-)
JK