Jump to content

DSGameMaker

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

About DSGameMaker

  • Birthday 11/12/1993

Contact Methods

  • MSN
    james@invisionsoft.co.uk
  • Website URL
    http://www.dsgamemaker.com

Profile Information

  • Gender
    Male
  • Location
    Yorkshire, United Kingdom

DSGameMaker's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I bookmarked it but will not be using it right now, looks similar to cron job stuffs. Thanks for the help. Now, back to that substr efficiency thread..
  2. Alright. I'll use the database, as I can log other downloads therewith too. Thanks. I want to know about APC, I thought I knew everything useful about SQL but this has caught my eye. Have you got a link to something on php.net? Ta.
  3. Hi folks, I know there's 2 ways you can build a download counter: A file to which you write, or writing to a specific row/field in a MySQL field. As this php page for recording the download is going to be used alot, like 1000 times a day, it has to be efficient. All it will be doing is: Take the number of current downloads (GET), add 1, save it (SET). I know file handling and I/O is slow but how slow is SQL in comparison.. is it worth creating an entire query and session for that or use the filesystem. I would like your advice on which is better to use. Regards, - James
  4. Looks okay at a glance, probably want to exit that loop once you found the right row, though
  5. I wouldn't store your stuff like that. I store Song Lyrics in my database like this: A-ha A-ha A-ha But when I display them, they come up like: A-haA-haA-ha To fix it: $content = str_replace("\n","<br />",$ahas); echo $content; Replaces all instances of the newlines with displayed BR's.
  6. Wow, didn't expect this much discussion. I'm going to continue using (strlen($name) == 0) I seem to beleive that working with a string uses more memory than a number, and that PHP has to free up a chunk to hold what could be 200 different ASCII characters, when actually, the string is empty. I bet I am wrong, but I don't know. It's good to see the difference is only minimal though
  7. Which is more efficient: if (strlen($name) == 0) { echo "No name"; } if ($name == "") { echo "No name"; }
  8. Hi, I don't use a free host. I was wondering if it worked for anyone else, that way I could identify whether it is the code or my host that is messing up. BTW, it should return a 0 if the domain is unavailable and a 1 if it available when you go to test.php?domain=test&tld=com Kind Regards James
  9. Hello Folks, I have adapted 'Mr Whois' to build an API to check if a domain is available for registration. This is the code I have so far: <?php define('COM_SERVER', "rs.internic.net"); define('COM_NOMATCH', "No match"); define('NET_SERVER', "rs.internic.net"); define('NET_NOMATCH', "No match"); define('ORG_SERVER', 'whois.publicinterestregistry.net'); define('ORG_NOMATCH', 'NOT FOUND'); $domain = $_GET['domain']; $tld = $_GET['tld']; function dispun() { echo "0"; } function dispav() { echo "1"; } if(ereg("^-|-$",$domain)) { echo "bad domain - hypen"; exit; } if(!ereg("([a-z]|[A-Z]|[0-9]|-){".strlen($domain)."}",$domain)) { echo "bad domain"; exit; } $domname = $domain . "." . $tld; if ($tld == "com") { $ns = fsockopen(COM_SERVER,43); fputs($ns,"$domname\r\n"); $result = ''; while(!feof($ns)) $result .= fgets($ns,128); fclose($ns); if (eregi(COM_NOMATCH,$result)) { dispav();} else {dispun(); } } elseif ($tld == "net") { $ns = fsockopen(NET_SERVER,43); fputs($ns,"$domname\r\n"); $result = ''; while(!feof($ns)) $result .= fgets($ns,128); fclose($ns); if (eregi(NET_NOMATCH,$result)) { dispav(); } else { dispun(); } } elseif ($tld == "org") { $ns = fsockopen(ORG_SERVER,43); fputs($ns,"$domname\r\n"); $result = ''; while(!feof($ns)) $result .= fgets($ns,128); fclose($ns); if (eregi(ORG_NOMATCH,$result)) { dispav(); } else { dispun(); } } ?> You just go to: test.php?domain=google&tld=com Now. My problem: It seems the code can't connect to the NIC servers. I have looked through time and time again and cannot see why it is not working. I am really stuck! It would be helpful to know if it worked on another PHP installation incase my host doesn't have sockets working properly. I am so thankful in advance. - James
×
×
  • 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.