Jump to content

linuxdream

Members
  • Posts

    124
  • Joined

  • Last visited

    Never

Everything posted by linuxdream

  1. Not sure exactly what you are looking to do...but I would imagine that you want to grab tracking information or something like that. As I have mentioned in this forum before, I have written a PHP class called ripCURL that makes data retrieval really easy. You need curl (obviously) and at least PHP5. The class is located at: http://ripcurl.sdsustudent.com/ which has the most up to date release. It is also at: http://sourceforge.net/projects/ripcurl There is included documentation (in .doc format...I know, I'm sorry) that should guide you into using the class. For instance, if you are trying to automatically get to the tracking page then pull some data...might look something like this: [code]<?php require_once('ripcurl.class.php'); $rip = new ripcurl(); //Get first page $rip->ripRun('http://ups.com/content/us/en/index.jsx', 1); //Gather and change form data $data = $rip->getFormElements('trackMod'); $data['AgreeToTermsAndConditions'] = 'yes'; $data['tracknum'] = 'your tracking number here'; $form = $rip->getFormInfo('trackMod'); //Post data to display tracking info page $rip->ripRun($form['action'], 1, $data); echo $rip->getRawHtml(); ?>[/code] Something like this should work....
  2. Using spfoonnewb's example won't require another login. Just be sure to add session_start() at the top of the members page and then simply grab the $_SESSION['username'] to display.
  3. Most people in here would probably tell you to store it in a MySQL DB. You would need to: 1) Create the table structure with all the types of information you would need 2) Create a processing page with PHP to take the posted data, filter it, and store it. 3) Create an Admin section or something like that for you to view the posted data. That type of code on just about every other site on the Internet so it should not be hard to find. This site has a lot of tutorials that have exactly what you need code wise.
  4. So you have to have letmecheck() run checks from function3 but you can't edit letmecheck()? Not sure how you can do that. Unless in the main script where you call whoareu()...you test if it returns false, meaning that letmecheck() is false, and if it does return false then run function3. I think might work if I'm understanding you correctly.
  5. I don't think @ will prevent fatal errors, it will only suppress the message. I mean, if you use it someplace that results in a fatal error, nothing will show but the script will still die. Mostly useful for when you are using variables that may or may not be set and won't result in a fatal error if they are not.
  6. I believe you can if you serialize()/unserialize() it first, though I'm not sure about that...jesirose, any ideas? As far as length, I know that there are no specific limits (in the RFC...I think) other than what a browser will support. Explorer only goes to 2,048 characters...so it might work. If you are thinking that the user might be doing this a lot, then sessions would probably work best, even just on one page.
  7. You could just do a GET request back to the original form page. So in that special function just do a redirect with originalform.htm?postvar1=value1&postvar2=value2 as the URL If your functions are before the header output, you can use a header location redirect, otherwise you'll have to use javascript redirect.
  8. You need to explain a bit more than that. Like posting some code and db structure would help.
  9. Might want to check if safemode is on in your php.ini file. If it is, then you won't be able alter files that are not the same user as the script being executed.
  10. I'm not sure of the specifics, but I would think that the filesystem I/O would really bog down your machine. Even if the MySQL server was on the same box as the web server, I believe that any data coming in back-to-back like it would on a very busy site would utilize memory and not as much system resources as a file write. Even the cron idea seems to be a bit much. MySQL servers are designed for rapid read and write data so why not use it for what it was designed for? But again....I'm not exactly sure of the numbers.
  11. OK so I looked at the code again you will want to replace the stuff below with [code]<?php mysql_select_db($database_ConnKnowledgeBase, $ConnKnowledgeBase); $query_rs_searchResults = "SELECT document_name, about, category_id, format_id, submitter_id FROM document WHERE relating_to = '%$colname_rs_searchResults%' ORDER BY document_name ASC "; //$query_limit_rs_searchResults = sprintf("%s LIMIT %d, %d", $query_rs_searchResults, $startRow_rs_searchResults, $maxRows_rs_searchResults); $query_limit_rs_searchResults = ''; $rs_searchResults = mysql_query($query_rs_searchResults . $query_limit_rs_searchResults, $ConnKnowledgeBase) or die(mysql_error()); $row_rs_searchResults = mysql_fetch_assoc($rs_searchResults); ?>[/code] This will remove the LIMIT stuff since you said you didn't want to limit the results. If you want go get it back, then just comment out the blank searchResults line and uncomment the original one above it. It's best to copy/paste the above since I added as space after ASC in the main query. That could have been the source of your other error as well... This should work.
  12. Hmmm, I guess I missed the part where the tables and such were created entirely in Dreamweaver. I didn't even know Dreamweaver did that? Scary! Anyway, it should be like so: $query_rs_searchResults = "SELECT document_name, about, category_id, format_id, submitter_id FROM document WHERE relating_to LIKE '%$colname_rs_searchResults%' ORDER BY document_name ASC"; I forgot to assign the SQL to your variable name. That should work for getting you the results based on the search criteria. As far as the table design and working through Dreamweaver...I'm really sure. I don't know how Dreamweaver does queries, tables, results, etc.. If you can login to your MySQL server, execute a "describe document;" which will give you a print out of the table structure. That way you can craft your own queries withouth relying on Dreamweaver...if you want.
  13. Using sprintf requires that you have a %s or %d or whatever to substitute for the given value (I hate C style strings!!!). Yet in the SQL statement after LIKE you want to use a % to tell Mysql to search for anythign before/after. So your main SQL statement should be something like: $sql = "SELECT document_name, about, category_id, format_id, submitter_id FROM document WHERE relating_to LIKE '%$colname_rs_searchResults%' ORDER BY document_name ASC"; Try it without the LIMIT statement first to be sure it works.
  14. A query like: "SELECT c.*, t.* FROM TicketsSold t, Callbacks c WHERE t.cartID = c.cartID AND t.MC_EventDate = '$date'; Will have to change names and maybe table order depending on how your data is..but that should work ok.
  15. tommytx, That's really strange, line 15 of the ripcurl class is actually a comment.. 12. const WRITEDIRECTORY = "/tmp/"; 13. 14.  //Set class variables 15.  //curl handler 16. private $ch; Sorry this is becomming such a pain. I haven't had these problems on the various servers I run with this class. All my servers are Ubuntu/PHP5/Mysql5 boxes. What is line 15 on your version of the class? I can only assume that it's because of the WRITEDIRECTORY constant on line 12 of the class. Though I don't know why it would choke there (old PHP version maybe... I really don't know)??? Unfortuantely there are no forums...just me. I don't mind any questions so feel free to ask. Check my profile for my email, I think it's there. I have some basic documentation with samples of some of the methods here: http://ripcurl.sdsustudent.com/documentation/ripcurl_documentation.pdf That should be enough to get you started...but about the error, I can't reproduce it so I don't know. Maybe change the name of the class you have to end in .txt and post (or email me) the link. That way I can see exactly the content of the class and look for errors. That's really strange, I've been packing and unpacking the tar file many times on different machines and have yet to have any problems. Thanks, B 
  16. So the $_SERVER['PHP_SELF'] has no value? Try a print_r($_SERVER) and see what the values are to be sure that everything is as it should be. If everything looks good then place your query into a variable and echo it out to be sure the query string looks good. [code] <?php //Use the following just to test your string/results $query = 'UPDATE hitsTable SET visits = visits + 1 where page = "$page" LIMIT 1'; echo $query; if(!mysql_query($query)){     echo mysql_error(); }else{     echo "Query was good!"; } ?> [/code] I don't see anything wrong off the top of my head. No error messages? In the logs??
  17. That's funny... I don't know why the class would come across all messed up. I've edited it in vi and Zend and it looks fine. Try this link to the file in txt format: http://ripcurl.sdsustudent.com/releases/ripcurl.class.txt Copy and paste or change the extension to .php and all should be well. I better check my tar files to be sure there's nothing wrong with them. Otherwise, what you have should be working. Let me know if the txt file didn't work.
  18. You are using an include() which won't fail if the file is not there. Try a require_once('$cms_root_path . 'login_result.php') instead of include().
  19. You probably want to look into CURL. I have written a CURL class that makes page retrieval easy. There is also an option to show the headers. [code] <?php require_once('ripcurl.class.php'); $rip = new ripcurl(); $url = "http://someurl.com"; $rip->showHeader(); $rip->ripRun($url, 1); echo $rip->getRawHtml(); ?> [/code] The output of the above would be the header information followed by the actual page. You could preg out any information you needed. The class is located at http://ripcurl.sdsustudent.com or http://sourceforge.net/projects/ripcurl/
  20. Well then simply test if the cookie is set before you increment the visit count: [code] <?php if(!$_COOKIE['yourcookie']){     $page = $_SERVER['PHP_SELF'];     //Assuming you are using a DB abstraction layer...$db     $db->query('UPDATE hitsTable SET visits = visits + 1 where page = "$page" LIMIT 1'); } ?> [/code]
  21. I think a table structure just like you put with visits and page would work well. At the top of each page you wish to record as a hit, just include a quick query like: [code] <?php $page = $_SERVER['PHP_SELF']; //Assuming you are using a DB abstraction layer...$db $db->query('UPDATE hitsTable SET visits = visits + 1 where page = "$page" LIMIT 1'); ?> [/code]
  22. Are you sure you copied the php_mysql.dll into your c:\php\ext\ directory?
  23. I think what you want to look into is called pagination. Though pagination usually occurs when you either have too many results of a search to display on one page or you are progressing a user through a site in a very systematic way. You should post your site URL and explain what type of pagination you need.
  24. So you want to see header information when someone visits your site??? Or do you want to show the header information between visitors to your site and your server?? Or do you want to create something that makes a request to a provided URL and see the headers? Your post was a bit confusing. Maybe list the URL that you are speaking of where this functionality already exists.
×
×
  • 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.