Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Does it work if you don't set VERIFYHOST? I would also verify that you can make the connection (such as running telnet somebank.com 443 and seeing if it connects).
  2. You must use "return" in your function, as in my earlier post. function a(){ return "this is a"; } $t = a(); echo $t;
  3. Can't you just destroy the session when the final change is made? Alternativle you can set a session variable to indicate the user is no longer editing. Sessions are by far the best solution for what it sounds like you're trying to do.
  4. Can you post the command you tried and the error you got?
  5. btherl

    Huge table

    They use SQL server: http://www.baselinemag.com/print_article2/0,1217,a=198614,00.asp There's plenty of other technologies being used to allow them to handle so much traffic.. the database is just one small part.
  6. Then it's a custom tag. I'm sure it'll be defined as a smarty plugin in the php code somewhere. There is no {l} tag in standard smarty. You can try searching the php code for "register_function"
  7. $in = 5; $out = f($in); print "f($in) = $out\n"; function f($in) { return $in + 5; } Does that example help? I'm a little unclear on what your question is.
  8. That's pretty complex. If I was debugging it, I would add print/echo statements all throughout the code you are interested in, to make sure the values are correct at every stage. That should help you find the problem.
  9. Unfortunatly it does make a difference. If any of the code before line 45 is invalid, then it can create an error that is "found" by PHP at line 45. The reason is that php is able to stumble along by pure luck until it hits something it can't understand. So, you need to fix all code before line 45 before debugging an error ON line 45. The following code is syntactically correct (though it may not do what you want it to do). All I have done is fix the syntax of the switch() by adding a dummy case at the start. <?php if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) { exit(0); } echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <!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" lang="en-US" xml:lang="en-US"> <head> <title>Google Search</title> <body bgcolor="#000000"> <!-- .style1 {color: #000000} --> </style> </head> <body onload="document.getElementById('address_box').focus()"> <div id="container"> <h1 align="center" class="style1" id="title"><font color="#FFFFFF" size="+4"><u>p33n0r</u></font></h1> <?php switch($result) { case 'zxcvbnm': break; case 'error': echo '<div id="error"><p>'; switch ($data['group']) { case 'url': echo '<b>URL Error (' . $data['error'] . ')</b>: '; switch ($data['type']) { case 'internal': $message = 'Failed to connect to the specified host. ' . 'Possible problems are that the server was not found, the connection timed out, or the connection refused by the host. ' . 'YOU TYPED THE URL RONG!!'; break; case 'external': switch ($data['error']) { case 1: $message = 'that site is blacklisted'; break; case 2: $message = 'check the url i think u spelled it rong'; break; } break; } break; case 'resource': echo '<b>Resource Error:</b> '; switch ($data['type']) { case 'file_size': $message = 'THE file YOUR DOWNLOADING IS TO FREAKING MASSIVE!!!!!<br />' . 'Maxiumum permissible file size is <b>' . number_format($GLOBALS['_config']['max_file_size']/1048576, 2) . ' MB</b><br />' . 'Requested file size is <b>' . number_format($GLOBALS['_content_length']/1048576, 2) . ' MB</b>'; break; case 'hotlinking': $action = 'http://www.google.com/'; echo $action; break; } break; } echo 'somethin went rong.. try again.... <br />' . $message . '</p></div>'; break; } ?>
  10. Smart supports custom tags.. the details are here: http://smarty.php.net/manual/en/plugins.php
  11. It looks to me like that code was snipped out of a larger program. The code before that first "break;" is also required for it to function properly. That is, there should be another switch statement, but it seems to be missing.
  12. The code looks fine to me too. Can you post the entire code up to line 50? I suspect the error is earlier, but is only detected later.
  13. The simplest ways are $int = intval($str); $int = (int)$str;
  14. You deleted the line that sets $searchstring .. you have to keep that one!
  15. "Text" cannot be in different font sizes.. so I presume you mean using HTML tags? For example $str = "<font size=+2>" . $str . "</font>"; Is this what you have in mind? If possible, I would do the font size changes when you display the data, rather than when you store it. It's good to keep that seperation between storage and display.
  16. Here it is.. totally untested and ready to go! What I did was 1. Delete code to process $_GET['mode'] near the start 2. Delete mode option from the form 3. Delete switch statement that chooses between normal and boolean mode. <?php require ('get_connected.php'); // Create the search function: function searchForm() { // Re-usable form // variable setup for the form. $searchwords = (isset($_GET['words']) ? htmlspecialchars(stripslashes($_REQUEST['words'])) : ''); echo '<form method="get" action="'.$_SERVER['PHP_SELF'].'">'; echo '<input type="hidden" name="cmd" value="search" />'; echo 'Search for: <input type="text" name="words" value="'.$searchwords.'" /> '; echo '<input type="submit" value="Search" />'; echo '</form>'; } // Create the navigation switch $cmd = (isset($_GET['cmd']) ? $_GET['cmd'] : ''); switch($cmd) { default: searchForm(); break; case "search": searchForm(); ; $searchstring = mysql_escape_string($_GET['words']); $sql = "SELECT mytable_id, mytable_title, mytable_caption, mytable_dts, MATCH(mytable_title, mytable_caption, mytable_full_body) AGAINST ('$searchstring') AS score FROM mytable WHERE MATCH(mytable_title, mytable_caption, mytable_full_body) AGAINST ('$searchstring') ORDER BY score DESC"; // echo $sql; $result = mysql_query($sql) or die (mysql_error()); $hello = mysql_num_rows($result); echo "<h3>" . $hello . " Matching Results:</h3>"; while($row = mysql_fetch_object($result)) { echo $row['title']; echo "<a href='http://www.supermandatabase.com/view_comics.php?id=" . stripslashes(htmlspecialchars($row->comic_id)) . "'><strong>".stripslashes(htmlspecialchars($row->title)). "</strong></a>"; echo '<strong> #'.stripslashes(htmlspecialchars($row->issue_number)).'</strong><br />'; echo 'Cover Date: '.date('F, Y', strtotime($row->cover_date)).'<br />'; echo '<p>'.stripslashes(htmlspecialchars($row->mytable_caption)).'</p>'; echo '<hr size="1" />'; } break; } ?> [/code]
  17. Based on a quick inspection, they will work in both php4 and php5. Forget about php3, that's VERY old. Have you tried running the script? If so, how? And if it failed, how did it fail?
  18. The basic structure for while is: $i = 1; while ($i <= $phpNum) { # Do something with $i } You can access numbered variables from $_POST like this: $gnum = $_POST["gnum{$i}"]; There's no need to use $gnum1 and $gnum2 as variable names, since you will only be dealing with one at a time.
  19. Hmm.. I am guessing that it adds copies because the file is opened with the "a" flag. That means append. Instead it should be opened with the "w" flag, meaning write (also overwrite).
  20. There's no need to use that. What you have is fine. Can you add this to your script: print "Player = $player<br>"; That ensures that $player is set to what you expect it to be. If $player is not set, can you post the form?
  21. Hmm.. clown's approach looks good. He is waiting until the array is converted to a string before calling stripslashes. If you wanted to do it with a loop, you could do: foreach ($MessageArray as $k => $v) { $MessageArray[$k] = stripslashes($MessageArray[$k]); } $k stands for key, and $v for value. Edit: edited to match clown's edit. No wonder they put the time limit in
  22. You can't call stripslashes() on an array.. instead, you need to make a loop that calls stripslashes() on each element of the array. This is what leads to your later error with the unset()
  23. btherl

    1,250,000 Rows

    My impression is that jaymc doesn't have any performance problem currently.. he's just worried about future problems. Is that correct? If so, he already has appropriate indexes. A sequential scan on a million rows will definitely be noticeable
  24. It's likely your query returns no results then. Try changing it to this: $player_name_result = mysql_query("SELECT lName FROM Player WHERE playerID = $player") or die(mysql_error()); if (mysql_num_rows($player_name_result) == 1) { $player_name = mysql_result($player_name_result, 0, 0); } else { print "Sorry, the player id $player could not be found in the database<br>"; }
  25. When $no == 5, you also need to reset it back to 0. But the other thing you need to do is break the loop when there's no data left: if ($row === false) break; ... if ($no == 5) { echo "\t</tr>\n\t<tr>"; $no = 0; }
×
×
  • 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.