Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Try replacing fgets($file) with trim(fgets($file)) and see what you get. When you read lines from a file, they include the newline character. trim() will remove that for you.
  2. I can offer general help only. That output indicates that you didn't use sprintf() where you should have, OR you didn't provide enough arguments to sprintf(). I would guess this line is the problem: $this->ipsclass->lang['usersviewing'] = sprintf( $this->ipsclass->lang['usersviewing'], $this->ipsclass->lang['usersviewing_prefix'], $total );
  3. You can't, because array_push() only adds numerically indexed elements. But you can simply do $replacements['test'] = array("!*EMAIL*!" => "email@email.com"); And it will be added to the end of the array. In any case, "$array[] =" iis recommended instead of array_push().
  4. strtr() does not replace strings it has already replaced. You can use this instead of str_replace()
  5. It looks like you are joining dt_profile and dt_photos without a join condition in the second query.
  6. You haven't specified a join condition. Eg SELECT * FROM CubeCart_inventory cci JOIN CubeCart_customer ccc ON (cci.album_id = ccc.album_id)
  7. The difference is that JOIN requires matching data in ALL joined tables. LEFT JOIN requires only data in the left table. If there is no matching data in the right table, blank data will be added. Example: SELECT * FROM employees JOIN phone ON (employees.empno = phone.empno) If an employee has no phone number, then no data will be fetched here. But SELECT * FROM employees LEFT JOIN phone ON (employees.empno = phone.empno) If an employee has no phone number, data WILL be fetched from the employees table only, and the columns from the phone table will be set to NULL.
  8. Here is another approach: http://php-html.sourceforge.net/ This is a parser which will present you with each HTML tag in turn, and parse the attributes for you. Your parser can look like this: while ($parser->parse()) { if ($parser->iNodeType === NODE_TYPE_ELEMENT && $parser->iNodeName === 'input') { print "Attribute name of the input element is {$parser->iNodeAttributes['name']}\n"; } } I use this for most of my HTML extraction needs, such as google SERP, yahoo SERP and others.
  9. eits, I think the right first step is to give your variables more meaningful names. What is $row_conn? What is $row_conn1? What data does the $conn result represent? Also, $row_conn changes its meaning because it is re-used in the while() loop later on. Better to use a new variable name to avoid confusion.
  10. Thanks! Those are the kinds of functions I'm looking for. I'm going to try out a few of them and see if I can get a curve that works.
  11. How on earth would they get netbios info to put in a central database?
  12. Cooldude, PARAGRAPHS please One big long stream of text may be easy to write, but it's very difficult to read.
  13. You must put the "global $_CONFIG"; inside EVERY function which accesses $_CONFIG. This is different behaviour from some other languages.
  14. Please post your full code. If your code is too large, post a smaller script that replicates the problem.
  15. The netbios name doesn't come along with an http request (which is what php works over). But you may be able to resolve the ip address back to a netbios name from your script, perhaps with an external program. I can't help you with details of which program unfortunately. Are you running windows or linux on the php server?
  16. The details of php's usage of the GD library are here It supports GD2, and like thorpe said, will be no slower than using the GD library via an external program. gd_info() will tell you details of the library your php is using currently.
  17. The typical setup is that you use a single MYSQL user account, and have a users table to keep track of your application level users. It's much cleaner that way. That's the approach cooldude is showing. This is true ONLY if you check your input first, and remove any unsafe charactes. Same with the password.
  18. Try this function: function getconfig($getkey){ global $currentconfig; return $currentconfig[$getkey]; } The problem may be that global variables are not available by default within a function
  19. Here is the full thing, from query to result: $sql = "select timecounter from admin where username='$username'"; $timecounter_result = mysql_query($sql) OR die(mysql_error().' Query: '.$sql); $row = mysql_fetch_array($timecounter_result); $timecounter = $row['timecounter'];
  20. There's a bunch of system catalogs which provide this. These change a little with each major version of postgres. You can find a list here Of particular interest: SELECT * FROM pg_tables WHERE schemaname = 'public'; SELECT * FROM pg_database; SELECT * FROM pg_indexes WHERE schemaname = 'public'; SELECT * FROM pg_views WHERE schemaname = 'public'; There's also the pg_class table, which is global table containing just about everything. Those tables I listed above are actually views into pg_class joined with some auxiliary tables.
  21. Sorry, that's my mistake. Try this instead of mysql_fetch_result(): $row = mysql_fetch_array($timecounter_result); $timecounter = $row['timecounter'];
  22. Hmm, you will need to alter your existing form, rather than adding new lines. You should alter your existing form tag and add name="book" Then you should alter your existing submit input, and add the "onclick" attribute. The last thing you need is this: <input type=hidden name=NOSPAM value=SPAM> That's a hidden variable in your form, defaulting to "SPAM". If a user runs the javascript when they submit the form, then it'll be changed to NOSPAM. That's how you can detect usage of the form by a bot that does not interpret javascript.
  23. Also, $timecounter is a result, not a number. $timecounter_result = mysql_query("select timecounter from admin where username='$username' "); $timecounter = mysql_fetch_result($timecounter_result, 0, 'timecounter'); print "Timecounter has value $timecounter for user $username<br>";
  24. Single quotes are faster than double quotes, because single quoted strings don't need to be examined by php. But double quotes strings may contain variables, so php has to check for that first. My syntax highlighter (vim) highlights variables inside double quotes. Regarding echo, it doesn't matter. Even if there is a speed difference there, it'll be too small to matter. Both act the same way.
×
×
  • 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.