Ryanmcgrim Posted February 5, 2010 Share Posted February 5, 2010 I am new to all of this stuff, but am making headway, and really enjoying myself in the process. I know that the answer to the following question will most likely be an easy one, however I have spent a great deal of time working with it, and am Missing something somewhere. Maybe one of the many pros has a simple answer. I have a database that users can log into. The php code I am writing is working, my issue is more with formatting. My code looks like this: session_start(); header("Cache-control: private"); // Include Global Variables include("vars.php"); // Include Functions include("DropDown.php"); include("CreateArray.php"); include("disclaimertop.inc"); // Checks to see that both User and Password have been entered if (((isset($_POST["_loginuser"]) && !empty($_POST["_loginuser"])) && (isset($_POST["_loginpass"]) && !empty($_POST["_loginpass"])))) { // Connect to Database $ConnectDB = mysql_connect($DonorDBHost, $DonorDBUser, $DonorDBPass) or die('Could not connect: ' . mysql_error()); mysql_select_db ($DonorDB); // Performing SQL Query $LoginQuery = sprintf("SELECT * FROM userinfo WHERE username = '%s' AND password = '%s'", mysql_escape_string($_POST["_loginuser"]), mysql_escape_string($_POST["_loginpass"])); $LoginResult = mysql_query($LoginQuery) or die("Query failed : " . mysql_error()); $num_rows = mysql_num_rows($LoginResult); $myrow = mysql_fetch_array($LoginResult); if (($num_rows != 1)) { echo 'There is no user/pass combination that matches what was entred. Click <a href="login.php">HERE</a> to login'; $_SESSION["auth"] = "FALSE"; } else { if ($myrow["accstatus"] == 0) { echo 'Account Disabled -- Please Contact Administrator by clicking <a href="contact_us.php">HERE</a>'; } else { //Store Authentication Variable $_SESSION["auth"] = "TRUE"; $_SESSION["username"] = $_POST["_loginuser"]; I have included a top.inc, and a bottom.inc file to give the page its formatting, and it is working perfectly. The only problem is I am trying to get the eco responses to appear into my right box sub. Instead the page loads and looks fine, but the eco responses appear at the very bottom of the page over the background image rather that the right box content box. I know this will most likely be simple but I have had no luck, thanks, Ryan Quote Link to comment Share on other sites More sharing options...
schilly Posted February 5, 2010 Share Posted February 5, 2010 remember that when using the echo it will appear in the page exactly where the php engine evaluated it. In this case it sounds like that is being evaluated before or after all your html is being outputted. If you want that text in a certain place, put it in a variable instead of outputting it then output that variable in the proper text block. ie. your right box content box Does that make sense? Quote Link to comment Share on other sites More sharing options...
Ryanmcgrim Posted February 8, 2010 Author Share Posted February 8, 2010 I have been playing with this for a while now, and just can't seem to get it working right, I think I am understanding you correctly, but I am very new to this, and just trying to catch up with the lingo. Could you re-explain in layman's please. Thanks, in advance, Ryan Quote Link to comment Share on other sites More sharing options...
schilly Posted February 8, 2010 Share Posted February 8, 2010 ok example. <?php bunch of code with some echos. ?> <html>//some html in here</html> ok so this is my php page. i have a code block at the top of the page which does a bunch of evaluations and has some echos. it gets read first and any echos i have in there will get outputting to the browser before any of the lower html code gets outputting. this echo data will hence show up at the top of the page in my browser above any of the html. you can check the source as well to see. if i want any of that php evaluation code to show up in my html page somewhere, i will need to store it in a variable instead of echoing it. then in my html code, i add a php tag in there and echo out the variable here instead of up top in the php code. <?php echo $var; ?> so basically <?php bunch of code with some echos. ?> <html> //some html in here <?php echo $var; ?> //output my variable where ever i want it in my html page. </html> hope this makes more sense. Quote Link to comment Share on other sites More sharing options...
Ryanmcgrim Posted February 9, 2010 Author Share Posted February 9, 2010 Thanks for taking the time to explain. I was understanding you correctly, but worked around it a bit differently, but pretty much the same in principal. I have every page working but one. The method I have been using, has been to have my basic html page, which sets the headers, and overall formatting through css. I am then using inclusion commands to attach the Php code to the page, and have places the inclusion php where I would like the output to appear. So for this example, it would be in the right box. This has worked with every page but one, and it seems resistant to any changes to formatting that I am making. It seems like there is something inside the PHP that is forcing the formatting, but that just doesn't seem right to me. Sorry if this something really basic, but as you can tell I am just starting out and it doesn't seem to be responding to my changes as the other pages have. here is an example of my simple code, if the PHP page that is being included is needed I can post that as well. <?php include("includes/header_inc.php"); ?> <div id="csed_body"> <!--Body Text --> <div class="left_boxSub"> <div class="inside_leftSub"> <?php include("includes/donorMenu_inc.php"); ?> </div> </div> <div class="right_boxSub"> <h1>Donor Gallery</h1> <?php include("DonorFinderINC.php"); ?> <br /><br /> <p> <br /> </p> </div> <!--End Body Text --> <?php include("includes/footer_inc.php"); ?> It is the DonorFinderINC.php file that is forcing the formatting changes Also I have attached a working page shot, which shows the finished page, and one of the nonworking one. I have tried to load [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
schilly Posted February 9, 2010 Share Posted February 9, 2010 that error message could be throwing it off. what is your error reporting set to? have you looked at the line it mentions? Quote Link to comment Share on other sites More sharing options...
Ryanmcgrim Posted February 9, 2010 Author Share Posted February 9, 2010 I am thinking that it is a local server side issue, as I received it when using a local testing server before any modifications were done to the site. I assumed it would clear up when the whole site was uploaded to our host. Speaking of this, I am also not able to view any of the gallery images (which should be populating in the results tables (on the second image I uploaded here), and even more strange, when surfing to the "Click Here to view Complete Donor Profile" link, a separate page opens up displaying a PDF file. Internet explorer opens up the file perfectly, but Mozilla gives a "Forbidden You don't have permission to access /csed/pdf/1301.pdf on this server" I have looked everywhere server side to correct this but can't seem to eb able to find anything. I am wondering if this is at all related to the error message you commented about. Again, I just assumed that these would clear up when uploaded to the original server. Is this thinking wrong? Thanks again for your help, Ryan Quote Link to comment Share on other sites More sharing options...
schilly Posted February 9, 2010 Share Posted February 9, 2010 what are the permissions on the folder the pdf is in? Quote Link to comment Share on other sites More sharing options...
Ryanmcgrim Posted February 10, 2010 Author Share Posted February 10, 2010 In PHPADMIN, I have granted every user full access / privileges, and as this is currently locally hosted, I have made sure that the actual folders are open as well, is there another area besides PHPADMIN where I need to check permissions? Quote Link to comment Share on other sites More sharing options...
schilly Posted February 10, 2010 Share Posted February 10, 2010 what are the file permissions on the pdf/ folder? if you get a permission error like that it usually means the web server user (IIS or Apache) can't access that folder because they don't have read/write privileges. by phpadmin or you referring to phpmyadmin? Quote Link to comment Share on other sites More sharing options...
Ryanmcgrim Posted February 11, 2010 Author Share Posted February 11, 2010 Yes, I meant PHPMYADMIN. The Server is Apache. What is odd though is that IE loads them just fine, however mozilla comes back with a Forbidden error. The actual folders on my computer (as I am testing locally) are not read / write protected either. Quote Link to comment Share on other sites More sharing options...
schilly Posted February 11, 2010 Share Posted February 11, 2010 hmmmm i'm not too sure. that is odd. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.