Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by Lamez

  1. Anybody know of any other good Web Programming Communities? I am leaving since he is king. :/
  2. I see a lot of people do something to distract them, like video games, I don't. I break out a marker and start writing my goal down on the white board, what I should do to get that goal, and things of that nature. If I don't get anywhere with that method, then I am probably too tired to program. So I go to bed. That is when algorithms start popping in my head. Sometimes I can't figure out why my code is not working, so I go to bed, like I said, I was probably too tired. Then when I wake up, look at the code I start to notice all sorts of syntax errors. At work I just grab a energy drink and program till we close, I love it.
  3. What the heck, why did it post that? Anywho here is the code I was working on: ------------ Okay so you want to take the last five rows, and keep the order in DESC? <?php function clean($str){ $str = @trim($str); if(get_magic_quotes_gpc()){ $str = stripslashes($str); } return mysql_real_escape_string($str); } $q = mysql_query("SELECT * FROM icu INNER JOIN bundle ON icu.id_incr = bundle.pt_id AND icu.id_incr = '" . clean($_GET['id']) . "' order by bundle.bundle_date LIMIT 5"); //Never use a $_GET variable straight into a query. Anything that can be modified from the outside, needs to be clean. $n = mysql_num_rows($q); if($n > 0){ $f = mysql_fetch_array($q); for($i=0; $i<=$n; $i++){ if($i >= ($n-5)){ echo $f['value']; } } }else{ echo "No Data"; } ?> I have not tested this, it should work, I think.
  4. Oh I love writing these games. I wrote one in Java, PHP, and C. I even made a little hand held game out of it (Arduino).
  5. I use $_SESSION[]'s instead of $_COOKIE[]'s It works well.
  6. Off-Topic, but all those profiles show they all graduated from Harvard. Impressive!
  7. What is MVC? See I thought you built your site around a template engine, then you could apply certain themes and whatnot. I was completely in the dark when it came to template engines. Thanks Guys!
  8. Alright, thanks. That is the kind of response I am looking for. If it is still is going to make me design, and make things more complicated, then I don't want to fiddle with it.
  9. http://www.google.com/search?hl=en&ei=5A1GS4XdE42Vtgf6rezoAQ&sa=X&oi=spell&resnum=0&ct=result&cd=1&ved=0CAYQBSgA&q=how+to+send+email+using+php+mail+with+attachments&spell=1
  10. you can (if you are running windows) open up the run box, type CMD then locate the file (put them on your desktop), type CD desktop, then type ren oldfilename.JPG newfilename.jpg
  11. I am a developer not a designer. Therefor I want to use a template engine in my new website (new as in revamped). Which one is the best? Do template engines come with different template I can download? Do I have to make my own? Are they hard to incorporate? Is this the right board to post this in? -Thanks!
  12. How would I get the current folder of which my website is in? Pretty much, how would I edit $_SERVER['REQUEST_URI'] to show the last folder? Exmaple if REQUEST_URI = /folder1/another_folder/page.php how would I get /folder1 ?
  13. As for looking at the string for numbers: I don't want people registering with names like: Johnny12 or anything like that, so I want to return a error saying you may not have numbers. That is all.
  14. First Question: How would I force a function when the user closes the browser? Would that be javascript? When the user logs on to the website, it shows everyone they are online, but when they close the browser, they are still online. So I want to force my logOut(); function on them. Second Question: Is there a function that allows me to examine a string, and look for a number and return a certain value, or do I have to write one myself? If so, how would I go about doing that? -Thanks for all the help!
  15. <?php $body = "<b>Contact Information</b> \n"; ?> is that what you are looking for?
  16. Please use the code tags. Also, add "or die(mysql_error())" to the end of your mysql_query function. Like mysql_query($sql) or die(mysql_error());
  17. not to sure but I think you can manually set a value in the $_POST array like so: <?php $_POST['someName'] = "myValue"; ?> so you might can use that bit of info to help.
  18. Just uninstall Windows, and install Linux.
  19. <?php $file = 'newyear/gift.php'; $count = 0; while(!file_exists($file) && $count <= 100){ $crumbs = '../'; $file = $crumbs.$file; $count++; } header('Location: '.$file); ?> That should do it
  20. Glad I could do some contributions, I usually just have questions. So I try to help when I can.
  21. I will move the error_reporting line. Yes the wide-variables.php is being included, because I got errors before, and fixed them immediately. I don't think the includes are "out of control", and I will keep them the same. All the files seem to be included, for some very odd reason, I cannot connect to the database from that folder. I can from the members folder. I still have no clue why.
  22. <?php function getBrowser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $ub = 'other'; if(preg_match('/MSIE/i',$u_agent)){ $ub = 'ie'; } elseif(preg_match('/Firefox/i',$u_agent)){ $ub = 'firefox'; } elseif(preg_match('/Mozilla/i',$u_agent)){ $ub = 'firefox'; } elseif(preg_match('/Safari/i',$u_agent)){ $ub = 'safari'; } elseif(preg_match('/Chrome/i',$u_agent)){ $ub = 'chrome'; } elseif(preg_match('/Opera/i',$u_agent)){ $ub = 'opera'; } return $ub; } $browser = getBrowser(); if($browser == 'ie'){ $url = 'http://www.google.com'; }elseif($browser == 'firefox'){ $url = 'http://www.google.com'; }elseif($browser == 'safari'){ $url = 'http://www.yahoo.com'; }elseif($browser == 'chrome'){ $url = 'http://www.ask.com'; }elseif($browser == 'opera'){ $url = 'http://www.ask.com'; } header("Location: ".$url); ?> I would about it that way, just in case you want to change the url's later.
  23. As requested: db-config.php <?php include("wide-variables.php"); define('ADMIN', "admin@webby.com", true); define('MOD', "mod@webby.com", true); $DB_CONN = mysql_connect($_DB_SERVER, $_DB_USER, $_DB_PASS) or die('<font color=red><b>Site Returned Error:</b></font> '.mysql_error()); mysql_select_db($_DB_NAME, $DB_CONN) or die('<font color=red><b>Site Returned Error:</b></font> '.mysql_error()); ?> and wide-variables.php <?php //Start Session session_start(); error_reporting(E_ALL); //Page Variables $_SESSION['currentPage'] = currentPage(); //Datbase Config $_DB_USER = "x"; $_DB_PASS = "x"; $_DB_SERVER = "x"; $_DB_NAME = "x"; /* $_DB_USER = "x"; $_DB_PASS = "x"; $_DB_SERVER = "x"; $_DB_NAME = "x"; */ //Table Variables: define('TBL_PEOPLE', "people", true); //Path Variables: $_pear = ""; $_core = "core/"; $_includes = "core/includes/"; $_style = "core/style/"; $_pages = "/pages/"; //Redirect Variables: $_main_error = $path."index.php"; $_not_member_area = $path."index.php"; //If's if(isset($Login) && $Login){ if(!LoggedIn()){ header("Location: ".$_not_member_area); } } if(isset($AdminOnly) && $AdminOnly){ if(!LoggedIn()){ header("Location: ".$_not_member_area); }else if(!isAdmin()){ header("Location: ".$_not_member_area); } } if(isset($ModOnly) && $ModOnly){ if(!LoggedIn()){ header("Location: ".$_not_member_area); }else if(!isAdmin() || isMod()){ header("Location: ".$_not_member_area); } } //CMD Stuff if(isset($_GET['cmd'])){ $cmd = $_GET['cmd']; //Logout if($cmd == "logout"){ logOut(); header("Location: ".$_not_member_area); } } ?>
  • 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.