Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. <head> <title>help</title> <meta name="description" content="." /> <meta name="keywords" content=" " /> </head> Take that, and make it: <?php $q="SELECT * FROM pages WHERE name='$pg'"; $r=mysqli_query($dbc,$q); $page= mysqli_fetch_assoc($r); echo '<div class="content_body">'.$page['body'].'</div>'; ?> <head> <title><?php echo $page['title']; ?></title> <meta name="description" content="<?php echo $page['description']; ?>" /> <meta name="keywords" content=" " /> </head> Assuming of course that your column names are "title" and "description." You said they existed but nor what they are.
  2. Ok I'm done with you, I asked way too many times for the value of $cid and you just can't figure out how to answer me. Perhaps PHP is not for you. You don't have a variable called $cid. That's pretty obvious. You have $cid01. Why not just use $cid01? You have code that works. How is "ok it works" not the end of the conversation?
  3. ANSWER THE QUESTION I gave you very specific instructions. Inside a box. NOT IN A PARAGRAPH. NOT IN A LINE OF CODE We're not magic. That crystal ball jess printed earlier isn't real, it's an emoticon.
  4. You're doing it wrong. SOmewhere, some how, you're doing it wrong, but we honestly can't figure out what because none of this makes any sense. What do you HAVE: Show us the current value of $_SESSION['cid']. By itself. Not in a paragraph, not in a line of code, inside a [ code ] box by itself. What do you NEED: Show us the line of code without a variable in it that works. If you want $to_company = 'abc123' but $cid = 'abc', show us that.
  5. If they're the same, you can JOIN the tables: SELECT * FROM expense_fuel JOIN expense_categories ON expense_fuel.fuel_code = expense_categories.id WHERE fuel_code = '{$type}' You're still vulnerable to SQL Injection
  6. There doesn't appear to be a relationship between these tables. Is fuel_code the same as expense_categories.id?
  7. Well if you'd answer the questions I've asked, we could help you more. Show the table structure, show the data, show what you want it to look like. Barand and I can continue guessing randomly all day, or you can actually show us the problem you're asking us to solve.
  8. If we're just critiquing the code in general, you're also very vulnerable to SQL injection.
  9. You're not making any sense to me. Sow a few rows of data from the tables, and what you want the results to look like, assuming you already have a fuel code
  10. It seems to be on a 2-3 minute delay. I've been inadvertently stalking Jess all morning.
  11. So "type" is in both tables?
  12. How are they related? Can you JOIN these two tables? Your syntax is wrong in the second query, you can't just dump a raw PHP variable into a mysql query
  13. So when you go to the site without cid in the URL, cid isn't in the URL and then you overwrite the session. That's the actual problem: You're visiting the page AGAIN without cid and your code doesn't say "don't do this if cid doesn't exist." You're developing without error_reporting turned on. If you had your errors turned on, you would have gotten a warning hours ago that would have prevented this whole conversation. if ( isset($_GET['cid']) ) { $_SESSION['cid'] = $_GET['cid']l } There, done.
  14. So the URL bar in the browser says: http://www.mysite.com/form.php?cid=prg1234 And inside form.php you have the print_r code you got earlier? And 'cid' is not in $_REQUEST? Is all of that true?
  15. You do other amazing things, like steal my posts before I'm done writing them.
  16. No kidding. But it keeps fatal errors out of their logs, presumably they log fatal errors only. Aliasing all the missing functions (missing functions are a fatal error) to similar-but-not-working functions stops them from filling their logs with "FATAL ERROR: Customer has not updated their script in 6 years" over and over until the server goes down.
  17. There is no "obvious reason" to disallow PHP tags. If you're using eval() or any other method of dynamically evaluating user-input as though it were PHP code, stop what you're doing now and change it. Allowing PHP in your inputs should not be a security concern at all, since there should be no way for user input to ever be executed by the PHP interpreter.
  18. Is it in the URL? Are you positive? PHP says it's not in the URL. Jess, get some work done! Stop posting what I'm posting 10 seconds before me
  19. You haven't explained the problem, you've just said you want to do something. There's no WHY. I could ask you how to fill my shower stall with licorice, that doesn't answer "why are you trying to do that?" There is no reason to do what you're trying to do, that's what we're saying. Whether or not it's possible is irrelevant, because all the ways to do it slow down the normal use for arrays. If you'd really like to do it and can't say why, here: $yearArr = array( 1 => '19', 2 => '19', 3 => '18', 4 => '18', 5 => '20', 6 => '20' ); $temp = array(); foreach ( $yearArr AS $k => $v ) { if (($a = array_search($v, $temp)) !== false) { $temp[$a.'/'.$k] = $v; unset($temp[$a]); } else { $temp[$k] = $v; } } $yearArr = $temp; print_r($yearArr);
  20. $a = $b is not the same as $b = $a. Your initial post says you have: $_SESSION['cid'] = $cid; That is not what your code has.
  21. Your host upgraded from a language version which supports the ereg family of functions to a version which does not. They also "helpfully" added a module which replaces any existing calls to ereg with calls to the preg family of functions. Your code on those lines is wrong. Line 121 should be: $output = str_replace(";", "", $output); Line 309 should be: if ($count % 10 == 0 ) { This code is awful, neither of these lines even needed to be a regular exp<b></b>ression. Any line which contains "ereg" must be replaced by something. Scoot: The host seems to be doing real-time aliasing between ereg and preg since ereg is gone.
  22. What problem are you trying to solve here? Why is this so important to you? 1/2 is math. It means 0.5. The way you write your code, $YearArr[.5] is the only thing which will output 19. Keep your code the way it is. It's the fastest implementation of whatever it is you're talking about, unless you tell us what the actual problem is.
  23. Do not ever use cookies to store session data. Cookies are passed to the client with every request and are visible by the client (and can be modified). Your encryption is probably not good enough to protect your session. Instead, override the session storage location and store the data in memcache or a database. Articles on overriding the session using session_set_save_handler are everywhere.
  24. Please answer the question. I don't know what "number 1 or 2 means/echoes 19" means. Your original code is probably the fastest way even though there are "duplicates."
  25. Would you honestly like the keys to be a string list of all the old keys which pointed to the data? Or do you just want to remove the duplicates? Which of these do you want? $YearArr = array( '1/2' => '19', '3/4' => '18', '5/6' => '20' ); $YearArr = array( 0 => '19', 1 => '18', 2 => '20' );
×
×
  • 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.