Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. You might want to keep a RewriteLog
  2. It's hard to tell without knowing anything about the tracker. Do you set the user agent in curl to a browser user agent?
  3. You'll need to check if strxpos() succeeded or failed instead of just passing it directly to substr(). That's probably what's causing the looping. You can add some diagnostic print messages to see where the problem is.
  4. Try this: function strxpos($xtext,$xchar,$xpos){ $pshchar=strpos($xtext,$xchar); $owut=0; for($numon=1;$numon <= $xpos;$numon++){ $result=strpos($xtext,$xchar,$owut); if ($result === false) return false; $owut=(strpos($xtext,$xchar,$owut) + 1); } return $result; } It will return false if the requested occurance doesn't exist in the string.
  5. Here is the simple method I use to prevent spam on my guestbook: function nospam() { document.book.NOSPAM.value = "NOSPAM"; return true; } document.book is the form, which has a hidden variable called "NOSPAM. The submit button looks something like this: input type="submit" name="gb_action" value="Post" class="input" onclick="nospam();"> Then the code to test for spammage is: if ($_REQUEST['NOSPAM'] !== 'NOSPAM') { # Whoops, someone didn't click the button. print "This site requires javascript, blah blah blah"; } Like tibberous' method, this only works against automated spammers, not real people. Forms can be named like this: <form method="post" action="addentry.php" name="book" enctype="multipart/form-data" onsubmit="return checkForm()"> Note the name="book". The form can then be referred to in javascript as document.book
  6. Sessions are usually used to track a particular user, and very often used to record that they are logged in. Session ids are part of the mechanism of sessions, which can be used to track a user, so the session id directly doesn't tell you the user is online. It's the session id as well as the contents of the session (such as $_SESSION['logged_in'] = true) that tells you the user is online. Yes, the id set for you automatically when you register the session. The cookie is also automatically set.
  7. In normal operation, the session id is placed in a cookie. The user's browser sends that to identify the session. PHP stores the session's data in a file using the session id as part of the name. It can be used in other ways (such as added to a url) and session data can be stored elsewhere (such as in a database), so the above is just the default mode of operation.
  8. The result IS vertical, when displayed as text. It's just not vertical when displayed as HTML. If you view the source of the page, you'll see the formatting which you see in the documentation.
  9. A better topic name might help to bring attention to your questions. As for your question 2, try printout out your variables to check their values. Use var_dump() rather than print if possible, as it is more detailed. In your code there is no need to define $user_line, as it is defined by the foreach loop.
  10. Do you have more configuration apart from that one AddOutputFilterByType line?
  11. You can try fopen("http://www.host.com/script.php", 'r'); Or, it's more efficient if you can use include('test.php') to run the script. Try it both ways.
  12. Try this: print "<pre>"; print_r($var); print "</pre>"; The other option is: print nl2br(print_r($var, true));
  13. I think Barand is talking about this: 4(x-2)^2 = 4(x-2)(x-2) = 4(x^2 - 2x -2x + 4) = 4(x^2 - 4x + 4) = 4x^2 - 16x + 16 No complex numbers involved there.. The lesson is, don't do maths in your head and drive! The same rule applies when not driving.
  14. Try using the full url to the script instead of just "form.php"
  15. I understand what you are saying, but that's not what I want. I want a log-like function with a single integer as input and a single float as output. Do you know of any such functions?
  16. (x^(1/b))^a is the same as (x^a)^(1/b), rather That's what I meant, sorry for not being clearer. Anyway, what is your current goal, when you say you are back where you started? Are you still thinking about the apparent paradox in your earlier post? I think the solution there is that you simply can't take the 3 and 6 inside, because that rule doesn't apply for x < 0. So you have to use other methods to solve, and those other methods will give you a correct result.
  17. So what you want is - Picks for previous weeks for all users - Picks for current week for current user Is that right? And what does the SQL you posted give?
  18. Hi! I've made some corrections (marked with comments) <html> <body> <?php include("test2.txt"); ?> <form action="test.php" method="post"> Name: <input type="text" name="name" /> Comment: <input type="text" name="comment" /> <input type="submit" name="submit" value="Submit" /> <!-- Should give submits name and value --> <?php # Should check if string inputs are empty, not if equal to 0 if(!empty($_POST["name"]) && !empty($_POST["comment"])) { $file = fopen("test2.txt", "a+"); fwrite($file, "name: "); fwrite($file, $_POST["name"]); fwrite($file, " "); fwrite($file, "Comment: "); fwrite($file, $_POST["comment"]); fwrite($file, " "); fclose($file); } # It's never necessary to empty out $_POST. It is reset on every script call. ?> </form> </body> </html>
  19. Programmers for the Ethical Treatement of Code will be in touch with you shortly Well that code is quite long, but is the general structure that $TransactionStarted is set to 1 and then passed back to subsequent script calls via the TP get variable? If so, then you can debug the problem as I described above (using a log file to catch each execution of the script). The reason being that the only way the code could be run twice is if the script is run twice. Therefore, the script was run twice This can also happen if you accidentally include your script into itself somehow. You can avoid these double includes by using include_once() instead of include(). I usually use require_once(), which kills the script if the required file is missing. If you don't want to debug the problem and just want to fix it, I would recommend either using sessions or checking the database instead of using a get variable. I would expect either approach to fix the problem.
  20. More likely that TransactionPerformed is not being set when the script runs a second time. That could be caused by a lot of things, like browsers fetching the page twice or caches fetching it twice. TransactionPerformed comes from the $_GET variables, which is risky practice in general. Is that your entire script that you posted?
  21. Perhaps you should check the database to see if a transaction has started, rather than relying on variables passed to your script. As for debugging the problem, a good technique would be to have your script dump a logfile every time it runs. The log file should contain the entire contents of $_GET and any other relevant data. Then you can see what shows up in those logs, and trace it back to where the script call comes from. I usually dump a seperate file for each script run, rather than sticking them all together. It's easier that way, and you don't run the risk of having output from different script runs mixed together.
  22. At your service Take the rule here: (x^m)^n = x^(mn) From this it follows that (x^(1/b))^a = x^(a/b) (x^a)^(1/b) = x^(a/b) I assume that's what you meant, not (x^b)^(1/a) These rules certainly don't work for b=0, and I would have doubts once things start getting negative..
  23. My input domain is a single integer, not a vector of integers.
  24. For any other people who might find this thread later, chcon is an SELinux command. That's a permissions system that runs on top of chmod, meaning BOTH conditions must be satisfied to get access.
  25. mktime()[/code] is often used for date arithmetic. Examples are in the link.
×
×
  • 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.