Jump to content

cirma

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cirma's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That's a great idea, thanks...I'll use session variables
  2. Hi, I'm using fsockopen() to call a web service. The service simply looks up a surfer's IP address and returns their city with whatever accuracy. We get charged per query...so if a surfer refreshes the page 100 times, we get charged 100 times. Don't ask me why we're not using another solution not involving a web service, I didn't make that decision Anyway, I need to prevent that from happening but still allow the surfer to refresh the page 100 times. So what I want to do is cache the surfer's IP address and city after the lookup so that we only ever get charged once per IP within a given day. I was thinking of simply calling the webservice, storing the IP and city name in a mysql database, then every time a surfer visits the page, checking to see if we have the IP stored to begin with. If not, call the web service, otherwise, retrieve it from the db. Is there a more elegant solution than this? We'll be doing about 9-10,000 lookups per day, and I'm not sure if there's a way to cache the responses with less performance hit, like not by using mysql? Thanks.
  3. There is an RSS feed where I need to strip "align=left" everywhere it appears in the feed. I want to otherwise leave the feed alone. So when I go to mysite.com/feedstrip.php it will access http://www.othersite.com/rssfeed.xml , remove "align=left" everywhere it appears, and then leave spit out the feed. The feed doesn't need to be parsed or anything like that...I just need a way of getting a modified version of the feed. How should I do this? What should I look for in the php manual?
  4. Thanks thorpe...but that gives me the md5 for everything they put in the box. I want to md5 each individual line in the box. ??? edit: so they enter like: word1 blah meh and then the script spits out word1 fkgjdfkgjf98454b blah rRmfgTlfm459839t meh j453fjvBEmtltjk etc.
  5. Hi, I'm trying to make a form where a surfer can enter a list of words in a text box, then the script spits out the words and their corresponding md5 value in a table. But I end up with it just doing the first letter of the first word they entered. Here's my code: <?php $data=''; if (isset($_POST['data']) && strlen($_POST['data'])>0) { $data=$_POST['data']; } if (isset($_POST['submit'])) { if (strlen($data)>0) { $newarr = explode("\n\r", $data); print '<b>Results</b><br><br>'; print '<table width = "800" columns = "2" border = "2">'; foreach($newarr as $line) { print '<tr>'; print '<td>'; print $newarr{$line}; print '</td>'; print '<td>'; print md5($newarr{$line}); print '</td>'; print '</tr>'; } print '</table><br><br>'; } else print '<b>You need to enter some data</b><br><br>'; } ?> <b>Enter data here</b><br><br> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <textarea name="data" rows="15" cols="100"> <?php echo $data; ?> </textarea> <input type="submit" value="Submit" name="submit"> </form> I've tried diff combinations of \n\r but I think what's happening is I'm not getting to the next line? Any ideas? thanks
×
×
  • 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.