Anidazen
Members-
Posts
79 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Anidazen's Achievements
Member (2/5)
0
Reputation
-
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();
-
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?
-
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.
-
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.
-
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...
-
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?
-
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); ?>
-
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.
-
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.
-
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.
-
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.
-
Can't get my head aroud date time MYSQL - hopefully simple question.
Anidazen replied to Anidazen's topic in PHP Coding Help
Thanks monk.e.boy - that's very helpful. Good man. -
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?