Jump to content

Anidazen

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Everything posted by Anidazen

  1. Hey -- thanks in advance for the help! This is a bit of a mystery. I am trying to automatically update my signature link in a forum (http://www.warriorforum.com/forum/ to be precise -- if that's relevant). I can't do it! No matter what I try, I cannot get the page to work. I have used a header viewer to give the EXACT same cookie string that my real user-session has at that point. The code is as below. The postvars are exactly right too... I flipped the form method to GETs and copied and pasted from the URL. Given seemingly EXACTLY the same information as the browser feeds it, I cannot elicit the same response. I'm running this from my desktop so even the IP will be the same! Please advise! $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 1); if($postvars){curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);} curl_setopt($ch, CURLOPT_COOKIE, $cookie); ob_start(); curl_exec($ch); curl_close($ch); $content = ob_get_contents(); ob_end_clean();
  2. Hey guys. I've never created an AJAX application, but I've looked at tutorials etc, and I think I understand the concepts. The problem is, my script is designed to update piece-by-piece. This means not waiting for the called page to finish loading. How can I update as each different section of my script is ready? I can write any javascript, no problems -- do I need to use iframes or is there a clean way? Thanks in advance. Just to clarify... I would be fine doing this with an Iframe. I'd just pass arguments to the PHP in the URL, then write parent.function1("Values"); - or something similar. What I don't understand is how to call functions in a similar way from the XMLRequest thingy that's used for cleaner AJAX -- without waiting for the entire page to load?
  3. Hey guys. I'm being massively held up by being unable to get a function right to sort my rows. I have an array called prices. Format is as such: prices[sellerID][priceID] I want to be able to sort it by the price element. Been trying to get a function that will take a new priceID , and will give me an ordered list of sellerID s for that price. Lowest to highest, preferably with undefined coming last. Eg. to return an array like "5,1,4,0,3,2", with every element referring to sellerID, as ordered by priceID. This is really causing me some grief... I just can't wrap my head round it at all If anyone can help me I'd really appreciate it.
  4. Hey guys. I'm being massively held up by being unable to get a function right to sort my rows. I have an array called prices. Format is as such: prices[sellerID][priceID] I want to be able to sort it by the price element. Been trying to get a function that will take a new priceID , and will give me an ordered list of sellerID s for that price. Lowest to highest, preferably with undefined coming last. Eg. to return an array like "5,1,4,0,3,2", with every element referring to sellerID, as ordered by priceID. This is really causing me some grief... I just can't wrap my head round it at all If anyone can help me I'd really appreciate it.
  5. Hey guys. My PHP experience has moved seriously in the direction of bots, parsing etc. -- find all that stuff quite interesting. The problem is that I'm trying to parse some pages which are Ajax/JavaScript generated, so the code that CURL etc. retrieves is nothing like the code that actually ends up there. I was wondering if anyone knew a tool or anything to identify *where* the page code actually exists. (Generally which scripts are being called in the browser to supply the HTML via DOM. How to identify those scripts and what paramaters they're being given.) Or alternatively... Is there any way to parse the *generated code* -- ie. like the firefox developer plugin lets you view. I know that this is a little out there atm...
  6. Bit more explanation/information from me. What could be done is something like: while(strstr("\\",$string)){ $string = str_replace("\\","\"); } But that would cause any time I need to enter a double backslash legitimately to fail. Forms messing with my scripts = irritating.
  7. Hi guys. I'm using a script which involves me entering a regular expression into a form which is then applied. Regardless of what method the form seems to use, the expression gets mangled. The problem is, in some places backslashes get one extra backslash added, in other places two -- so I can't just use stripslashes. Reducing all backslashes to one is tempting and possible - but if I need to insert a double backlash (ie. literally match the backslash symbol) then this won't work. Any ideas?
  8. Hi there. I am very interested in curl_multi, but have been unable to find much information on it at all. For something so tricky and powerful, it seems to be quite badly documented. (Or I suck at Google. One of the two.) Does anyone know a good article on curl_multi? The only decent example I managed to find was posted as a comment in one page of the PHP.net manual. This would appear to fetch three urls, and seems to have scope to be easily scaled. However, there's some real issues I have here, and I need help understanding them. I assume in the below code that at the end you can access these pages as $res[$i]. But to put this to practical use I would really like to know if this could be used to process pages *as they come in*. I run a specialist site using spiders in real-time to fetch info, and I need to show the first results as soon as they come in. I can't wait for all of them. Is there a way to process info as each individual handle is ready? Also - Is there a way to identify the URL of the site, as well as the content? Here's the example code I'm quoting. (I assume the print_r at the end is an error, and should be $res[$i] instead.) <?php $connomains = array( "http://www.cnn.com/", "http://www.canada.com/", "http://www.yahoo.com/" ); $mh = curl_multi_init(); foreach ($connomains as $i => $url) { $conn[$i] = curl_init($url); curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1); curl_multi_add_handle ($mh,$conn[$i]); } // start performing the request do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); while ($active and $mrc == CURLM_OK) { // wait for network if (curl_multi_select($mh) != -1) { // pull in any new data, or at least handle timeouts do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } if ($mrc != CURLM_OK) { print "Curl multi read error $mrc\n"; } // retrieve data foreach ($connomains as $i => $url) { if (($err = curl_error($conn[$i])) == '') { $res[$i]=curl_multi_getcontent($conn[$i]); } else { print "Curl error on handle $i: $err\n"; } curl_multi_remove_handle($mh,$conn[$i]); curl_close($conn[$i]); } curl_multi_close($mh); print_r($res); ?>
  9. Business - thanks for your reply. I am still confused though, and Googling for tutorials is being surprisingly unproductive on what I would assume is such a basic thing. Could someone show me some samples of working with time? I need to know: 1) What to set the field type to in MySql Admin. 2) What a query should look like for SELECT * from X where X < a week ago. 3) What variable I need to pass for this in the INSERT query too -- or just leave it blank? Thanks in advance.
  10. Hey guys. My mind's just gone completely blank today and I just can't for the life of me work out how to return records from an SQL table from the past 24 hours / the past week / the past month. Can't find the info I need either and I KNOW it's in like a thousand places... Couldn't find anything that tells you what to set the MYSQL variable type to when you create the table and how to structure the queries. Could somebody just show me a quick demo of how to do this? Thanks a lot.
  11. Hello. I'm a half-decent PHP guy with an e-commerce website that makes ok saturday-job money, but I don't use a shopping cart, I knocked something together myself and I'm finding upgrading it myself a daunting to impossible task. These forums are by far and away the best place I could think of to get some advice. Firstly -- I would LOVE a website that looked and behaved a lot like www.4mmo.com (this is NOT my site). There's so many things I love about this from the look to the functionality. Some of this can be shown off by pages like this: http://www.4mmo.com/powerlevel.aspx?serverid=2217 . My questions are thus: 1) Does anyone know what shopping cart, theme, or anything that the above site uses? I love it. 2) Failing that, how could I get some similarly powerful software? I love so much about this site, from the look to how they can seemingly add completely seperate pages that add stuff to their shopping cart in totally different ways, to how (and the way) it asks you to create an account. Here's an amazing example of what I'm on about: http://www.4mmo.com/item.aspx?serverid=2217&key=A If I could find the same software and a similar theme I'd jump for joy, and if it could integrate telephone-verification-antifraud-calls and I could offer individual users site wide or product specific discounts and maybe a personalised welcome message, then I would consider it nothing short of a miracle. I sell virtual products with a real value -- eg. currency in online games, so financially fraudsters have a lot to gain and I have a lot to lose. It's not like ebooks where you only lose the sale, here I lose what I paid for the stock, which is about 70% of selling price. There's no delivery address. So fraud is a major problem. This means that I need some kind of automatic fraud service and phonecall integration thing. That's the biggest problem. Please, any help is appreciated -- and if anyone knows about this kinda thing and is willing to spend a little time advising me on getting the kind of advanced storefront that I need set up, then it'd be great to pick your brains a little by email.
  12. Hello. Firstly - yes I have Googled this and spent quite a while trying to understand these complicated HTACCESS rewrite engines and stuff, and it just completely escapes me. Is anyone able to create for me a line that will block 74.6.0.0 - 74.6.255.255 (all the 74.6's) from accessing http://www.mydomain.com/myfile.php5 and redirect them to http://www.mydomain.com ? I'm trying to do this because I have a file that uses MASSIVE resources, and it's being hit repeatedly by Inkitomi's bot, in clear violation of robots.txt. This usage is costing me a fortune. The same principle will be used to any other bots doing this. Permenant redirect would be best ofc.
  13. Hello, Cheers for reading. Basically, I simply want to record a time with every SQL insert, and then use a function to count how many times that same user (identified by IP) has run the script in the last 24 hours. So all I want is a format to record in SQL and then a query to check this. With PHP unix timestamp this would be a simple matter of returning where the timestamp is greater than time() - 86400 (the number of seconds in 24 hours). However, I don't know how to set UNIX timestamps... Anyone able to help?
  14. Hi. I'm looking to create the most robust system possible for preventing PayPal chargebacks (people using phished PayPal accounts). The product doesn't need a shipping address, but has some very real value, and I have to actually pay for each item I issue at 70% of the purchase price - not like an ebook etc. Here's what I'm thinking: 1) Cookies track users, can see when multiple accounts same PC etc. 2) Signup before purchase so I've got a username handle on people, can set spending limits etc. 3) IPs logged obviously, check for proxies and check location against seller's location. Deny high-risk countries. (Refund payments where there's any suspicion). 4) Free-email checks were considered, but in the end I gave up on this as pointless, as 90% of my customers would use these. What I might do is try to check if the email given uses MSN messenger, etc. Assuming that these are more likely to be genuine. 5) Auto varification of a landline telephone number via. a script that rings it and gives you a PIN. Test the number type too, no mobiles, and human judgment call if it's a skype etc. line. (possibly pursue further verification). 6) Log PayPal address used, and whether PayPal is verified - compare this with IP and telephone number. What other steps could I take to combat PayPal fraud? Does anyone know of any method to check if a user is on dialup or broadband? In my particular area security of this kind is a business-halting concern, and I want to be 100% certain the person paying is the owner of the PayPal account. Beyond that- I can deal with.
  15. Hey guys. I'm trying to battle with an incredibly persistant problem in one of my scripts - regarding SQL interaction. Basically, I connect at the beginning of the script, do two queries, then the script runs... and this can take quite a while - under 10 seconds would be counted as very fortunate. Then after it's run I save the results. However, I'm getting errors occasionally on this last query ("server has gone away", "lost connection to server"). I've added a mysql_ping(); line just before this query, and when it fails it returns false to this. Basically, I can direct solving this into 3 questions: 1) I thought mysql_ping() auto reconnected. Do I need to add a connect line for when it returns false? What about select database? 2) I'm using mysql_pconnect() at the start of the script - would I be better off using a different variation of the function, maybe closing it then reconnecting? 3) Any general advice I might not of thought of?
  16. The first one - a maximum execution time or it fails.
  17. Hey guys. I was just wondering, is it possible to set a timelimit on one particular function, query, etc? Would be using it for an SQL query - but would be good to know in general. All I could find in the manual was entire script execution times or socket execution timelimits. Don't know if this even exists.
  18. I eventually figured this out. Redirecting within a frame should be simple... and it turns out that it is. The issue wasn't with my script, turns out the site I was redirecting to was causing the problems with script on their own site.
  19. I know this sounds like the most simplistic, ridiculous task, but I've tried everything and searched for ages. NO idea why I can't seem to do it. I've got a page that loads an iframe containing a PHP script. Once the script has done, I want the iframe to go to a different URL. However, PHP redirect sends the parent's location, as does just about everything else I've tried. I've found NOTHING that can automatically redirect the iframe itself, and not the parent. It's insane! Anyone able to help?
  20. It's on a hosted site with 1&1 internet. I can show the script if it will help. One thing about it that might be relevant is that I connect at the beginning and some queries can occasionally be a good 20 seconds after the initial connection, I guess that could be part of the problem. I'm afraid I don't 100% understand everything you're asking. :(
  21. Print! Awesome to see you're still around, I thought you'd left the boards. :) PM incoming.
  22. Hello. I'm running a script which I'm having some incredibly unusual problems with - in that, unlike pretty much every other PHP script I've ever encountered, the results simply aren't consistant even with the [i]exact same[/i] paramaters. It's very difficult to work on, as the script successfully loads the majority of times, and then goes into errors the rest - so diagnosing it is a real pain. It also takes a while to run, compounding the issue. Anyway, to try and catch this out I've done several rounds of diagnosis, etc. etc. - it's a complicated creation. Anyway - it seems SQL queries in the script sometimes randomly fail. Even, like I said, given the exact same input. It's totally random. I set up the script to actually mail me when there was an error, and it turns out I keep getting one of these two errors: - Lost connection to MySQL server during query. - MySQL server has gone away. The first seems a little more common. Anyone have any idea how to fight this?
  23. Hey guys, Asked about this a couple days ago and got no response, so I am re-posting and elaborating. Basically, here's the issue: - I have a script that fetches several websites while a user waits. Due to the custom nature of each search, this information cannot be cached efficiently - it has to be real time. - To do standard CURL requests, fetching and parsing each website in sequence produces an uncomfortable load time. A high quality load-bar can only buy you so much time! - A very kind member of these forums (printf) helped with a class that helped, but this was ages ago and printf no longer visits the boards (i believe). The problem is that the class is simply too unstable - with random timeouts occuring for one reason or another. So I'm looking for some stable way to download more than one website at once in PHP. I really can't believe that wanting to do this is as rare as it seems to be, I'd have thought it'd be mainstream. Anyway - does anyone have any suggestions how to do this? I am considering taking an AJAX style approach, loading each request in individual frames then either passing the information through the browser (JavaScript) or through the server (MySQL). One glimmer of hope appears to be the "PECL HTTP" class, of this website: http://pecl.php.net/package/pecl_http It says it supports parallel requests in PHP 5+. I don't know anything about this, and maybe somebody on this forum can give me some more info. (Does this mean seperate, concurrent pages are possible?) Seems to be very, very little community-based information on this class, and the documentation is far from helpful. Edit: Forgot to mention: is there some other technology that would be more suited to this task than PHP? So I know I've raised a lot of questions in one single post, but if people could give some help or advice to any of it, then it would be appreciated.
×
×
  • 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.