Jump to content

Can't echo out in my code on my website?!


jarv

Recommended Posts

Please help?!

 

 


<?php
session_start();
include_once("config.php");
$ebits = ini_get('error_reporting');
error_reporting($ebits ^ E_NOTICE);; 

checkLoggedIn("no");

$title="Member Login Page";
if (isset($_POST['RSUSER'])) 
{
$msg = 'You must enter a valid username/password';
header('Location: register.php?msg='.$msg);
}

if(isset($_POST["register"])) {

$rsTown = str_replace(' ','%20',$_POST['rsTown']); 
$rsGender = $_POST['rsGender'];
$RSUSER = $_POST['RSUSER'];
   $RSPASS = $_POST['RSPASS'];
$rsEmail = $_POST['rsEmail'];
$rsMobile = $_POST['rsMobile'];
$rsAge = $_POST['rsAge'];

 $sql = "INSERT INTO members_copy (rsTown, RSGENDER, RSUSER, RSPASS, RSEMAIL, RSMOBILE, RSAGE) VALUES ('$rsTown', '$rsGender', '$RSUSER', '$RSPASS', '$rsEmail', '$rsMobile', '$rsAge')";
//echo $sql;
mysql_query($sql);

//exit();

$to = 'info@mypubspace.com, '.$rsEmail;

$subject = 'Welcome '.$RSUSER.' to My Pub Space';

$message = '
<html>
<head>
  <title>'.$subject.'</title>
</head>
<body>
  <table>
    <tr>
      <td>Name:</td>
	<td>'.$RSUSER.'</td>
    </tr>
    <tr>
      <td>Email:</td>
	<td>'.$rsEmail.'</td>
    </tr>
    <tr>
      <td>Town:</td>
	<td>'.$rsTown.'</td>
    </tr>
 <tr>
      <td>Telephone:</td>
	<td>'.$rsMobile.'</td>
    </tr>
 <tr>
      <td>DOB:</td>
	<td>'.$rsAge.'</td>
    </tr>
 <tr>
      <td>Password:</td>
	<td>'.$RSPASS.'</td>
    </tr>
  </table>
</body>
</html>
';

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'To:' .$to. "\r\n";
$headers .= 'From:' .$rsEmail. "\r\n";

mail($to, $subject, $message, $headers);

$query1 = "SELECT * FROM members_copy WHERE RSUSER = '".$RSUSER."' AND RSPASS = '".$RSPASS."'";
$result1 = mysql_query($query1);
$row1 = mysql_fetch_array($result1);

$_SESSION['USERID']=$row1['USERID'];
$_SESSION['rsTown']=$row1['rsTown'];
$_SESSION['RSEMAIL']=$row1['RSEMAIL'];
$_SESSION['RSUSER']=$row1['RSUSER'];

$pSQL = "INSERT INTO favepub_copy (USERID,PUBID)";
$pSQL = $pSQL."SELECT ".$_SESSION['USERID'].", PUBID ";
$pSQL = $pSQL."FROM pubs ";
$pSQL = $pSQL."WHERE rsTown = '".$_SESSION["rsTown"]."'";

mysql_query($pSQL);

header("Location: registered.php");
}

if(isset($_POST["login"])) {
field_validator("RSUSER", $_POST["RSUSER"], "alphanumeric", 3, 15);
// password must be between 4 and 15 chars - any characters can be used:
field_validator("RSPASS", $_POST["RSPASS"], "string", 3, 15);

if($messages){
	doIndex();
	exit;
}
if( !($row = checkPass($_POST["RSUSER"], $_POST["RSPASS"])) ) {
	// login/passwd string not correct, create an error message:
        $messages[]="Incorrect login/password, try again";
    }
if ($user = checkPass($_REQUEST['RSUSER'], $_REQUEST['RSPASS'])) {
  cleanMemberSession($user['RSUSER'], $user['RSPASS'], $user['USERID']);
} else {
  echo('Login failed');
}  
if($messages){
	doIndex();
	exit;
}
cleanMemberSession($row["RSUSER"], $row["RSPASS"]);

header("Location: main.php");
} else {
doIndex();
}

function doIndex() {
global $messages;

global $title;
}

