code for available domains/recent signups

It's not difficult to install myLounge Redirection, but sometimes it's quite tricky. Post your questions in here.

Moderator: Scooby

code for available domains/recent signups

Postby www.hm/yourname.com » Wed Mar 17, 2004 1:57 am

Hey all,
wrote some new code (i use version 1.2 subdir edition so will no doubt need some major overhaul!)

the code creates this kind of output:


random list of possible domains are given, each link to relevant signup. latest registered domains follow.

to use the code:

add this to functions.php
Code: Select all
function getsamples() //gives sample and recently registered domains (www.hm)
{
include("include/vars.php");
$avail = "<b>You can have...</b><br>";
$listwords=mysql_query("SELECT * FROM $aword_table ORDER BY RAND() LIMIT 0,5");
$words=mysql_num_rows($listwords);

if ($words < 1) {
   $avail.="An error has occurred<br>";
} else {
   while($rowwords=mysql_fetch_array($listwords)) {
   
      $theword=$rowwords[theword];
      $avail.="<a href='signup.php?do=do_signup&dom=$theword'>www.hm/$theword</a> <br>";

   }
}
$avail.="(these domains are free to register)<br><br>";
$avail.="<b>...but you're too late for</b><br>";

$listusers=mysql_query("SELECT * FROM $redir_table ORDER BY time DESC LIMIT 0,5");
$users=mysql_num_rows($listusers);

if ($users < 1) {
   $avail.="An error has occurred<br>";
} else {
   while($rowusers=mysql_fetch_array($listusers)) {
      
      $host=$rowusers[host];
      $avail.="<a href='http://$host'>$host</a> <br>";

   }
}
$avail.="(these domains have just been taken)";
return $avail;
}


and create new table using this http://www.hm/wordlist.txt set of random words, already in SQL (hosted on my site as its pretty big!)

this line needs to be added to each user accessible php file (under the include and require section) eg members.php
Code: Select all
$available = getsamples();


and this to where each php file calls the template
Code: Select all
$template->assign("available", $available);


finally, add {available} to the template where you want it to appear.

Now i haven't even used 1.4 - maybe this kind of script is already in there?! either way, its in a scruffy infancy and have just knocked it together without testing. For example the random list of available domains isn't even checked against existing user accounts. I just thought id put the code out, see what you thought. (suggestions/improvements more than welcome!!)
www.hm/yourname.com
 

Postby g0d.nl » Thu Mar 18, 2004 9:51 pm

Nice Code ! :) yay

But i don't feel like doing it on my site... i want to keep it clean :D
g0d.nl
 

Postby Guest » Tue Mar 30, 2004 4:54 am

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in include/functions.php on line 10

may i know how to solve this?

thank you
Guest
 

Postby naredi » Sat Apr 03, 2004 1:02 am

I had to do som changes but now its working for me :)

/Jakob Naredi - WannaSurf.to
naredi
Newbie
Newbie
 
Posts: 6
Joined: Sat Jan 11, 2003 11:27 pm
Location: Sweden


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron