PHP - Following Simple Cms Tutorial -- Page Loads Blank
Hey guys, need some help real quick.
I'm using this walkthrough over at css-tricks, some might be familiar with it by now? Anyway, I've followed the instructions exactly. It's supposed to display a simple form that you fill out and submit, which then updates the MYSQL database. However, whenever i load display.php in my browser, all i get is a blank page, and there are no notifications or errors to be in seen in the console. Any help is greatly appreciated. Thanks! Here's my code: SimpleCMS.zip 3.7KB 0 downloads display.php <!DOCTYPE html> <html lang="en"> Similar TutorialsI found this amazing tutorial and i try to change it for a different database, but when i do a search it never finds anything. <?php $dbHost = 'localhost'; // localhost will be used in most cases // set these to your mysql database username and password. $dbUser = 'root'; $dbPass = '123'; $dbDatabase = 'ergasia2'; // the database you put the table into. $con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); // Set up our error check and result check array $error = array(); $results = array(); // First check if a form was submitted. // Since this is a search we will use $_GET if (isset($_GET['search'])) { $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); // remove any html/javascript. if (strlen($searchTerms) < 3) { $error[] = "Ο όρος αναζήτησις πρέπει να είναι έχει περισσότερους από 3 χαρακτήρες."; }else { $searchTermDB = mysql_real_escape_string($searchTerms); // prevent sql injection. } // If there are no errors, lets get the search going. if (count($error) < 1) { $searchSQL = "SELECT Fname, Surname, StreetName, status FROM EMPLOYEES WHERE "; // grab the search types. $types = array(); $types[] = isset($_GET['Fname'])?"`Fname` LIKE '%{$searchTermDB}%'":''; $types[] = isset($_GET['Surname'])?"`Surname` LIKE '%{$searchTermDB}%'":''; $types[] = isset($_GET['StreetName'])?"`StreetName` LIKE '%{$searchTermDB}%'":''; $types = array_filter($types, "removeEmpty"); // removes any item that was empty (not checked) if (count($types) < 1) $types[] = "`sbody` LIKE '%{$searchTermDB}%'"; // use the body as a default search if none are checked $andOr = isset($_GET['matchall'])?'AND':'OR'; $searchSQL .= implode(" {$andOr} ", $types) . " ORDER BY `stitle`"; // order by title. $searchResult = mysql_query($searchSQL) or trigger_error("There was an error.<br/>" . mysql_error() . "<br />SQL Was: {$searchSQL}"); if (mysql_num_rows($searchResult) < 1) { $error[] = "The search term provided {$searchTerms} yielded no results."; }else { $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$i}: {$row['stitle']}<br />{$row['sdescription']}<br />{$row['sbody']}<br /><br />"; $i++; } } } } function removeEmpty($var) { return (!empty($var)); } ?> <html> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>My Simple Search Form</title> <style type="text/css"> #error { color: red; } </style> <body> <?php echo (count($error) > 0)?"The following had errors:<br /><span id=\"error\">" . implode("<br />", $error) . "</span><br /><br />":""; ?> <form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm"> Search For: <input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" /><br /> Search In:<br /> Body: <input type="checkbox" name="body" value="on" <?php echo isset($_GET['body'])?"checked":''; ?> /> | Title: <input type="checkbox" name="title" value="on" <?php echo isset($_GET['title'])?"checked":''; ?> /> | Description: <input type="checkbox" name="desc" value="on" <?php echo isset($_GET['desc'])?"checked":''; ?> /><br /> Match All Selected Fields? <input type="checkbox" name="matchall" value="on" <?php echo isset($_GET['matchall'])?"checked":''; ?><br /><br /> <input type="submit" name="submit" value="Search!" /> </form> <?php echo (count($results) > 0)?"Your search term: {$searchTerms} returned:<br /><br />" . implode("", $results):""; ?> </body> </html> The table which i use is the following ---------------- |EMPLOYEES| ---------------- |ssn | ---------------- |Fname ---------------- |postal code | ---------------- |salary | ---------------- |street name| ---------------- |street number | ------------------- |surname | ----------------- |UnionMembershipNumber| --------------------------------- |password | ----------------- |status | ---------------- im a complete novice. im using one of the tutorials on here to make a simple search form. the bit of script that i think outputs the results is $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = "{$i}: {$row['placing']},   {$row['racedate']},   {$row['horseid']}<br /><br />"; $i++; how do i make these results appear in a table, and how would i make it so there was a link on the date that clicked would show all the races on that day? sorry i advance as this is probably the most dumb of questions! Heya guys The other day i got the error: [28-Jan-2011 12:07:40] PHP Warning: POST Content-Length of 16970062 bytes exceeds the limit of 8388608 bytes in Unknown on line 0 Basically this means my server provider doesn't allow the total $_POST data on one page to be above 8MB, and being on shared hosting i cannot fix this So, whats the best way to get around this? Ajax? Options and code samples please I think this will help a lot of people as i haven't seen many answers after lots of research on the web. Thanks Danny. This is my code [Page where user uploads files -Edit-Page.php] <?php session_start(); if ($_SESSION['adminlogin'] == 1){ //Run } else { header('Location: Log-In.php'); exit; } $url = $_POST['url']; ?> <!DOCTYPE HTML> <html lang="en-GB"> <head> <meta charset="utf-8"> <!--Search Engine Meta Tags--> <meta name="author" content="Worldwide Lighthouses"> <meta name="keywords" content="Lighthouses,Lightships,Trinity House,Fog Signals,Fog Horns,Fresnel"> <meta name="description" content="Worldwide Lighthouses is the number 1 source of information, pictures and videos on the Subject of Lighthouses and Lightships"> <!--Stylesheets/Javascript--> <link rel="stylesheet" href="../../Page-Layout.css" media="screen and (min-width: 481px)"> <link rel="stylesheet" href="../../Mobile-Page-Layout.css" media="only screen and (max-width:480px)"> <!--Mobile Browser Support--> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"> <!--IE Support--> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <link rel="stylesheet" href="../Page-Layout.css"><![endif]--> <meta name="application-name" content="Worldwide Lighthouses"> <meta name="msapplication-starturl" content="http://worldwidelighthouses.com/"> <meta name="msapplication-tooltip" content="Worldwide Lighthouses: Your number one source of Lighthouse Information, Videos and Pictures"> <meta name="msapplication-task" content="name=Lighthouses;action-uri=http://worldwidelighthouses.com/Lighthouses.php;icon-uri=http://worldwidelighthouses.com/IE9/Lighthouses.ico"> <meta name="msapplication-task" content="name=Lightships;action-uri=http://worldwidelighthouses.com/Lightships.php;icon-uri=http://worldwidelighthouses.com/IE9/Lightships.ico"> <meta name="msapplication-task" content="name=Fog Signals;action-uri=http://worldwidelighthouses.com/Fog-Signals.php;icon-uri=http://worldwidelighthouses.com/IE9/Fog-Signals.ico"> <meta name="msapplication-task" content="name=Glossary;action-uri=http://worldwidelighthouses.com/Glossary.php;icon-uri=http://worldwidelighthouses.com/IE9/Glossary.ico"> <title>Edit Page | Worldwide Lighthouses</title> <script> <!-- function fixForm(select) { var inputCount = parseInt(select); var newHTML = ''; for(i=1; i<=inputCount; i++) { newHTML += '<label>Thumbnail '+i+' | Size: 200px x 430px | Format: PNG</label>\n'+ '<input type="file" name="thumbnail'+i+'" size="100" accept="image/x-png" class="File">\n'+ '<label>Accompanying Large Image | Size : Large | Format: PNG</label>\n'+ '<input type="file" name="large'+i+'" size="100000000" accept="image/x-png" class="File"><br><br>\n' ; if(i < inputCount) { newHTML += '<br>\n\n'; } else { newHTML += '\n\n'; } } document.getElementById('formInputs').innerHTML=newHTML; } //--> function setVisibility(id, visibility) { document.getElementById(id).style.display = visibility; } </script> <style> input:focus, textarea:focus { background:#9CDCCB; } form#Page { width:80%; margin-top:10px; margin-bottom:10px; margin-left:auto; margin-right:auto; background-colour: rgb(33, 33, 33); /* The Fallback */ background: rgba(33, 33, 33, 0.8); border-radius:10px; padding:20px; } label { display:block; width:100%; color:#FFF; } .TitleInput { width:660px; } .info { width:260px; height:80px; } .url { width:660px; } #IntroParagraph{ width:660px; height:120px; } #MainParagraph{ width:660px; height:240px; } .File { width:660px; } #loading { position: fixed; top: 25%; left: 25%; width: 50%; height: 50%; background:url(../../layout-resources/article-background.jpg); border:3px #333 solid; border-radius:10px; text-align:center; color:#1D5A4B; display:none; } #loadinginfo { position: absolute; top: 25%; left: 25%; width: 50%; height: 50%; } </style> </head> <body> <div id="loading"><div id="loadinginfo"><img src="upload.gif" width="128" height="15" alt="Uploading"><br><h1>Uploading images...</h1><p>Please Wait, this could take a while.</p></div></div> <header> <h1 id="WWLH">Worldwide Lighthouses</h1> <form method="get" action="http://www.worldwidelighthouses.com/Search/search.php" id="Search-Box"> <input type="search" placeholder="Search Worldwide Lighthouses" name="query" id="query" size="30" value="" autocomplete="off"> <input type="submit" value="Search"> <input type="hidden" name="search" value="1"> </form> </header> <nav> <ul id="Nav"> <li class="MenuButton" id="Index"><a href="http://www.worldwidelighthouses.com/Index.php"><p class="Nav">Home</p></a></li> <li class="MenuButton" id="Lighthouses"><a href="http://www.worldwidelighthouses.com/Lighthouses.php"><p class="Nav">Lighthouses</p></a></li> <li class="MenuButton" id="Lightships"><a href="http://www.worldwidelighthouses.com/Lightships.php"><p class="Nav">Lightships</p></a></li> <li class="MenuButton" id="FogSignals"><a href="http://www.worldwidelighthouses.com/Fog-Signals.php"><p class="Nav">Fog Signals</p></a></li> <li class="MenuButton" id="Daymarks"><a href="http://www.worldwidelighthouses.com/Daymarks.php"><p class="Nav">Daymarks</p></a></li> <li class="MenuButton" id="Buoys"><a href="http://www.worldwidelighthouses.com/Buoys.php"><p class="Nav">Buoys</p></a></li> <li id="MenuButtonLast"><a href="http://www.worldwidelighthouses.com/Glossary.php"><p class="Nav">Glossary</p></a></li> </ul> </nav> <?php if ($_SESSION['adminlogin']==1) { echo '<div id="logout"> <div style="float:left; width:30%; text-align:left;!important"> <a href="Log-In-Accept-Deny.php">Back to Admin Home</a> </div> <div style="float:right; width:70%;"> <a href="Logout.php">Log Out of Admin</a> <p style="font-size:10px;">Always Sign Out when Finished!</p> </div></div>';} ?> <article> <h1 class="Title">Enter Page Information</h1> <div class="Textbox"> <form action="Preview-and-Confirm-Page-Changes.php" enctype="multipart/form-data" method="post" id="Page"> <input type="hidden" value="<?php echo $url ?>" name="url"> <label>Type of Page</label> <br> <input type="radio" name="typeofpage" value="englandtrinityhouse" checked> English - Trinity House <br> <input type="radio" name="typeofpage" value="englandprivate"> English - Privately Owned <br> <input type="radio" name="typeofpage" value="welshtrinityhouse"> Welsh - Trinity House <br> <input type="radio" name="typeofpage" value="welshprivate"> Welsh - Privately Owned <br> <input type="radio" name="typeofpage" value="northernlighthouseboard"> Scottish - Northern Lighthouse Board <br> <input type="radio" name="typeofpage" value="scottishprivate"> Scottish - Privately Owned <br> <input type="radio" name="typeofpage" value="channelislandstrinityhouse"> Channel Islands - Trinity House <br> <input type="radio" name="typeofpage" value="channelislandsprivate"> Channel Islands - Privately Owned <br> <input type="radio" name="typeofpage" value="francelb"> French - Lighthouse Board <br> <input type="radio" name="typeofpage" value="franceprivate"> French - Privately Owned <br> <input type="radio" name="typeofpage" value="switzerland"> Switzerland <br> <input type="radio" name="typeofpage" value="norway"> Norway <br> <input type="radio" name="typeofpage" value="lightshiptrinityhouse"> Lightship - Trinity House <br> <input type="radio" name="typeofpage" value="lightshipprivate"> Lightship - Private <br> <br> <label>Folder Name (Usually title of page with hyphens eg. Beachy-Head) Just provide the last section</label> <input type="text" name="foldername"> <label>Title of Page<br>(eg.Beachy Head Lighthouse. Dont Include | Worldwide Lighthouses, this is automatically added)</label><input type="text" placeholder="Title of Page" name="title" class="TitleInput"><br><br> <input type="hidden" name="MAX_FILE_SIZE" value="100000000000000000000000000000" /> <label>Main Page Image | Size: 170x170px Format:PNG</label><input type="file" name="mainpageimage" size="100" accept="image/x-png" class="File"><br><br> <h2>Information</h2> <label>Date Established:</label><input type="text" placeholder="Date Established" name="established" required="true" class="TitleInput"><br> <label>Current Lighthouse Built:</label><input type="text" placeholder="Date Current Lighthouse Established" name="currentlighthousebuilt" required="true" class="TitleInput"><br> <label>Height (In Metres, Will automatically convert to show feet and metres on same page)</label><input type="number" placeholder="Heigtht in metres" name="height" required="true" class="TitleInput"><br> <label>Date Automated:</label><input type="text" placeholder="Date Automated" name="automated" required="true" class="TitleInput"><br> <label>Date Electrified:</label><input type="text" placeholder="Date Electrified" name="electrified" required="true" class="TitleInput"><br> <label>Range (In Nautical Miles):</label><input type="number" placeholder="Range in Nautical Miles" name="range" required="true" class="TitleInput"><br> <label>Operator:</label><input type="text" placeholder="Operator" name="operator" required="true" class="TitleInput"><br><br> <h2>Media</h2> <label>Link to Video Page: (if none leave blank)</label><input type="url" name="video"> <label>Link to Audio Page: (if none leave blank)</label><input type="url" name="audio"> <h2>Write up</h2> <label>Paragraph:</label><textarea id="MainParagraph" name="paragraph"></textarea> <h2>Thumbnails</h2> <label> Number of Thumbnails </label> <select name="numberofthumbnails" onChange="fixForm(this.options[selectedIndex].text);"> <option value="0">0</option> <option value="2">2</option> <option value="4">4</option> <option value="6">6</option> <option value="8">8</option> <option value="10">10</option> <option value="12">12</option> <option value="14">14</option> <option value="16">16</option> <option value="18">18</option> <option value="20">20</option> <option value="22">22</option> <option value="24">24</option> </select> <br><br> <span id="formInputs"> </span> <input type="submit" value="Preview Page" onClick="setVisibility('loading', 'block');"> </form> <?php if ($_SESSION['adminlogin'] == 1){ echo "<br>Logged in on server side."; }?> </div> </article> <footer> <ul> <li><a href="http://www.worldwidelighthouses.com/About.php">About</a></li> <li><a href="http://www.worldwidelighthouses.com/Contact-us.php">Contact</a></li> <li><a href="http://www.worldwidelighthouses.com/Use-Our-Media.php">Use our media</a></li> <li><a href="http://www.worldwidelighthouses.com/Search/search.php">Search</a></li> <li><a href="http://www.worldwidelighthouses.com/Social-Networking.php">Social</a></li> <li><a href="#Top">Back to top</a></li> </ul> <br> <br> &#169; Worldwide Lighthouses <?php echo date("Y"); ?> </footer> </body> I've been trying to do this for a while and can't understand why I'm getting a 503 Error. I'm making a download center which counts the downloads of each file, and the only thing I can't get to work is the actual downloading of the file. It took a while for me to realize I was having an issue as my code works perfectly on my home server.
Here is my current code:
function download_file_to_user($target_file, $filename) { Hi All. I have been really struggling with this for a while! When a URL loads I wish to load with parameters entered & those parameters entered on a page but cannot get my head round it. Any help will be much appretiated... So when a user navigates to www.test.com/page.php I wish to to actually pull back www.test.com/page.php?term=&submit=Go Any help will be really really appretiated. PHP 2.11.10 I have a php page that loads. It takes about 4-5 seconds because I am constructing a select/combo box with 2400 records. While the whole page is loading I would like to make the cursor an hourglass while the cursor is over the PHP page, so the user cannot click on anything until the page is done loading. During production I expect 10,000 records in this combo box so disabling user input while the page is loading becomes more important. How do I do that? How do I stop the below form from submitting if any field or atleast if field Weight is blank? also an error echo would be great. I have been trying to figure this out but cant do it. Code: [Select] <table width="500" border="0" align="center" cellpadding="10" cellspacing="0"> <tr> <td> <form action="insert.php" method="post"> <input name="Date" type="hidden" value="<?php PRINT "$today"; ?>" /> First Name: <input type="text" name="Firstname" /><br><br> Last Name: <input type="text" name="Lastname" /><br><br> Weight: <input type="text" name="Weight" /><br><br> <input type="submit" value="Submit Profile" /> </form> </td> </tr> </table> I am using Magento (Ver 1.9.x) If i try with my localhost success url like, http://192.168.1.65/magento/index.php/checkout/onepage/success/ and return success message with order id. if i try with live, success url like, https://abc.in/payubiz/redirect/success/ success page like blank page. How to solve the issue? Code : https://github.com/ZusZus/Payubiz Edited February 4, 2020 by aveevaCan someoneplease help, I need to setup an error page like IF Username and Password are wrong then show an error also if there is no username or password in the fields and I just click LOGIN, I get a blank page?! Can someone please help me here or point me to a relevant tutorial? thanks here is my page: http://www.retroandvintage.co.uk/default.php here is my code: Code: [Select] <?php session_start(); include_once("config.php"); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); /* Login script: This script does the following: Checks that the user is NOT already logged in - if they are they are redirected to the members page by the 'checkLoggedIn()' function. Checks if the login form has been submitted - if so, the 'login' and 'password' fields are checked to ensure they are of the correct format and length. If there are any problems here an error is added to the $messages array and then the script executes the 'doIndex()' function - this function basically outputs the main 'index' page for this script - ie the login form. If there are no problems with the previous step, the 'login' and 'password' field data is passed to the 'checkPass' function to check that an entry exists in the 'users' table for that login/password pair. If nothing is returned from the 'checkPass()' function, an error is added to the $messages array and the 'doIndex()' function is called as above. If a row of data is returned from the 'users' table, the data is passed to the 'cleanMemberSession()' function - which initializes session variables and logs the user in. The user is then forwarded to the members page. If the form hasn't yet been submitted, then the 'doIndex()' function is called and the login page is displayed. */ // Check user not logged in already: checkLoggedIn("no"); // Page title: $title="Member Login Page"; // if $submit variable set, login info submitted: if(isset($_POST["submit"])) { // // Check fields were filled in // // login must be between 4 and 15 chars containing alphanumeric chars only: field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 4, 15); // password must be between 4 and 15 chars - any characters can be used: field_validator("rsPass", $_POST["rsPass"], "string", 4, 15); // if there are $messages, errors were found in validating form data // show the index page (where the messages will be displayed): if($messages){ doIndex(); // note we have to explicity 'exit' from the script, otherwise // the lines below will be processed: exit; } // OK if we got this far the form field data was of the right format; // now check the user/pass pair match those stored in the db: /* If checkPass() is successful (ie the login and password are ok), then $row contains an array of data containing the login name and password of the user. If checkPass() is unsuccessful however, $row will simply contain the value 'false' - and so in that case an error message is stored in the $messages array which will be displayed to the user. */ if( !($row = checkPass($_POST["rsUser"], $_POST["rsPass"])) ) { // login/passwd string not correct, create an error message: $messages[]="Incorrect login/password, try again"; } /* If there are error $messages, errors were found in validating form data above. Call the 'doIndex()' function (which displays the login form) and exit. */ if($messages){ doIndex(); exit; } /* If we got to this point, there were no errors - start a session using the info returned from the db: */ cleanMemberSession($row["rsUser"], $row["rsPass"]); // and finally forward user to members page (populating the session id in the URL): header("Location: main.php"); } else { // The login form wasn't filled out yet, display the login form for the user to fill in: doIndex(); } /* This function displays the default 'index' page for this script. This consists of just a simple login form for the user to submit their username and password. */ function doIndex() { /* Import the global $messages array. If any errors were detected above, they will be stored in the $messages array: */ global $messages; /* also import the $title for the page - note you can normally just declare all globals on one line - ie: global $messages, $title; */ global $title; } // drop out of PHP mode to display the plain HTML: ?> <!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" /> <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 type="text/javascript"> $(function(){ // Accordion $("#accordion").accordion({ header: "h3" }); // Tabs $('#tabs').tabs(); // 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; }); // Datepicker $('#datepicker').datepicker({ inline: true }); //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 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); } </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> <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 class="selected"><a href="default.php">Home</a></li> <li><a href="#">Pubs</a></li> <li><a href="#">Members</a></li> <li><a href="#">Events</a></li> <li><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> <h2>Pubs and Bars UK Listing</h2> </header> <?php $tableName="pubs"; $targetpage = "default.php"; $limit = 20; $query = "SELECT COUNT(*) as num FROM $tableName"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages['num']; $stages = 3; $page = mysql_escape_string($_REQUEST['page']); if( isset($_REQUEST['page']) && ctype_digit($_REQUEST['page']) ) { $page = (int) $_GET['page']; $start = ($page - 1) * $limit; }else{ $start = 0; } // Get page data $query1 = "SELECT * FROM $tableName LIMIT $start, $limit"; $result = mysql_query($query1); // Initial page num setup if ($page == 0){$page = 1;} $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $LastPagem1 = $lastpage - 1; $paginate = ''; if($lastpage > 1) { $paginate .= "<div class='paginate'>"; // Previous if ($page > 1){ $paginate.= "<a href='$targetpage?page=$prev'>previous</a>"; }else{ $paginate.= "<span class='disabled'>previous</span>"; } // Pages if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } } elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few? { // Beginning only hide later pages if($page < 1 + ($stages * 2)) { for ($counter = 1; $counter < 4 + ($stages * 2); $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } $paginate.= "..."; $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>"; $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>"; } // Middle hide some front and some back elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2)) { $paginate.= "<a href='$targetpage?page=1'>1</a>"; $paginate.= "<a href='$targetpage?page=2'>2</a>"; $paginate.= "..."; for ($counter = $page - $stages; $counter <= $page + $stages; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } $paginate.= "..."; $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>"; $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>"; } // End only hide early pages else { $paginate.= "<a href='$targetpage?page=1'>1</a>"; $paginate.= "<a href='$targetpage?page=2'>2</a>"; $paginate.= "..."; for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } } } // Next if ($page < $counter - 1){ $paginate.= "<a href='$targetpage?page=$next'>next</a>"; }else{ $paginate.= "<span class='disabled'>next</span>"; } $paginate.= "</div>"; } echo $total_pages.' Results'; // pagination echo $paginate; ?> <div id="accordion"> <?php while($row = mysql_fetch_array($result)) { echo '<div><h3><a href=\"#\">'.$row['rsPubName'].'</a></h3><div>'.$row['rsAddress'].'<br />'.$row['rsTown'].', '.$row['rsCounty'].'<br />'.$row['rsPostCode'].'<br /><br />Region: '.$row['Region'].'<br /><br />Telephone: '.$row['rsTel'].'</div></div>'; } ?> </div> </article> </section> </div> <aside> <section> <header> <h3>Members Login Area</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 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="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><a href="#">Coming Soon!</a></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="#">Coming Soon!</a></li> </ul> </section> <section id="popular"> <header> <h3>Popular</h3> </header> <ul> <li><a href="#">Coming Soon!</a></li> </ul> </section> </div> </footer> </body> </html> elloo, i have php script that works fine on a dev server however on staging server it is a blank page. i have set 'error_reporting(E_ALL) ' and ini_set('dsiplay_errors', 1) however only information i get is some notices and no fatal errors. i'm aware that php stops executing if there is a fatal error (and appears as blank screen), is there some sort of directive in 'php.ini' which stop php from executing when there are notices. thanks in advanced Hello (I am posting to php because I don't know what is giving the problem), Let's say I have these links into my <div id="header>: Home Items Faq Cart and I use a Jquery to open my links inside my <div id="content"> The problem is between Items and Cart links (I am testing in ie9 and firefox 4): I am using an ajax code (I don't know if the problem is in here) to add items to cart and stay at my items page (not sending me to the cart page). Now, when I first load the page or is refreshed, everything works fine. BUT after I add something to the Cart if I visit the Cart.php and then return to my Items.php, when I click on the next item to be added I get a Blank page. Note: the Item is added normaly. This is happening also, when I click the UPDATE button inside my cart php to update quantities. Any suggestion? Thank you. (I don't know if is ajax, php, jquery or all three of them) Why am I getting a blank page with no errors with the following code? Code: [Select] <?php session_start(); if (isset($_SESSION['cart'])){ foreach ($_SESSION['cart'] as $key => $value){ echo "Product Number $key Quantity $value<br />"; } } require_once("functions.php"); //DatabaseConnection(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ordering doggy treats</title> <link href="doggyTreats.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #order { margin-right: auto; margin-left: auto; } .orderRow{ padding-bottom: 50px; } h2 { text-align: center; } </style> </head> <body> <?php $errors=array(); if(isset($_POST['submit'])){ validate_input(); if(count($errors) !=0) { display_form(); } else { display_form(); } function validate_input() { global $errors; if($_POST["fname"] == " ") { $errors['fname']="<span style=\"color:red;\"> Please enter your first name </span>"; } } } //logo(); navBar(); function display_form() { global $errors; extract($_POST); if(!isset($submit)) { ?> <table id="order"> <form action="checkOut.php" method="post" name="checkOut"> <caption><h2>Customer Information </h2> </caption> <tr class = "orderRow"> <td> First Name:<br /> <input name="fname" type="text" size="10" maxlength="20" value="<?php echo $_POST[fname];?>"/> </td> <td> Last Name: <br /> <input name="lname" type="text" size="10" maxlength="20" /> </td> <td> Address: <br /> <input name="address " type="text" size="25" /> </td> </tr> <tr class = "orderRow"> <td> City: <br /> <input name="city " type="text" size="15" maxlength="20" /> </td> <td> State: <br /> <select name = "state"> <option selected value ="Please choose a state"/> Please choose a state</option> <option value = "AL" />AL</option> <option value = "AK" />AK</option> <option value = "AR" />AR</option> <option value = "AZ" />AZ <option value = "CA" />CA <option value = "CO" />CO <option value = "CT" />CT <option value = "DE" />DE <option value = "DC" />DC <option value = "FL" />FL <option value = "GA" />GA <option value = "HI" />HI <option value = "IA" />IA <option value = "ID" />ID <option value = "IL" />IL <option value = "IN" />IN <option value = "KS" />KS <option value = "KY" />KY <option value = "LA" />LA <option value = "MA" />MA <option value = "ME" />ME <option value = "MD" />MD <option value = "MI" />MI <option value = "MN" />MN <option value = "MO" />MO <option value = "MS" />MS <option value = "MT" />MT <option value = "NC" />NC <option value = "ND" />ND <option value = "NE" />NE <option value = "NH" />NH <option value = "NJ" />NJ <option value = "NM" />NM <option value = "OH" />OH <option value = "OK" />OK <option value = "OR" />OR <option value = "PA" />PA <option value = "RI" />RI <option value = "SC" />SC <option value = "SD" />SD <option value = "TN" />TN <option value = "TX" />TX <option value = "UT" />UT <option value = "VA" />VA <option value = "VT" />VT <option value = "WA" />WA <option value = "WI" />WI <option value = "WV" />WV <option value = "WY" />WY </select> </td> <td> Zip Code:<br /> <input name="zipcode" type="text" size="5" maxlength="5" /> </td> </tr> <tr class = "orderRow"> <td> Phone <br /> Please include area code <br /> <input name="phone" type="text" size="13" maxlength="13" /> </td> <td> Fax:<br /> <input name="" type="text" size="13" maxlength="13" /> </td> <td> Email: <br /> <input name="email " type="text" size="15" maxlength="30" /> </td> </tr> <tr class = "orderRow"> <td> Please choose method of payment: <br /> Check <input name="check " type="radio" value="Check " /> Money Order <input name="money " type="radio" value="Money order " /><br />PayPal<input name="paypal" type="radio" value="Paypal" /> </td> </tr> <tr> <td colspan = "6"> <h2> Pet Information </h2></td> </tr> <tr> <td> Name: <br /> <input name="petName" type="text" size="10" maxlength="20" /> </td> <td> Age: <br /> <select name="age"> HEREDOC; for ($age =1; $age <=20; $age ++) { print "<option value=\"age\"> $age</option>"; } echo <<<HEREDOC </select> </td> <td> Breed:<br /> <select name = "breed"> <option selected value ="Please choose a breed"/> Please choose a breed <option value = "I don't know" />I don't know <option value = "Affernpincher" />Affernpincher <option value = "Afghan Hound" />Afghan Hound <option value = "Airedale Terrier" /> Airedale Terrior <option value = "Akita" /> Akita <option value = "Alaskan Malamute" /> Alaskan Malamute <option value = "Standard American Eskimo Dog"/> Standard American Eskimo Dog <option value = "Miniature American Eskimo Dog"/>Miniature American Eskimo Dog <option value = "Toy American Eskimo Dog"/> Toy American Eskimo Dog <option value = "American Foxhound" /> American Foxhound <option value = "American Staffordshire Terrier" /> American Staffordshhire Terrier <option value = "American Water Spaniel" /> American Water Spaniel <option value = "Australian Shepherd Dog"/> Anatolian Shepherd Dog <option value = "Australian Cattle Dog"/> Australian Cattle Dog <option value = "Australian Shepherd"/> Australian Shepherd <option value = "Australian Terrier" /> Australia Terrier <option value = "Basenji" /> Basenji <option value = "Basset Hound" /> Basset Hound <option value = "Beagle" /> Beagle <option value = "Bearded Collie" /> Bearded Collie <option value = "Beauceron" /> Beauceron <option value = "Bedington Terrier"/> Bedington Terrier <option value = "Belgin Malinois"/> Belgin Malinois <option value = "Belgian Sheepdog"/> Belgian Sheepdog <option value = "Belgian Tervuren"/> Belgian Tervuren <option value = "Bernese Mountain Dog"/> Bernese Mountain Dog <option value = "Bichon Frise"/> Bichon Frise <option value = "Black and Tan Greyhound" /> Black and Tan Greyhound <option value = "Black Russian Terrier" /> Black Russian Terrier <option value = "Bloodhoung" /> Bloodhound <option value = "Border Collie" /> Border Collie <option value = "Border Terrier"/> Border Terrier <option value = "Borzoi"/> Borzoi <option value = "Boston Terrier"/> Boston Terrier <option value = "Bouvier des Flandres"/> Bouvier des Flandres <option value = "Boxer"/> Boxer <option value = "Briard"/> Briard <option value = "Brittany" /> Brittany <option value = "Brussels Griffon" /> Brussels Griffon <option value = "Bulldog" /> Bulldog <option value = "Bullmastiff" /> Bullmasttiff <option value = "Bull Terrier" /> Bull Terrier <option value = "Cairn Terrier" /> Cairn Terrier <option value = "Canaan Dog" /> Canaan Dog <option value = "Cardigan Welsh Corgi" /> Cardigan Welsh Corgi <option value = "Cavalier King Charles Spaniel" />Cavalier King Charles Spaniel <option value = "Chesepeake Bay Retriever" />Chesapeake Bay Retriever <option value = "Chilauhua" /> Chilauhua <option value = "Chinese Created" /> Chinese Crested <option value = "Chinese Shar-Pei" /> Chinese Shar-Pei <option value = "Chow Chow" /> Chow Chow <option value = "Clumber Spaniel" /> Clumber Spaniel <option value = "Cocker Spaniel" /> Cocker Spaniel <option value = "Collie" /> Collie <option value = "Curly-Coated Retrieve" /> Curly-Coated Retriever <option value = "Dachshound" /> Dachshund <option value = "Dalmation" /> Dalmation <option value = "Dandle Dimonnt" /> Dandie Dinmont Terrier <option value = "Doberman Pincher" /> Doberman Pincher <option value = "Dogue de Bordeaux" /> Dogue de Bordeaux <option value = "English Cocker Spaniel" /> English Cocker Spaniel <option value = "English Foxhound" /> English Foxhound <option value = "English Setter" /> English Setter <option value = "English Springer" /> English Springer <option value = "English Toy Spaniel" /> English Toy Spaniel <option value = "Field Spaniel" /> Field Spaniel <option value = "Finnish Spitz" /> Finnish Spitz <option value = "Flat-Coated Retriever" /> Flat-Coated Retriever <option value = "French Bulldog" /> French Bulldog <option value = "German Shepherd Dog" /> German Shepherd Dog <option value = "German Shorthaired Pointer"/>German Shorthaired Pointer <option value = "German Wirehaired Pointer" /> German Wirehaired Pointer <option value = "Giant Schnauzer" /> Giant Schnauzer <option value = "Glen of Imaal Terrier" /> Glen of Imaal Terrier <option value = "Golden Retriever" /> Golden Retriever <option value = "Gorden Setter" /> Gorden Setter <option value = "Great Dane" /> Great Dane <option value = "Greater Swiss Mountain Dog" /> Greater Swiss Mountain Dog <option value = "Great Pyrenees" /> Great Pyrenees <option value = "Greyhound" /> Greyhound <option value = "Harrier" /> Harrier <option value = "Havanese" /> Havanese <option value = "Ibizen Hound" /> Ibizen Hound <option value = "Irish Setter" /> Irish Setter <option value = "Irish Terrier" /> Irish Terrier <option value = "Irish Water Spaniel" /> Irish Water Spaniel <option value = "Irish Wolfhound" /> Irish Wolfhound <option value = "Italian Greyhound" /> Italian Greyhound <option value = "Jack Russell Terrier" /> Jack Russell Terrier <option value = "Japanese Chin" /> Japanese Chin <option value = "Keeshound" /> Keeshound <option value = "Kerry Blue TErrier" /> Kerry Blue Terrier <option value = "Komondor" /> Komondor <option value = "Kuvasz" /> Kuvasz <option value = "Labradar Retriever" /> Labrador Retriever <option value = "Lakeland Terrier" /> Lakeland Terrier <option value = "Lhasa Apso" /> Lhasa Apso <option value = "Lowchen" /> Lowchen <option value = "Maltese" /> Maltese <option value = "Standard Manchester Terrier" /> Standard Manchester Terrier <option value = "Mastiff" /> Mastiff <option value = "Miniature Bull Terrier" /> Miniature Bull Terrier <option value = "Miniature Pinche" /> Miniature Pinscher <option value = "Miniature Poodle" /> Miniature Poodle <option value = "Miniature Schnauzer" />Miniature Schnauzer <option value = "Mutt" />Mutt <option value = "Neopolitan Mastiff" />Neopolitan Mastiff <option value = "Newfoundland " /> Newfoundland <option value = "Newfolk Terrier" />Norfolk Terrier <option value = "Norwegian Elkhound" /> Norwegian Elkhound <option value = "Norwich Terrier" /> Norwich Terrier <option value = "Nova Scotia Duck Tolling Retriever" /> Nova Scotia Duck Tolling Retriever <option value = "Old English Sheepdog" />Old English Sheepdog <option value = "Otterhound" /> Otterhound <option value = "Papillon" />Papillon <option value = "Parson Russell Terrier" /> Parson Russell Terrier <option value = "Pekingese" />Pekingese <option value = "Pembroke Welsh Corgi" />Pembroke Welsh Corgi <option value = "Petit Basset Griffon Vendeen" />Petit Basset Griffon Vendeen <option value = "Pharch Hound" />Pharoh Hound <option value = "Plott" /> Plott <option value = "Pointer" /> Pointer <option value = "Polish Lowland Sheepdog" />Polish Lowland sheepdog <option value = "Pomeranian" /> Pomeranian <option value = "Portuguese Water Dog" />Portuguese Water Dog <option value = "Pug" />Pug <option value = "Pull" />Puli <option value = "Rhodesian Ridgeback" />Rhodesian Ridgeback <option value = "Rottweiler" />Rottweiler <option value = "ASaint Bernard" /> Saint Bernard <option value = "Saluki" /> Saluki <option value = "Samoyed" />Samoyed <option value = "Schipperke" />Schipperke <option value = "Scottish Doverhound" />Scottish Deerhound <option value = "Scottish Terrier" />Scottish Terrier <option value = "Sealyham Terrier" />Sealyham Terrier <option value = "Shetland Sheepdog" />Shetland Sheepdog <option value = "Shiba Inu" />Shiba Inu <option value = "Shih Tzu" />Shih Tzu <option value = "Siberian Husky" />Siberian Husky <option value = "Silky Terrier" />Silky Terrier <option value = "Skye Terrier" />Skye Terrier <option value = "Smooth Fox Terrier" />Smooth Fox Terrier <option value = "Soft Coated Wheaten Terrier" />Soft Coated wheaten Terrier <option value = "Spinone Italiano" />Spinone Italiano <option value = "Staffordshire Bull Terrier" />Staffordshire Bull Terrier <option value = "Standard Poodle" />Standard Poodle <option value = "Standard Schnauer" /> Standard Schnauzer <option value = "Suseex Spaniel" />Sussex Spaniel <option value = "Swedish Vallhound" />Swedish Vallhund <option value = "Tibertan Mastiff" />Tibetan Mastiff <option value = "Tibertan Spaniel" />Tibetan Spaniel <option value = "Tibetan Terrier" />Tibetan Terrier <option value = "Toy Fox Terrier" />Toy Fox Terrier <option value = "Toy Manchester Terrier" />Toy Manchester Terrier <option value = "Toy Poodle" />Toy Poodle <option value = "Vizela" />Vizela <option value = "Weimaraner" />Weimaraner <option value = "Welsh Springer Spaniel" />Welsh Springer Spaniel <option value = "Welsh Terrier" />Welsh Terrier <option value = "West Highland White Terrier" />West Highland White Terrier <option value = "Whippet" />Whippet <option value = "Wire Fox Terrier" />Wire Fox Terrier <option value = "Wirehaired Pointing Griffon" />Wirehaired Pointing Griffon <option value = "Yorkshire Terrier" />Yorkshire Terrier </td> </select> </tr> <tr> <td>Nutritional Needs:</td> <td><textarea name="nutritionalNeeds" cols="17" rows="5"></textarea> </td> </tr> <tr> <td>Special Instructions</td> <td><textarea name="specialInstructions" cols="17" rows="5"></textarea> </tr> <tr> <td colspan = "6"><h2>Order Information</h2></td> </tr> <tr> HEREDOC; foreach($key as $value){ echo $value; } echo <<<HEREDOC </tr> <tr> <td> <input name="Submit" type="submit" value="Order Treats!" /></td><td><input name="reset" type="submit" value="Cancel Order" /> </td> </tr> </table> </form> HEREDOC; } } <?php footer(); ?> </body> </html> my page: http://www.retroandvintage.co.uk/register.php my code Code: [Select] <?php error_reporting(E_ALL) ; ini_set('display_errors', 1) ; session_start(); include_once("config.php"); require_once('captcha/recaptchalib.php'); $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); /* Login script: This script does the following: Checks that the user is NOT already logged in - if they are they are redirected to the members page by the 'checkLoggedIn()' function. Checks if the login form has been submitted - if so, the 'login' and 'password' fields are checked to ensure they are of the correct format and length. If there are any problems here an error is added to the $messages array and then the script executes the 'doIndex()' function - this function basically outputs the main 'index' page for this script - ie the login form. If there are no problems with the previous step, the 'login' and 'password' field data is passed to the 'checkPass' function to check that an entry exists in the 'users' table for that login/password pair. If nothing is returned from the 'checkPass()' function, an error is added to the $messages array and the 'doIndex()' function is called as above. If a row of data is returned from the 'users' table, the data is passed to the 'cleanMemberSession()' function - which initializes session variables and logs the user in. The user is then forwarded to the members page. If the form hasn't yet been submitted, then the 'doIndex()' function is called and the login page is displayed. */ // Check user not logged in already: checkLoggedIn("no"); // Page title: $title="Member Login Page"; // if $submit variable set, login info submitted: if(isset($_POST["login"])) { // // Check fields were filled in // // login must be between 4 and 15 chars containing alphanumeric chars only: field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 4, 15); // password must be between 4 and 15 chars - any characters can be used: field_validator("rsPass", $_POST["rsPass"], "string", 4, 15); // if there are $messages, errors were found in validating form data // show the index page (where the messages will be displayed): if($messages){ doIndex(); // note we have to explicity 'exit' from the script, otherwise // the lines below will be processed: exit; } // OK if we got this far the form field data was of the right format; // now check the user/pass pair match those stored in the db: /* If checkPass() is successful (ie the login and password are ok), then $row contains an array of data containing the login name and password of the user. If checkPass() is unsuccessful however, $row will simply contain the value 'false' - and so in that case an error message is stored in the $messages array which will be displayed to the user. */ if( !($row = checkPass($_POST["rsUser"], $_POST["rsPass"])) ) { // login/passwd string not correct, create an error message: $messages[]="Incorrect login/password, try again"; } /* If there are error $messages, errors were found in validating form data above. Call the 'doIndex()' function (which displays the login form) and exit. */ if($messages){ doIndex(); exit; } /* If we got to this point, there were no errors - start a session using the info returned from the db: */ cleanMemberSession($row["rsUser"], $row["rsPass"]); // and finally forward user to members page (populating the session id in the URL): header("Location: main.php"); } else { // The login form wasn't filled out yet, display the login form for the user to fill in: doIndex(); } function doIndex() { /* Import the global $messages array. If any errors were detected above, they will be stored in the $messages array: */ global $messages; /* also import the $title for the page - note you can normally just declare all globals on one line - ie: global $messages, $title; */ global $title; } // if $submit variable set, login info submitted: if(isset($_POST["register"])) { $privatekey = "6Ldhhr4SAAAAAKFoL2INOZV0_VuF6_z3OwDjVFNn"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification $rsPostCode = $_POST['rsPostCode']; $rsGender = $_POST['rsGender']; $rsUser = $_POST['rsUser']; $rsPass = $_POST['rsPass']; $rsEmail = $_POST['rsEmail']; $rsMobile = $_POST['rsMobile']; $rsAge = $_POST['rsAge']; $to = 'john.mbiddulph@gmail.com'; //define the subject of the email $subject = 'New user added to My Pub Space'; // message $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>Telephone:</td> <td>'.$rsMobile.'</td> </tr> <tr> <td>Age:</td> <td>'.$rsAge.'</td> </tr> <tr> <td>Password:</td> <td>'.$rsPass.'</td> </tr> </table> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To:' .$to. "\r\n"; $headers .= 'From:' .$rsEmail. "\r\n"; // Mail it mail($to, $subject, $message, $headers); $sql = "INSERT INTO members_copy (RSPOSTCODE, RSGENDER, RSUSER, RSPASS, RSEMAIL, RSMOBILE, RSAGE) VALUES ('$rsPostCode', '$rsGender', '$rsUser', '$rsPass', '$rsEmail', '$rsMobile', '$rsAge');"; //echo $sql; mysql_query($sql); // // Check fields were filled in // // login must be between 4 and 15 chars containing alphanumeric chars only: field_validator("rsUser", $_POST["rsUser"], "alphanumeric", 4, 15); // password must be between 4 and 15 chars - any characters can be used: field_validator("rsPass", $_POST["rsPass"], "string", 4, 15); // if there are $messages, errors were found in validating form data // show the index page (where the messages will be displayed): if($messages){ doIndex(); // note we have to explicity 'exit' from the script, otherwise // the lines below will be processed: exit; } // OK if we got this far the form field data was of the right format; // now check the user/pass pair match those stored in the db: /* If checkPass() is successful (ie the login and password are ok), then $row contains an array of data containing the login name and password of the user. If checkPass() is unsuccessful however, $row will simply contain the value 'false' - and so in that case an error message is stored in the $messages array which will be displayed to the user. */ if( !($row = checkPass($_POST["rsUser"], $_POST["rsPass"])) ) { // login/passwd string not correct, create an error message: $messages[]="Incorrect login/password, try again"; } /* If there are error $messages, errors were found in validating form data above. Call the 'doIndex()' function (which displays the login form) and exit. */ if($messages){ doIndex(); exit; } /* If we got to this point, there were no errors - start a session using the info returned from the db: */ cleanMemberSession($row["rsUser"], $row["rsPass"]); // and finally forward user to members page (populating the session id in the URL): header("Location: main.php"); } /* This function displays the default 'index' page for this script. This consists of just a simple login form for the user to submit their username and password. */ function doIndex() { /* Import the global $messages array. If any errors were detected above, they will be stored in the $messages array: */ global $messages; /* also import the $title for the page - note you can normally just declare all globals on one line - ie: global $messages, $title; */ global $title; } // drop out of PHP mode to display the plain HTML: $query1 = "SELECT * FROM outcodepostcodes"; $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/style.css" title="default" /> <link rel="alternate stylesheet" type="text/css" href="css/style1.css" title="1" /> <link rel="alternate stylesheet" type="text/css" href="css/style2.css" title="2" /> <script type="text/javascript" src="js/stylechanger.js"></script> <script type="text/javascript" src="js/jquery-1.2.1.pack.js"></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); } </script> <script type="text/javascript"> var RecaptchaOptions = { theme : 'white' }; </script> <link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css"> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css"> </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> <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="#">Pubs</a></li> <li><a href="#">Members</a></li> <li><a href="#">Events</a></li> <li class="selected"><a href="#">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> <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">Post Code</td> <td><span id="spryselect1"> <select name="rsPostCode" class="postcodedrop"> <?PHP while($row = mysql_fetch_array($result)) { echo '<option name=\"menuarea\" class=\"postcodedrop\" value='.$row['outcode'].' />'; echo $row['outcode']; }?> </select> <span class="selectRequiredMsg">Please select an item.</span></span><i>Helps us find your local pubs!</i></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">User Name:</td> <td><span id="sprytextfield1"> <input name="rsUser" type="text" class="textbox" id="rsUser" /> <span class="textfieldRequiredMsg">A value is required.</span></span></td> </tr> <tr> <td class="text">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">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">Age:</td> <td><span id="sprytextfield6"> <input name="rsAge" type="text" class="textbox" id="rsAge" /> <i>dd/mm/yyyy</i> <span class="textfieldRequiredMsg">A value is required.</span></span></td> </tr> <tr> <td> </td> <td><?php require_once('captcha/recaptchalib.php'); $publickey = "6Ldhhr4SAAAAACAnyp4o6NDHjZvRlS6rnHNa-Enz"; // you got this from the signup page echo recaptcha_get_html($publickey); ?></td> </tr> <tr> <td> </td> <td><input name="register" type="submit" class="button" value="Register" /></td> </tr> </table> </form> </header> </article> </section> </div> <aside> <section> <header> <h3>Members Login Area</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="login" type="submit" value="Login"> <br /> </form> <ul> <li><a href="#">Sign up</a></li> <li><a href="#">Forgot Password</a></li> </ul> </section> <section> <header> <h3>Archives</h3> </header> <ul> <li><a href="#">December 2008</a></li> <li><a href="#">January 2009</a></li> <li><a href="#">February 2009</a></li> <li><a href="#">March 2009</a></li> <li><a href="#">April 2009</a></li> <li><a href="#">May 2009</a></li> <li><a href="#">June 2009</a></li> </ul> </section> </aside> </div> <footer> <div> <section id="about"> <header> <h3>About</h3> </header> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco <a href="#">laboris nisi ut aliquip</a> ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> </section> <section id="blogroll"> <header> <h3>Blogroll</h3> </header> <ul> <li><a href="#">NETTUTS+</a></li> <li><a href="#">FreelanceSwitch</a></li> <li><a href="#">In The Woods</a></li> <li><a href="#">Netsetter</a></li> <li><a href="#">PSDTUTS+</a></li> </ul> </section> <section id="popular"> <header> <h3>Popular</h3> </header> <ul> <li><a href="#">This is the title of a blog post</a></li> <li><a href="#">Lorem ipsum dolor sit amet</a></li> <li><a href="#">Consectetur adipisicing elit, sed do eiusmod</a></li> <li><a href="#">Duis aute irure dolor</a></li> <li><a href="#">Excepteur sint occaecat cupidatat</a></li> <li><a href="#">Reprehenderit in voluptate velit</a></li> <li><a href="#">Officia deserunt mollit anim id est laborum</a></li> <li><a href="#">Lorem ipsum dolor sit amet</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> <?php } ?> It maybe related to my other post about outdated value
I got myself a server and now it's on Centos 5.11 with Apache 2.2.3, PHP 5.3.3, & MySQL 5.0.95
I put all database inside as well as the web files.
And just about the time when I think it's all done I tested and...things are just wrong...
2 web file folders were put to 2 sub directory of var/www/html
1 using mysql_connect and another mysqli_connect
The one using mysql_connect can connect just fine, however some list are blank, while the one using mysqli_connect totally can't connect to the database.
Then I cut a pieces of the connection part n put it alone to test the connection, but I get blank page
$con=mysqli_connect("localhost","username","password","dbname") or die("Error ".mysqli_error($con));Completely nothing but a blank page is the result of the code. I wish I can see error page so I can start with the wrong part, but here again...I'm clueless on what's going on [root@localhost ~]# yum list installed | grep mysql mysql.x86_64 5.0.95-5.el5_9 installed mysql-connector-odbc.x86_64 3.51.26r1127-2.el5 installed mysql-server.x86_64 5.0.95-5.el5_9 installed php53-mysql.x86_64 5.3.3-26.el5_11 installed [root@localhost ~]# php -m | grep mysql mysql mysqli pdo_mysql [root@localhost ~]#Anyone know the solution or this or had the same problem can shed a light into this ? Thanks in advance, heres my PHP: i cant find the problem <?php $dbhost = 'localhost'; $dbname = 'games'; $dbuser = 'webuser'; $dbpass = 'MY PASSWORD IS HIDDEN :P'; $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname) or die(mysql_error()); if (isset($_GET['cat'])){ $cat = $_GET['cat']; $get_games = mysql_query("SELECT * FROM games WHERE category = '$cat'"); $get_games_rows = mysql_num_rows($get_games); if ($get_games_rows>=1){ while ($fetch = mysql_fetch_assoc($get_games)){ $id = $fetch['id']; $title = $fetch['title']; $thumb = $fetch['thumb']; $string4= '<div class='gamelisting'>'; $string4= '<a href='play.php?id=".$id."'>'; $string4= '<img src='thumbs/".$thumb."' width='80' height='60' alt='' /><br />'; $string4= '".$title."</a></div>'; <?php echo $string1.$string2.$string3.$string4; ?> } } } else echo "Category does not exist"; ?> Hi.. I know target blank has become a security risk, but I am curious to know if this link is now being disallowed or if I have coded it wrong. The link works, but it will not go to a new page. Thanks for any help. $id = "<a href=pgpage.php?id=" . $idr . "target = '_blank'>" . $partno . "</a>"; So, I'm getting a blank PHP page and it's driving me nuts. Unfortunately the client won't let me post my code up here, but rest assured that I'm an experienced web developer and have checked all of the usual suspects. I enabled error reporting, checked my apache error log, and neither of those produce any messages. The syntax is correct. I tossed in "die('here!')" in a few places until I couldn't see it. I narrowed down the stop point as being somewhere in the middle of a foreach loop. Before this foreach loop, I'm using array_merge on some fairly large pieces of data, but nothing unreasonable. When I comment out the array_merge line, the page works correctly. I figured maybe there was some kind of memory issue, or execution timeout thing going on, but when I increase both of those settings it has no effect. In essence, I'm wondering what might be some causes of the blank page problem beyond the common ones, since I'm really scratching my head over this one. SOLVED friends whenever i include this coding to my page, everything goes blank. how could i fix this? Code: [Select] $time_count = 7*24*60*60; // count the 7 days Ads will be deleted $match_time = time()-$time_count; $query = "SELECT id FROM classifieds WHERE time<'".$match_time."' ORDER BY RAND() LIMIT 1"; $result = mysql_query($query); while($ad_id = mysql_fetch_array($result)) $delete =$ad_id[0]; mysql_query("DELETE FROM classifieds WHERE id='$delete'"); Hi, I created the login page below. However, when I enter details on the form I am getting a blank page. I can't figure out what is wrong. Any help/suggestions really welcome. Thanks in advance. Code: [Select] <html> <html lang="en"> <head> <meta charset="utf-8" /> <title>LOGIN FUNCTION</title> </head> <body> <?php require('connection.php'); if(empty($_POST['name'])){ $name=NULL; echo "Sorry, you forgot to enter your username.</br>"; }else{ $name=@mysqli_real_escape_string($connection, trim($_POST['name'])); } if(empty($_POST['password'])){ $password=NULL; echo "Sorry, you forgot to enter a password.</br>"; }else{ $password=@mysqli_real_escape_string($connection, trim($_POST['password'])); } if(($name) && ($password)){ $info = "SELECT * FROM users WHERE username=$name and password=$password"; $return=@mysqli_query($connection, $info); $count_rows=@mysqli_num_rows($return); if($count_rows==1){ session_start(); if(isset($_SESSION['login'])){ header("Location:admin.php"); }else{ header("Location:login_fail.php"); } } } ?> |