Xhtml Toplist

Started on the old forum in March 2007 · view the original in the archive · old links redirect here

6 replies · 828 views · started 19 years ago · 1 min read

wizard Senior · 493 posts #1

hi everyone, im writing a xhtml toplist script, i need help with two little things, the search function and edit site function. i want to know whats wrong with these two queries

$sites = mysql_query("SELECT id, sitename FROM wiz_sites WHERE cid='".$cid."' AND description LIKE '".$word."' OR keywords LIKE '".$word."' ORDER BY id, sitename");

for the search function and for the edit site

$sitename = $_POST["sitename"];
$sitelink = $_POST["sitelink"];
$sitelogo = $_POST["sitelogo"];
$keywords = $_POST["keywords"];
$description = $_POST["description"];
$cid = $_POST["cid"];

if($sitename=="")
{
    echo "Site Name Cannot be left Blank";
}else if($sitelink=="")
{
    echo "Site Link Cannot be left Blank";
}else if($description=="")
{
    echo "description Cannot be left Blank";
}else if($keywords=="")
{
    echo "Keywords Cannot be left Blank";
}
else{
      $res = mysql_query("UPDATE wiz_sites SET sitename='".$sitename."', $sitelink='".$sitelink."', logourl='".$sitelogo."', cid='".$cid."', description='".$description."', keywords='".$keywords."' WHERE id='".$site."'");
  
        if($res)
      {

        echo "Site updated successfully
";
echo "Add this link on your site where users can see
";
echo "http://$siturl/in.php?site=$site 
";
      }else{
        echo "Error Adding Site, Please Contact Owner";
      }

}
[code] i get the error field [code]Error Adding Site, Please Contact Owner

thank you... you can view my work@ http://top.wizardwap.net

Attachments: links_32.png
wizard Senior · 493 posts #3

sql

CREATE TABLE `wiz_sites` (
  `id` int(99) NOT NULL auto_increment,
  `cid` int(99) NOT NULL,
  `sitename` varchar(100) NOT NULL,
  `sitelink` varchar(200) NOT NULL,
  `logourl` varchar(200) NOT NULL,
  `hin` int(99) NOT NULL,
  `hout` int(99) NOT NULL,
  `owner` int(99) NOT NULL,
  `description` varchar(250) NOT NULL,
  `keywords` varchar(150) NOT NULL,
  PRIMARY KEY  (`id`),
  FULLTEXT KEY `sitelink` (`sitelink`)
) ENGINE=MyISAM;

editsite.php

<?php

header("Content-type: text/html; charset=ISO-8859-1");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<?php

$sid = $_GET["sid"];
$site = $_GET["site"];

include("core.php");
include("config.php");

$bcon = connectdb();
if (!$bcon)
{
    echo dberror();
}
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{

      echo "You are not logged in
";

      echo "<a href=\"index.php\">Login</a>";
     echo "</body></html>";
      exit();
}
echo "<head>";
echo "<title>$stitle</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />";
echo "<meta name=\"description\" content=\"description\" />";
echo "<meta name=\"keywords\" content=\"keywords\" />";
echo "</head>";
echo "<body>";

$owner = mysql_query("SELECT owner from wiz_sites WHERE id='".$site."'");
$isowner=mysql_fetch_array($owner);
if(!$isowner[0]=="$uid") {
echo "this site is not yours";
}else{

$sitename = $_POST["sitename"];
$sitelink = $_POST["sitelink"];
$sitelogo = $_POST["sitelogo"];
$keywords = $_POST["keywords"];
$description = $_POST["description"];
$cid = $_POST["cid"];

if($sitename=="")
{
    echo "Site Name Cannot be left Blank";
}else if($sitelink=="")
{
    echo "Site Link Cannot be left Blank";
}else if($description=="")
{
    echo "description Cannot be left Blank";
}else if($keywords=="")
{
    echo "Keywords Cannot be left Blank";
}
else{
      $res = mysql_query("UPDATE wiz_sites SET sitename='".$sitename."', $sitelink='".$sitelink."', logourl='".$sitelogo."', cid='".$cid."', description='".$description."', keywords='".$keywords."' WHERE id='".$site."'");
  
        if($res)
      {

        echo "Site updated successfully
";
echo "Add this link on your site where users can see
";
echo "http://$siturl/in.php?site=$site 
";
      }else{
        echo "Error Adding Site, Please Contact Owner";
      }

}
}

echo "<div class=\"hd1\"><img src=\"images/menu1.png\" alt=\"\"/><a class=\"sub\" href=\"menu.php?sid=$sid\">control Panel</a></div>";
echo "<div class=\"hd1\"><img src=\"images/home.png\" alt=\"\"/><a class=\"sub\" href=\"index.php?sid=$sid\">$siturl</a></div>";
echo "</body>";