$query1 = "SELECT DISTINCT rsTown FROM pubs ORDER BY rsTown asc";
$result = mysql_query($query1);
?>
<!doctype html>
<html>
<head>
<title>List of Pubs and Bars in the UK</title>
<meta name="description" content="Pubs and bars in the UK, nightlife for food and drink" />
<meta name="keywords" content="Pubs, bars, List, uk, nightlife, drinking, drinks, beer, lager, food" />
<meta name="Content-Language" content="en-gb" />
<meta name="robots" content="FOLLOW,INDEX" />
<meta name="revisit-after" content="2 days" />
<meta name="copyright" content="jbiddulph.com" />
<meta name="author" content="John Biddulph - Professional web site design and development in the south of england mainly worthing and brighton" />
<meta name="distribution" content="Global" />
<meta name="resource-type" content="document" />
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/ui-lightness/jquery-ui-1.8.6.custom.css" title="default" />
<link rel="alternate stylesheet" type="text/css" href="css/south-street/jquery-ui-1.8.6.custom.css" title="1" />
<link rel="alternate stylesheet" type="text/css" href="css/redmond/jquery-ui-1.8.6.custom.css" title="2" />
<link rel="alternate stylesheet" type="text/css" href="css/custom-theme/jquery-ui-1.8.6.custom.css" title="3" />
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/stylechanger.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>
<script language="javascript">
//<!---------------------------------+
//  Developed by Roshan Bhattarai 
//  Visit http://roshanbh.com.np for this script and more.
//  This notice MUST stay intact for legal use
// --------------------------------->
$(document).ready(function()
{
$("#RSUSER").blur(function()
{
	//remove all the class add the messagebox classes and start fading
	$("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
	//check the username exists or not from ajax
	$.post("user_availability.php",{ RSUSER:$(this).val() } ,function(data)
        {
	  if(data=='no') //if username not avaiable
	  {
	  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
		{ 
		  //add message and change the class of the box and start fading
		  $(this).html('<img src="images/cross.png" /> Sorry, Username taken').addClass('messageboxerror').fadeTo(900,1);
		});		
          }
	  else
	  {
	  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
		{ 
		  //add message and change the class of the box and start fading
		  $(this).html('<img src="images/tick.png" /> Username available').addClass('messageboxok').fadeTo(900,1);	
		});
	  }

        });

});
});
</script>
<script type="text/javascript">
		$(function() {
	$( "#datepicker" ).datepicker({
		changeMonth: true,
		changeYear: true,
		yearRange: '1920:1994'
	});
	// Dialog			
			$('#dialog').dialog({
				autoOpen: false,
				width: 600,
				buttons: {
					"Ok": function() { 
						$(this).dialog("close"); 
					}, 
					"Cancel": function() { 
						$(this).dialog("close"); 
					} 
				}
			});
	// Dialog Link
			$('#dialog_link').click(function(){
				$('#dialog').dialog('open');
				return false;
			});
	//hover states on the static widgets
			$('#dialog_link, ul#icons li').hover(
				function() { $(this).addClass('ui-state-hover'); }, 
				function() { $(this).removeClass('ui-state-hover'); }
			);
});
	</script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script type="text/javascript">
function lookup(inputString) {
	if(inputString.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	} else {
		$.post("rpc.php", {queryString: ""+inputString+""}, function(data){
			if(data.length >0) {
				$('#suggestions').show();
				$('#autoSuggestionsList').html(data);
			}
		});
	}
} // lookup

