I wish I knew how to put the nice white box around it like you guys do.
PHP Code:
<?php
function nextid($tablename, $idname) {
global $db;
$nextid = 1;
$sql = "SELECT $idname FROM $tablename order by $idname desc";
$result = mysql_query($sql ,$db);
if ($myrow = mysql_fetch_array($result)) {
$nextid = $myrow[$idname];
}
$nextid = ($nextid + 1);
return $nextid;
}
function dbdate() {
$dbdate = date("Y-m-d");
return $dbdate;
}
function ad($groupid) {
global $db;
$sql = "select adid from ads where groupid = $groupid";
$result = mysql_query($sql ,$db);
$numrows = mysql_num_rows($result);
$adcount = 1;
if ($numrows > 0) {
if ($myrow = mysql_fetch_array($result)) {
do {
$adids[$adcount] = $myrow["adid"];
$adcount++;
} while ($myrow = mysql_fetch_array($result));
}
$adid = $adids[rand(1, $adcount-1)];
$adhtml = "$adid";
$sql = "select * from ads where adid = $adid";
$result = mysql_query($sql ,$db);
if ($myrow = mysql_fetch_array($result)) {
do {
if ($myrow["type"] == 'A') {
$adhtml = $myrow["code"];
}
if ($myrow["type"] == 'O') {
$url = $myrow["url"];
$imagetype = $myrow["image"];
$adhtml = "<a href=""bannerclick.php?adid=$adid><img src=""ads/$adid.$imagetype border=0></a>\n";
}
$imps = $myrow["impressions"] + 1;
} while ($myrow = mysql_fetch_array($result));
}
$sql = "update ads set impressions = $imps where adid = $adid";
$result = mysql_query($sql ,$db);
} else {
$adhtml = " ";
}
return $adhtml;
}
function logincheck($uid, $upwd) {
global $db;
if (($uid == "") || ($upwd == "")) {
$accountok = false;
} else {
$sql = "select * from users where userid = $uid and password = '$upwd'";
$result = mysql_query($sql ,$db);
$numrows = mysql_num_rows($result);
if ($numrows > 0) {
$accountok = true;
} else {
$accountok = false;
}
}
return $accountok;
}
?>
Bookmarks