Jump to content

Azarian

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by Azarian

  1. Oh ok I see where I am going wrong now. Ok now that we got my problem solved lets chat about this $_GET array. Thinking out side of the box here. How could I rewrite this better and not have some big crazy array listed somewhere to check against? I don't suppose there is a function that would go through see all the other functions dynamically?
  2. lets say I need to call Somefunction($somevariable); How would I do it?
  3. That is the problem it doesn't allow args to be parsed.
  4. Your assuming that they would be able to guess the names of my functions. Plus if by some miracle they guessed some function related to admin panel they wouldn't have the authorization needed to access it. Seems counter intuitive of what I am trying to do buy having an array that has hundreds of other arrays listed in it, also this doesn't fix the issue I am having.
  5. I would get a book that has projects in in that you would like to have on your site. Some people can't read a programing book straight through and comprehend everything. So let say you get to a part of the book and your like WTF is this talking about, just skip it. Get to the tutorial code and start playing with it. Once you start working with the code you find out what you can or can't do with it. You will get to a point where you start pushing your code beyond what you know. Than when you have to go back to the book to reread what you skipped over it will all make better sense. Least this way works for me but I am more of a hands on type of person than a book type person.
  6. I would be very careful doing that, especially the way your code works. Theres nothing stopping anyone executing whatever function they like. How would they do that and how would I stop them?
  7. Well I thought I had created a pretty slick web page, using ?page and $_GET to load pages which where really function calls. Here is a few lines that make up the menu <li><a Href="?page=welcome_page">Home</a></li> <li><a Href="?page=laninfo_display">Party Info</a></li> This function loads other functions into the main body of the web page. function main_page(){ if ( $_GET['page'] == null ) { $menu_link = welcome_page; $menu_link(); }else{ $menu_link = $_GET['page']; $menu_link(); } } All was good till recently I needed to start passing parameters back and forth between some functions. What would be the best way to solve this issue?
  8. Also what do you mean when you say output because in my opinion the html_header() function that I posted before would be output because it is outputting all the HTML headers.
  9. The Short tag version with ob_start() does work but if ob_start() is a hacky way of doing it I prefer to learn how to do it the right way. How about we look at this problem from another perspective? Since basically I am using the header() to refresh the page. How else could I go about this? If i can't put the header() into a function how else would you make the page refresh?
  10. Well when I do that I see all the HTML header info up to the point where php takes over from there. This would be the code that would be executed next. function main_page(){ if ( $_GET['page'] == null ) { $menu_link = welcome_page; $menu_link(); }else{ $menu_link = $_GET['page']; $menu_link(); } } That code gets values from this menu. <ul> <li><a Href="?page=welcome_page">Home</a></li> <li><a Href="?page=laninfo_display">Lan Party Info</a></li> <li><a Href="?page=gameiso_display">Game ISO</a></li> <li><a Href="?page=appz_display">Appz/KeyGen</a></li> <li><a Href="?page=cdkeys_display">CD Keys</a></li> <li><a Href="?page=patch_display">Patches</a></li> <li><a Href="?page=cracks_display">Cracks</a></li> <li><a Href="?page=driver_display">Drivers</a></li> <li><a Href="?page=logout">Logout</a></li> </ul>
  11. Ok we are getting somewhere now! Pretty much everything you said you have right. include 'html_functions.php'; This is just function calls for html headers and footers and such. include 'db/hhp_db.php'; This is just connection to the database. include 'login_functions.php'; The first part of this code I will post below and yes line 29 is the header(). <?php function checkuser(){ $username = $_POST['username']; $password = $_POST['password']; if((!$username) || (!$password)){ echo "Please fill in both fields! <br />"; login_form_display(); exit(); } $username = stripslashes($username); $password = stripslashes($password); $password = md5($password); $sql = mysql_query("SELECT * FROM tbl_user_access WHERE fld_login_id='$username' AND fld_password='$password'"); $login_check = mysql_num_rows($sql); $row = mysql_fetch_array($sql); $user_id = $row['fld_user_id']; if($login_check > 0){ $_SESSION['fld_user_id'] = $user_id; $sql2 = mysql_query("UPDATE tbl_user_access SET fld_last_login= now() WHERE fld_user_id='$user_id'") or die (mysql_error()); header("Location: index.php"); } else { echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br /> Please try again!<br />"; login_form_display(); } }
  12. After the header() is called the site errors out with this error message. Warning: Cannot modify header information - headers already sent by (output started at /home/content/b/o/c/bocci572/html/lanparty/beta/html_functions.php:17) in /home/content/b/o/c/bocci572/html/lanparty/beta/login_functions.php on line 29
  13. Ok I took out all the short tags and ob_start() and ob_flush() and this is the line of code it is choking on. Line 17 which is <div id="pagelayout"> . <?php function html_header(){ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <title>Hukai's House of Pain</title> <head> <link rel="shortcut icon" href="images/skull.gif"> <link rel="stylesheet" href="styles/hhp.css"> </head> <body spacing="0"> <DIV id="headertitle">HUKAI'S HOUSE OF PAIN</DIV> <DIV id="headerlandate">Next LAN Party Jaunuary 17, 2008</DIV> <DIV id="headerfragtimer"></DIV> <div id="pagelayout"> <div id="pagelayoutmenu"> <div id="sidemenu"> <?php }
  14. Ok lets get of this short tag trip as I said before I only used them to add that code quick and dirty like. Since my web page works prefectly with them i am sure they are a none issue anyways.
  15. I don't follow what you are saying. I just threw in <? ob_start(); ?> like that real quick for testing purposes so that if it didn't work I would just delete it out quick.
  16. This is my index.php file. If it is an echo problem what would you use in place of an echo command? <? ob_start(); ?> <?php session_start(); include 'html_functions.php'; include 'db/hhp_db.php'; include 'login_functions.php'; include 'registration.php'; include 'gameinfo_display.php'; include 'laninfo_display.php'; html_header(); menu(); main_page(); html_footer(); ?> <? ob_flush(); ?>
  17. Recently I finally found a solution to a problem I had using header(), that was not due to white space issues like is normally the issue. Someone had posted using ob_start() and ob_flush() at the tops and bottom of all my pages and amazingly this worked. Unfortunately this person didn't give any detailed info or reasoning why this fixes the issue. I hate using something just because it works I need more info. Can anyone provide me info with what is going on with these 2 functions? This isn't some kind of hacky way to make things work that can cause other issues later on is it? Also since my site is basically included all into the main index.php why does this code need to go into every file? Seems to me if it is in the main index.php file is should encapsulate the rest of the site, would it not?
  18. I was trying to save coding it myself as option 2. I much prefer to get the blog part up quick and come back later and mess with it. I have tried word press and I am not that impressed. Seems like an over engineered solution for a not that complicated of problem or at least for me it is. I know people who swear by wordpress.
  19. I am looking for recommendations for open source blog software. Basically I want something dirt simple that is pretty basic, no frills type of thing. I want to be able to add my own php scripts, and edit the blog software to work with my site, without having to spending months decoding someones else code to make everything work well.
  20. LOL You kinda of read my mind. This is something I been thinking about but haven't quite thought it all the way through yet. I think it would be sweet when I add new content the site it gets added to a db. Than the site is dynamically updated. But I have a lot more tweaking to do before I get anywhere close to that. I am trying to make a working site engine type of deal so I can use it for what ever kind of site I want. This particular code I pulled from a site I use for a bunch of us guys who get together and LAN party all the time. I also use a lot of those code for other little club type sites I that I do but I need to edit a lot of files for every site I use it with. I have a few ideas for some commercial sites (? I dunno if that is the right term), I think I am a long way off till can tune my code till it runs like how I think a good site should run.
  21. I played around trying to use the header() but it would bark at me something about global variables every time I tried it. I will look into meta refresh to see if it is something I may want to use.
  22. I am looking for advice if I am going about creating my web page in the correct way. Here is my main index.php file. Basically what I am trying to accomplish with this file is to provide the formatting for the whole site and a spot for all the content to come together. <?php session_start(); include 'db/hhp_db.php'; include 'html_functions.php'; include 'login_functions.php'; include 'registration.php'; include 'gameinfo_display.php'; include 'laninfo_display.php'; html_header(); menu(); main_page(); html_footer(); ?> This function pretty much drives the content of the site. Except for the main.php which is just your standard hi welcome to the site info, all the content is called by other functions from all those includes in index.php. Basically this is what I came up with so I could call any function and still keep the site formatting going. function main_page(){ if ( $_GET['page'] == null ) { include("main.php"); }elseif ( $_GET['page'] == 'Home' ) { include("main.php"); }else{ $menu_link = $_GET['page']; $menu_link(); } } Here is the truncated version of the menu. Basically shows 1 menu if your logged in and another menu if you not logged in. Also a third menu for admins but like I said I shortened for space and I am just trying to give you an idea what I am doing. function menu(){ if(isset($_SESSION['fld_user_id'])){ ?> <ul> <li><a Href="?page=Home">Home</a></li> <li><a Href="?page=laninfo_display">Party Info</a></li> <li><a Href="?page=patch_display">Patches</a></li> <li><a Href="?page=driver_display">Drivers</a></li> <li><a Href="?page=logout">Logout</a></li> </ul> <?php }else{ ?> <ul> <li><a Href="?page=Home">Home</a></li> <li><a Href="?page=login_form_display">Login</a></li> <li><a Href="?page=reg_email_form_display"> Register</a></li> </ul> <?php } } Now here is my issue and why I think my system is flawed. After login in order to get the page refresh with the correct menu I need to have the user hit a button to get it to work. <H3>Login Successful! Please enter site!</H3><br /> <INPUT TYPE="BUTTON" VALUE="Enter" ONCLICK="window.location.href='?page=Home'"> I also have to do the same for log out. Is there way to post ?page=home without pressing a button? Is my way of going about this kinda hacky or am I on the right path and I just need to fine tune my code? I would be interested in any thoughts or suggestions anyone with more experience than me would have. Thanks in advanced!
  23. I don't know what header() is. Well if you look at the whole site overall it is basically 1 page because everything is include into the main php file. Instead of my links linking to direct php files they link to functions instead. Hope my explanation makes sense. Here is the main file the index.php <?php include 'header.php'; ?> <?php include 'gameinfo_display.php'; ?> <?php include 'laninfo_display.php'; ?> <?php include 'rsvp_forms.php'; ?> <?php if ( $_GET['page'] == "LanInfo" ) { laninfo_display(); } elseif ( $_GET['page'] == "Games" ) { gameiso_display(); } elseif ( $_GET['page'] == "Appz" ) { appz_display(); } elseif ( $_GET['page'] == "CD-Keys" ) { cdkeys_display(); } elseif ( $_GET['page'] == "KeyGen" ) { keygen_display(); } elseif ( $_GET['page'] == "Patch" ) { patch_display(); } elseif ( $_GET['page'] == "Cracks" ) { cracks_display(); } elseif ( $_GET['page'] == "ConfirmRSVP" ) { rsvp_email_form_display(); } elseif ( $_GET['page'] == "RSVPUserInfo" ) { rsvp_userinfo_form_display($email_address); } elseif ( $_GET['page'] == "Drivers" ) { driver_display(); } else { include("main.php"); } ?> <?php include 'footer.php'; ?>
  24. Ok here is the situation. I have a script where I get a users email address than I test it to make sure it is in my DB. Basically a poorman's login. If the email address exists they are allowed to make comments or whatever. After I get the email address i do what i need to do than I need to kick the user to the next form in line and pass the email address with it. This is how I am trying to do it but I dunno how to pass the $email_address variable with it. This works in bringing up the next form just with out passing the email address. So than users have to reenter there email addresses again. include 'http://www.dom.com/lanparty?page=RSVPUserInfo'; If I use this way it all works perfectly except it basically opens in a new page and is no longer part of the parental page that controls it all. so when you continue from this point in the script it breaks. include 'rsvp_forms.php'; functionname($email_address); Any suggestions?
×
×
  • 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.