function fill(thisValue) {
	$('#inputString').val(thisValue);
	setTimeout("$('#suggestions').hide();", 200);
}
function gohere(url) {
location.href = url;
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
</script>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css">
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-2434589-23']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>
<body>
<?php if($messages) { displayErrors($messages); }?>
<header>
<div id="title">
	<h1>My Pub Space
	 <a href="#" onClick="setActiveStyleSheet('default'); return false;"><img src="images/0.gif" width="15" height="15" border="0" alt="css style" /></a>
	 <a href="#" onClick="setActiveStyleSheet('1'); return false;"><img src="images/1.gif" width="15" height="15" border="0" alt="css style" /></a>
	 <a href="#" onClick="setActiveStyleSheet('2'); return false;"><img src="images/2.gif" width="15" height="15" border="0" alt="css style" /></a>
	 <a href="#" onClick="setActiveStyleSheet('3'); return false;"><img src="images/3.gif" width="15" height="15" border="0" alt="css style" /></a>
	 <span>
		 <form method="post" class="textbox" action="search.php">
				Town/City: <input type="text" size="26" class="searchbox" value="" name="RSTOWN" id="inputString" onKeyUp="lookup(this.value);" onBlur="fill();" />

			<div class="suggestionsBox" id="suggestions" style="display: none;">
				<img src="images/upArrow.png" style="position: relative; top: -36px; left: 105px; z-index:1;" alt="upArrow" />
				<div class="suggestionList" id="autoSuggestionsList">
 					</div>
			</div>
			<input type="image" src="images/go.png" height="30" with="30" value="GO" />
		</form>
	</span>		
  </h1>
</div>
</header>
<nav>
<ul>
	<li><a href="default.php">Home</a></li>
	<li><a href="#">Events</a></li>
	<li class="selected"><a href="register.php">Register</a></li>
</ul>
</nav>
<section id="intro">
<header>
	<h2>Your social guide to going down the pub, online!</h2>
</header>
<p>Stuck in town with nowhere to go? Not sure if up the road or down the street is best? Need to be somewhere warm, cosy and friendly. Need a drink?....<br />You've come to the right place, mypubspace has it all!</p>
<img src="images/pub.jpg" alt="pub" /> </section>
<div id="content">
<div id="mainContent">
	<section>
		<article class="blogPost">
			<header>
			<? if ($msg <>"") 
				{
				echo "<div class=\"ui-widget\">
			<div style=\"padding: 0pt 0.7em;\" class=\"ui-state-error ui-corner-all\"> 
				<p style=\"padding-top:18px; font-style:normal;\"><span style=\"float: left; margin-right: 0.3em;\" class=\"ui-icon ui-icon-alert\"></span> 
				<strong>Alert:</strong> $msg</p>
			</div>
		</div>"; 
				} ?>
				<h2>Register to My Pub Space</h2>
				<form name="register" method="post" action="">
				<input name="LoginCount" type="hidden" value="1" /><input name="LastLogin" type="hidden" value="<%= Now()%>" />
					<table width="100%">
						<tr>
							<td class="text">Town:</td>
							<td><span id="spryselect1">
								<select name="rsTown" class="postcodedrop">
									<?PHP while($row = mysql_fetch_array($result))
							{

							echo '<option name=\"menuarea\" value='.$row['rsTown'].' />';
							echo $row['rsTown'];
							}?>
								</select>
								<span class="selectRequiredMsg">Please select an item.</span></span>
	<a href="#" id="dialog_link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin"></span>Why do you need my town?</a>

	<!-- ui-dialog -->
	<div id="dialog" title="Why do you need my town?">
		<p>The TOWN field is an important part in the My Pub Space registration process. My Pub Space has a very large database and needs to determine which town you are from, so that when you register, you will easily be able to access your local pubs. </p>
	</div>

	</td>
						</tr>
						<tr>
							<td class="text">Gender:</td>
							<td>Male
							  <input name="rsGender" type="radio" value="Male" />
					Female
					<input name="rsGender" type="radio" value="Female" /></td>
						</tr>
						<tr>
							<td class="text">Username:</td>
							<td><span id="sprytextfield1">
								<input name="RSUSER" type="text" class="textbox" id="RSUSER" value="" />
   								<span id="msgbox" style="display:none"></span>
								<span class="textfieldRequiredMsg">A value is required.</span></span></td>
						</tr>
						<tr>
							<td class="text" valign="top">Password:</td>
							<td><span id="sprytextfield2">
								<input name="RSPASS" type="password" class="textbox" id="RSPASS" />
								<span class="textfieldRequiredMsg">A value is required.</span></span></td>
						</tr>
						<tr>
							<td class="text" valign="top"></td>
							<td><i>must be between 4 and 15 chars containing alphanumeric chars only</i></td>
						</tr>
						<tr>
							<td class="text">Confirm Password:</td>
							<td><span id="sprytextfield3">
								<input name="RSPASS2" type="password" class="textbox" id="RSPASS2" />
								<span class="textfieldRequiredMsg">A value is required.</span></span></td>
						</tr>
						<tr>
							<td class="text">Email:</td>
							<td><span id="sprytextfield4">
								<input name="rsEmail" type="text" class="textbox" id="rsEmail" />
								<span class="textfieldRequiredMsg">A value is required.</span></span></td>
						</tr>
						<tr>
							<td class="text">Mobile:</td>
							<td><span id="sprytextfield5">
								<input name="rsMobile" type="text" class="textbox" id="rsMobile" />
								<span class="textfieldRequiredMsg">A value is required.</span></span></td>
						</tr>
						<tr>
							<td class="text">Date of Birth:</td>
							<td><span id="sprytextfield6">
								<input name="rsAge" type="text" class="textbox" id="datepicker" />
								<span class="textfieldRequiredMsg">A value is required.</span></span>
								<!-- Datepicker -->
								<div id="datepicker"></div>
								</td>
						</tr>
						<tr>
							<td class="text"></td>
							<td>You must be over 18 to drink in UK pubs</td>
						</tr>
						<tr>
							<td> </td>
							<td><input name="register" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Register"></td>
						</tr>
					</table>
				</form>
			</header>
		</article>
	</section>
</div>
<aside>
	<section>
		<header>
			<h3>My Pub Space</h3>
		</header>
		<form method="post" class="textbox" action="<?php print $_SERVER["PHP_SELF"]; ?>">
			Username: <br />
			<input type="text" class="textbox" name="RSUSER" value="<?php print isset($_POST["RSUSER"]) ? $_POST["RSUSER"] : "" ; ?>">
			Password: <br />
			<input type="password" class="textbox" name="RSPASS">
			<br />
			<br />
			<input name="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Login">
			<br />
		</form>
		<ul>
			<li><button onclick="gohere('register.php')" id="button" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="register.php">Sign up</a></span></button></li>
			<li><button id="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="forgot.php">Forgot Password</a></span></button></li>
		</ul>
	</section>
	<section>
		<header>
			<h3>Landlords Pub Space</h3>
		</header>
		<form method="post" class="textbox" name="Landlord" action="landlord-login.php">
			Username: <br />
			<input type="text" class="textbox" name="rsUser1" value="<?php print isset($_POST["rsUser1"]) ? $_POST["rsUser1"] : "" ; ?>">
			Password: <br />
			<input type="password" class="textbox" name="rsPass1">
			<br />
			<br />
			<input name="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="submit" value="Login">
			<br />
		</form>
		<ul>
			<li><button onclick="gohere('register.php')" id="button" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="register.php">Sign up</a></span></button></li>
			<li><button id="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><a href="forgot.php">Forgot Password</a></span></button></li>
		</ul>
	</section>
	<section>
		<header>
			<h3>Quick Search</h3>
		</header>
		<ul>
			<li>
			<form name="form3" method="post" action="">
              <select name="menu2" onChange="MM_jumpMenu('parent',this,0)" class="textbox">			
                <option value="">Search by Town...</option>
				<? 					
				$town_pubs = mysql_query("SELECT DISTINCT RSTOWN, COUNT(PubID) As PubCount FROM pubs GROUP BY RSTOWN  ORDER BY RSTOWN ASC")
				?>

					<?php while($row1 = mysql_fetch_array($town_pubs))
					{
					echo '<option value="town_pubs.php?rsTown='.$row1['RSTOWN'].'">'.$row1['RSTOWN'].' ('.$row1['PubCount'].')</option>'; 
					}
					?>
            </select>
           </form>
			</li>
			<li>
			<form name="form3" method="post" action="">
              <select name="menu2" onChange="MM_jumpMenu('parent',this,0)" class="textbox">			
                <option value="">Search by County...</option>
				<? 					
				$county_pubs = mysql_query("SELECT DISTINCT RSCOUNTY, COUNT(PubID) As PubCount1 FROM pubs GROUP BY RSCOUNTY  ORDER BY RSCOUNTY ASC")
				?>

					<?php while($row1 = mysql_fetch_array($county_pubs))
					{
					echo '<option value="county_pubs.php?rsCounty='.$row1['RSCOUNTY'].'">'.$row1['RSCOUNTY'].' ('.$row1['PubCount1'].')</option>'; 
					}
					?>
            </select>
           </form>
			</li>
		</ul>
	</section>
</aside>
</div>
<footer>
<div>
	<section id="about">
		<header>
			<h3>About</h3>
		</header>
		<p>My Pub Space is one of the largest and newest UK Pubs and Bars Listing sites online. It is not just a list of pubs, we have added a touch of interactive social pubbing experience online! Once registered, you can view information on pubs in your area, write reviews, organise your evenings out!</p>
	</section>
	<section id="blogroll">
		<header>
			<h3>Links</h3>
		</header>
		<ul>
			<li><a href="http://www.drinkaware.co.uk" target="_blank">DRINKAWARE.co.uk</a></li><li><a href="http://www.cheaphotelbookings.com" target="_blank" title="Cheap Hotel Bookings">cheaphotelbookings.com</a></li><li><a href="http://www.cheaproomslondon.co.uk/" target="_blank" title="Cheap Rooms London">cheaproomslondon.co.uk</a></li><li><a href="http://www.hirecars.co.uk/" target="_blank" title="Hire Cars">hirecars.co.uk</a></li>			</ul>
	</section>
	<section id="popular">
		<header>
			<h3>Popular</h3>
		</header>
		<ul>
			<li><a href="#">Coming Soon!</a></li>
		</ul>
	</section>
</div>
</footer>
<script type="text/javascript">
<!--
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4");
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
//-->
</script>
</body>
</html>

Link to comment
Share on other sites

what about setting error reporting to E_ALL? =P

 

if (isset($_POST['RSUSER'])) 
{
$msg = 'You must enter a valid username/password';
header('Location: register.php?msg='.$msg);
}

I don't get this part, you check if it is set, and if it it is then you ask them to enter a valid username/password??

 

Also you use two different very similar variables... $message and $messages... and you even make one of them global. Don't make it global ;\

 

 

I need to eat now, so what exactly is not echoing out? =P

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.