?>

</html>

eds.php

<?php

header("Content-type: text/html; charset=ISO-8859-1");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<?php

$sid = $_GET["sid"];

$site = $_POST["site"];

include("core.php");
include("config.php");

$bcon = connectdb();
if (!$bcon)
{
    echo dberror();
}
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{

      echo "You are not logged in
";

      echo "<a href=\"index.php\">Login</a>";
     echo "</body></html>";
      exit();
}

echo "<head>";
echo "<title>$stitle</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />";
echo "<meta name=\"description\" content=\"description\" />";
echo "<meta name=\"keywords\" content=\"keywords\" />";
echo "</head>";
echo "<body>";

$wizard = mysql_fetch_array(mysql_query("SELECT COUNT(distinct id) FROM wiz_sites WHERE owner='".$uid."' ORDER BY id DESC"));
if($wizard[0]>0) {
$wizz = mysql_fetch_array(mysql_query("SELECT sitelink, sitename, logourl, cid, description, keywords FROM wiz_sites WHERE id='".$site."'"));   

echo "<form action=\"edsite.php?sid=$sid&site=$site\" method=\"post\">";
echo "sitename:
";
echo "<input name=\"sitename\" maxlength=\"25\" emptyok=\"false\" type=\"text\" value=\"$wizz[1]\"/>
";
echo "sitelink:
";
echo "<input name=\"sitelink\" maxlength=\"25\" emptyok=\"false\" type=\"text\" value=\"$wizz[0]\"/>
";
echo "logo (optional):
";
echo "<input name=\"sitelogo\" maxlength=\"100\" emptyok=\"true\" type=\"text\" value=\"$wizz[2]\"/>
";

echo "description:
";
echo "<input name=\"description\" maxlength=\"150\" emptyok=\"true\" type=\"text\" value=\"$wizz[4]\"/>
";

echo "keywords (separate by ,):
";
echo "<input name=\"keywords\" maxlength=\"100\" emptyok=\"true\" type=\"text\" value=\"$wizz[5]\"/>
";

echo "Category:  <select name=\"cid\" value=\"$wizz[3]\">";
    $wiz_cats = mysql_query("SELECT id, name FROM wiz_cats ORDER BY name;");
  while ($wiz_cat = mysql_fetch_array($wiz_cats))
  {
    echo "<option value=\"$wiz_cat[0]\">$wiz_cat[1]</option>";
    }
    
    echo "</select>
";

echo "<input type=\"submit\" value=\"Edit\"/>";
echo "</form>";

}else{
echo "You currently have no sites in our toplist system";
}

echo "<div class=\"hd1\"><img src=\"images/menu1.png\" alt=\"\"/><a class=\"sub\" href=\"menu.php?sid=$sid\">control Panel</a></div>";
echo "<div class=\"hd1\"><img src=\"images/home.png\" alt=\"\"/><a class=\"sub\" href=\"index.php?sid=$sid\">$siturl</a></div>";
echo "</body>";

?>

</html>
abhisar #4

sql

CREATE TABLE `wiz_sites` (
  `id` int(99) NOT NULL auto_increment,
  `cid` int(99) NOT NULL,
  `sitename` varchar(100) NOT NULL,
  `sitelink` varchar(200) NOT NULL,
  `logourl` varchar(200) NOT NULL,
  `hin` int(99) NOT NULL,
  `hout` int(99) NOT NULL,
  `owner` int(99) NOT NULL,
  `description` varchar(250) NOT NULL,
  `keywords` varchar(150) NOT NULL,
  PRIMARY KEY  (`id`),
  FULLTEXT KEY `sitelink` (`sitelink`)
) ENGINE=MyISAM;

editsite.php

<?php

header("Content-type: text/html; charset=ISO-8859-1");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<?php

$sid = $_GET["sid"];
$site = $_GET["site"];

include("core.php");
include("config.php");
$bcon = connectdb();
if (!$bcon)
{
    echo dberror();
}
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
      echo "You are not logged in
";

      echo "<a href=\"index.php\">Login</a>";
     echo "</body></html>";
      exit();
}
echo "<head>";
echo "<title>$stitle</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />";
echo "<meta name=\"description\" content=\"description\" />";
echo "<meta name=\"keywords\" content=\"keywords\" />";
echo "</head>";
echo "<body>";

