Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. You can't run a php function directly from a form action .. but there are a number of alternatives depending on what you want. 1. Use AJAX to send a request to php, and use javascript to display the response in the browser (or to modify the form before submission) 2. Just submit the form with a hidden variable set and have php pick up on that, and do whatever you want it to do. AJAX is the solution when you want to fetch data from php without reloading and redisplaying the entire page.
  2. I suspect the problem is with extract(). There's a number of solutions, the safest being to use {$Row['Id']}, {$Row['Username']}, etc etc inside the echo. That way you can never clobber your session variables. And the reason that may work on one server but not another is probably the register_globals setting. With registered globals, it's possible for a standard variable like $UserLevel to overwrite $_SESSION['UserLevel'], because they both reference the same value. Edit: To fix the problem (if this is what it is), remove the extract() line and use {$Row['Id']} in place of each of your $Id style variables in the mysql result loop.
  3. Have you verified the problem with a short script like this? session_start(); print "Session foo is "; var_dump($_SESSION['foo']); $_SESSION['foo'] = 1; My first guess would be that register_globals is not set in the new php.ini
  4. There's an oracle sub-forum here. I'll request that this topic be moved there..
  5. If you want to do something with the user's input after displaying the page but BEFORE form submission, you can use javascript. If you want to do something AFTER form submission then you can do that in the script which receives the form data. If you want to do something BEFORE form display, then you can do that in the script which displays the form. That covers all 3 situations (before form display, after display but before submission, and after submission). Does that make sense? I'm not sure which of those 3 situations you want in your example.
  6. Try like this: $sql = "SELECT username, password FROM users WHERE username = '$usr' AND password = '$pass'"; You should also use pg_escape_string() on $usr and $pass first, otherwise people may be able to insert their own sql commands into the username or password.
  7. When you display someone else's HTML code on your site, all the relative links will be relative to YOUR site. If all you want is a php web proxy, Yoctoproxy does a decent job of that. If you want to make your own proxy, then be warned that it's not easy You'll need to rewrite all those links like yoctoproxy does.
  8. Change it to this: $query = "SELECT * FROM joovili_buddies jb JOIN joovili_buddy_feed jbf ON (jb.buddy_buddy = jbf.feed_username) WHERE jb.buddy_username = '{$_COOKIE['session_username']}' ORDER BY jbf.id DESC LIMIT 15"; $fetch_feed = sql_query($query) or die("Error in $query: " . mysql_error()); That will tell you if there's any error in the query. If sql_query() already does error checking, ignore that Anyway, I have added missing quotes around the username. That will probably have caused the query to fail.
  9. Try adding some print statements throughout your code, such as print "Entering update branch<br>"; ... print "About to execute $query<br>"; ... print "Query succeeded<br>"; That will give you a window into what is happening in your code.
  10. Are you using mysql? A brief description of your app would be nice too, otherwise we may give totally unrelated advice!
  11. Try changing it to $resultr = mysql_query("UPDATE `join` SET `show` = '2' WHERE id='$jid'"); But it's probably better to rename that table if you can. Both "join" and "show" are special words in mysql.
  12. Ok try this query: SELECT * FROM joovili_buddies jb JOIN joovili_buddy_feed jbf ON (jb.buddy_buddy = jbf.feed_username) WHERE jb.buddy_username = {$_COOKIE['session_username']} ORDER BY jbf.id If there's overlapping column names in those two tables you might need to explicitly rename them (eg, if both tables have an "id" column). The basic idea is to match up the two tables using jb.buddy_buddy and jbf.feed_username. Then just order the results and take out whatever data you want. Btw, is the logged in username stored directly in a cookie? Cookie data can be modified by the user. If you can, use sessions.
  13. The number you need to add is (4 - ($num1 % $num2)). $save = $num2 - ($num1 % $num2);
  14. Have you got the table definitions there? It's possible this can all be done in a single mysql statement.
  15. gc_maxlifetime is like an idle timeout - if the user doesn't hit a page with the session active for 24 minutes, then the session will disappear. It sounds like you should increase this to 40 minutes to get the behaviour you want. The relationship between the two settings is that if either runs out, the session is destroyed. So it's an "or" relationship.
  16. Popping the window is handled by javascript and the browser. But delivering the headers to tell the browser to download the file is handled by the php script and the web server. That's the basic separation of tasks.
  17. Can you post more of the code? None of what you posted contains the string "User Selected", which appears in the output.
  18. When faced with this kind of problem, I often use browser based tools like firefox "Live HTTP headers" and web developer toolbar, and IE's developer toolbar (download from microsoft.com). When you see exactly what headers are actually being sent by your script, sometimes you can notice something that isn't quite right.
  19. What do these shell commands show: ls -l /var/www/vhosts/site.com/httpdocs/applications/home/utils/linux/pdf2image ls -l /var/www/vhosts/site.com/httpdocs/applications/home/utils/extract/pdf2image
  20. Try printing out the input values to input_select(), just after the function starts. You can use code like this: print "<pre>"; var_dump($options); print "</pre>"; That will verify that the option are being passed into the function. If the options ARE being passed in, then the problem is either with the format of the options or inside input_select() somewhere. If the options are NOT passed in, then the problem is before input_select() is called. That way you narrow down where the problem is. Have you checked the HTML source of the page to see what the color select looks like?
  21. PHP won't crash if that's what you're worried about There may be performance hits if you do a lot of manipulation on the large string though, especially manipulation that modifies the start or middle of the string. That will typically require copying the whole string. If you plan to manipulate the body frequently, Matt's suggestion of an object may be more efficient. I have used php for strings around 500MB in length (that's 500 million characters, in one variable).
  22. Does it work if you create and delete the cookie from scripts running under the same path? Eg, run both scripts under "/" or both scripts under "/a/". Another thing to try is to create and delete your cookie without setting the path. If either of those work, then you know it's an issue with paths.
  23. Try this: <?php while ($a = mysql_fetch_array($approvals)) { if(isset($_POST[$a['approvals']])) { $sheetid = $_POST[$a['approvals']]; } } ?> The syntax for how you were trying to do it is like this: $val = "{$a['approvals']}";
  24. Something is very wrong here: $res = pg_query ($conn, "SELECT * from Top where $res=e($sql);"); You use pg_query() in the same way as mysql_query(), except the order of the arguments. So: $res = pg_query($conn, "SELECT * from Top where user = 'foo'"); for example
  25. If the database is encoded with UTF8 then you should get multibyte ORDER BY. But if you're using single byte encoding for the database, I don't think there's any simple way to get ORDER BY to compare using different rules. There is probably a complicated why, by using an alternative comparison function. That's not something I've had experience with.
×
×
  • 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.