$owner = mysql_query("SELECT owner from wiz_sites WHERE id='".$site."'");
$isowner=mysql_fetch_array($owner);
if(!$isowner[0]=="$uid") {
echo "this site is not yours";
}else{

$sitename = $_POST["sitename"];
$sitelink = $_POST["sitelink"];
$sitelogo = $_POST["sitelogo"];
$keywords = $_POST["keywords"];
$description = $_POST["description"];
$cid = $_POST["cid"];

if($sitename=="")
{
    echo "Site Name Cannot be left Blank";
}else if($sitelink=="")
{
    echo "Site Link Cannot be left Blank";
}else if($description=="")
{
    echo "description Cannot be left Blank";
}else if($keywords=="")
{
    echo "Keywords Cannot be left Blank";
}
else{
      $res = mysql_query("UPDATE wiz_sites SET sitename='".$sitename."', $sitelink='".$sitelink."', logourl='".$sitelogo."', cid='".$cid."', description='".$description."', keywords='".$keywords."' WHERE id='".$site."'");
  
        if($res)
      {

        echo "Site updated successfully
";
echo "Add this link on your site where users can see
";
echo "http://$siturl/in.php?site=$site 
";
      }else{
        echo "Error Adding Site, Please Contact Owner";
      }

}
}

echo "<div class=\"hd1\"><img src=\"images/menu1.png\" alt=\"\"/><a class=\"sub\" href=\"menu.php?sid=$sid\">control Panel</a></div>";
echo "<div class=\"hd1\"><img src=\"images/home.png\" alt=\"\"/><a class=\"sub\" href=\"index.php?sid=$sid\">$siturl</a></div>";
echo "</body>";
?>

</html>

eds.php

<?php

header("Content-type: text/html; charset=ISO-8859-1");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<?php

$sid = $_GET["sid"];

$site = $_POST["site"];

include("core.php");
include("config.php");
$bcon = connectdb();
if (!$bcon)
{
    echo dberror();
}
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
      echo "You are not logged in
";

      echo "<a href=\"index.php\">Login</a>";
     echo "</body></html>";
      exit();
}

echo "<head>";
echo "<title>$stitle</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style.css\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"must-revalidate\" />";
echo "<meta http-equiv=\"Cache-Control\" content=\"no-cache\" />";
echo "<meta name=\"description\" content=\"description\" />";
echo "<meta name=\"keywords\" content=\"keywords\" />";
echo "</head>";
echo "<body>";

$wizard = mysql_fetch_array(mysql_query("SELECT COUNT(distinct id) FROM wiz_sites WHERE owner='".$uid."' ORDER BY id DESC"));
if($wizard[0]>0) {
$wizz = mysql_fetch_array(mysql_query("SELECT sitelink, sitename, logourl, cid, description, keywords FROM wiz_sites WHERE id='".$site."'"));   

echo "<form action=\"edsite.php?sid=$sid&site=$site\" method=\"post\">";
echo "sitename:
";
echo "<input name=\"sitename\" maxlength=\"25\" emptyok=\"false\" type=\"text\" value=\"$wizz[1]\"/>
";
echo "sitelink:
";
echo "<input name=\"sitelink\" maxlength=\"25\" emptyok=\"false\" type=\"text\" value=\"$wizz[0]\"/>
";
echo "logo (optional):
";
echo "<input name=\"sitelogo\" maxlength=\"100\" emptyok=\"true\" type=\"text\" value=\"$wizz[2]\"/>
";

echo "description:
";
echo "<input name=\"description\" maxlength=\"150\" emptyok=\"true\" type=\"text\" value=\"$wizz[4]\"/>
";

echo "keywords (separate by ,):
";
echo "<input name=\"keywords\" maxlength=\"100\" emptyok=\"true\" type=\"text\" value=\"$wizz[5]\"/>
";

echo "Category:  <select name=\"cid\" value=\"$wizz[3]\">";
    $wiz_cats = mysql_query("SELECT id, name FROM wiz_cats ORDER BY name;");
  while ($wiz_cat = mysql_fetch_array($wiz_cats))
  {
    echo "<option value=\"$wiz_cat[0]\">$wiz_cat[1]</option>";
    }
    
    echo "</select>
";
echo "<input type=\"submit\" value=\"Edit\"/>";
echo "</form>";

}else{
echo "You currently have no sites in our toplist system";
}
echo "<div class=\"hd1\"><img src=\"images/menu1.png\" alt=\"\"/><a class=\"sub\" href=\"menu.php?sid=$sid\">control Panel</a></div>";
echo "<div class=\"hd1\"><img src=\"images/home.png\" alt=\"\"/><a class=\"sub\" href=\"index.php?sid=$sid\">$siturl</a></div>";
echo "</body>";
?>

</html>

Your mysql query is wrong,it sud be $res = mysql_query("UPDATE wiz_sites SET sitename='".$sitename."', sitelink='".$sitelink."', logourl='".$sitelogo."', cid='".$cid."', description='".$description."', keywords='".$keywords."' WHERE id='".$site."'");

Guest #6

Nyc one there really nice emaybe i'll try it!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close