Jump to content

Recommended Posts

i need code for open link in new window

links.php
[code]<?php
// (c) 2006 Philip Heins
// This script is released under terms and conditions of the GNU GPL.
include("linkadmin/cstring.php");
if(isset($_GET["goto"])) {
    $gotowebsite=(int)$_GET["goto"];
    mysql_connect($db_Host, $db_Username, $db_Pass) || die("Error: Cannot Connect to database: ".mysql_error());
    mysql_select_db($db_Database);
    $query = "SELECT * FROM $linktable WHERE id = '$gotowebsite' LIMIT 0,1";
    $result = mysql_query($query);
    $goodsite = mysql_num_rows($result);
    if($goodsite == "1") {
        $row = mysql_fetch_array($result);
        if(isset($_COOKIE[$gotowebsite])) {
            echo "<!--Click cookie still exists.-->\n\n";
        }
        else {
            setcookie($row["id"], "clicknocounts", time()+1200);
            $newhits = $row[clicks]+1;
            mysql_query("UPDATE $linktable SET clicks = '$newhits' WHERE id = '$row[id]'") || die(mysql_error);    
        }

?>
<script language="Javascript">
var URL   = "<?=$row[url]?>"
var speed = 1
function reload() {
location = URL
}
setTimeout("reload()", speed);
//-->
</script>
<?php
    }
    else {
        $errormessage = "<p>There was an error finding your website. Please try clicking the link again.<br><br></p>";
    }
}
        
?>
<html>
<head>
<title>WEB LINKS</title>
<style type="text/css">
<!--

.sortby {
    color : #CCCCCC;
    font-family : Tahoma;
    font-size : 10pt;
    text-decoration : none;
    font-weight : none;
}

A:link.sortby { COLOR: #FFFFFF; TEXT-DECORATION: none; font-weight: normal; }
A:link{ background: transparent; text-decoration: none; color: #000000;}

A:visited.sortby { background: transparent; text-decoration: none; color: #FFFFFF;}
A:visited{ background: transparent; text-decoration: none; color: #000000;}

A:active.sortby { background: transparent; text-decoration: underline; color: #FFFFFF; underline-color: #CCCCCC;}
A:active{ background: transparent; text-decoration: none; color: #000000;}

A:hover.sortby { font-family : Tahoma; background: transparent; text-decoration: underline; color: #FFFFFF; }
A:hover{ background: transparent; text-decoration: underline; color: #1A3355; }
-->
</style>
</head>
<body>
<?php
mysql_connect($db_Host, $db_Username, $db_Pass) || die("Error: Cannot Connect to database: ".mysql_error());
mysql_select_db($db_Database);

if(!($_GET["fob"])) $_GET["fob"] = "date";
if(!($_GET["fod"])) $_GET["fod"] = "DESC";

if(!($_GET["uob"])) $_GET["uob"] = "date";
if(!($_GET["uod"])) $_GET["uod"] = "DESC";


// SECURE THAT SHIT UP THERE ^ ^ ^ ^ ^ ^ ^ ^ ^
// make it so it doesn't use actual values
$fodunsecure = $_GET["fod"];
$fobunsecure = $_GET["fob"];

$uodunsecure = $_GET["uod"];
$uobunsecure = $_GET["uob"];


switch ($fobunsecure) {
    case "website":
        $fob = "name";
        break;
    case "desc":
        $fob = "descr";
        break;
    case "date":
        $fob = "datesubmit";
        break;
    case "hits":
        $fob = "clicks";
        break;
    default:
        $fob = "datesubmit";
        $fobunsecure = "date";
}
switch ($fodunsecure) {
    case "DESC":
        $fod = "DESC";
        break;
    case "ASC":
        $fod = "ASC";
        break;
    default:
        $fod = "DESC";
}

switch ($uobunsecure) {
    case "website":
        $uob = "name";
        break;
    case "desc":
        $uob = "descr";
        break;
    case "date":
        $uob = "datesubmit";
        break;
    case "hits":
        $uob = "clicks";
        break;
    default:
        $uob = "datesubmit";
        $uobunsecure = "date";
}
switch ($uodunsecure) {
    case "DESC":
        $uod = "DESC";
        break;
    case "ASC":
        $uod = "ASC";
        break;
    default:
        $uod = "DESC";
        $uodunsecure = "DESC";
}
?>
<center>
<p><table border="0" cellspacing="2" cellpadding="3">
  <tr>
    <td colspan="4">
      <table border="2" cellspacing="0" cellpadding="2" width="100%" height="100%" bordercolor="#22419C" bordercolorlight="#22419C" bordercolordark="#22419C" bgcolor="#545864">
          <tr>
              <td align="left" valign="center" bordercolor="#545864" width="50%"><font face="Tahoma, Arial, Verdana" size="5"><font color="#517DFF">WEB</font><font color="#FFFFFF">.</font><font color="#9AB3FF">LINKS</font></font></td>
              <td align="center" valign="center" bordercolor="#545864"><INPUT type="button" value="Add Your Website" onClick="window.open('addlink.php', 'AddYourLink', 'width=335, height=152, status=no, resizeable=no, menubar=no, toolbar=no, directories=no, location=no, scrollbars=no')" style="border: 2px double #98njg3;border-color: #22419C;background-color: #797E8F;color: #FFFFFF;font-size: 10pt;font-weight: bold;font-family: Tahoma, Verdana, Arial, sans-serif;"></td>
        </tr>
        </table>
              
    </td>
  </tr>
  <tr>
    <td colspan="4">
<center><font face="Arial" size=2 color="red"><br>
        <?php
        if(isset($errormessage)) {
            echo $errormessage;
        }
        ?>
    </font>
</FORM>

        </center>
    </td>
  </tr>
  <tr>
    <td colspan="4" bgcolor="#C4D3FF">
      <font face="Tahoma" size=3><b> Featured Links</b></font>
    </td>
  </tr>
  <tr bgcolor="#2A4596">
    <td width="117" align="left" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Website</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=website&fod=ASC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="A-Z"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=website&fod=DESC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="Z-A"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
    <td width="227" align="left" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Description</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=desc&fod=ASC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="A-Z"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=desc&fod=DESC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="Z-A"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
    <td width="80" align="center" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Added</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=date&fod=ASC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="Oldest to Newest"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=date&fod=DESC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="Newest to Oldest"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
    <td width="54" align="center" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Hits</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=hits&fod=ASC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="Least to most"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=hits&fod=DESC&uob=<?=$uobunsecure?>&uod=<?=$uodunsecure?>" title="Most to Least"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
  </tr>
<?php
$query = "SELECT * FROM $linktable WHERE featured = '1' ORDER BY `$fob` $fod";
$result = mysql_query($query);

// in the form TITLE - Description
while ($row = mysql_fetch_array($result))
{
    $url = stripslashes($row["url"]);
    $name = htmlspecialchars(stripslashes($row["name"]));
    $descr = htmlspecialchars(stripslashes($row["descr"]));
    $date = gmdate("M d, Y", $row["datesubmit"]);
?>
  <tr>
    <td><font face="Tahoma" size="2"><B><A href="<?=$_SERVER["PHP_SELF"]?>?goto=<?=$row[id]?>" title="<?=$url?>"><?=$name?></a></b></font></td>
    <td><font face="Tahoma" size="2"><?=$descr?></font></td>
    <td align="center"><font face="Tahoma" size="2"><?=$date?></font></td>
    <td><font face="Tahoma" size="2">    <?=$row[clicks]?></font></td>
  </tr>
<?php
}
?>
<tr><td><img src="linkadmin/images/spacer.gif" width="1" height="5"></td></tr>
<tr>
    <td colspan="4" align="right" valign="top" bgcolor="#545864"><font face="Tahoma" size="2" color="#FFFFFF"><b>Total Websites:</b>
<?php
// get and print number of rows in resultset
echo mysql_num_rows($result);
?>
     </font>
    </td>
    </tr>
    <tr><td> </td></tr>
  <tr>
    <td colspan="4" bgcolor="#C4D3FF">
      <font face="Tahoma" size=3><b> Fan Links</b></font>
    </td>
  </tr>
  <tr bgcolor="#2A4596">
    <td width="117" align="left" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Website</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=website&uod=ASC" title="A-Z"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=website&uod=DESC" title="Z-A"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
    <td width="227" align="left" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Description</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=desc&uod=ASC" title="A-Z"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=desc&uod=DESC" title="Z-A"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
    <td width="80" align="center" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Added</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=date&uod=ASC" title="Oldest to Newest"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=date&uod=DESC" title="Newest to Oldest"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
    <td width="54" align="center" valign="top" height="11"><font face="Tahoma" size="2" color="#FFFFFF"><b>Hits</b> <a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=hits&uod=ASC" title="Least to Most"><img src="linkadmin/images/desc.gif" border=0></a><a class="sortby" href="<?$_SERVER["PHP_SELF"]?>?fob=<?=$fobunsecure?>&fod=<?=$fodunsecure?>&uob=hits&uod=DESC" title="Most to Least"><img src="linkadmin/images/asc.gif" border=0></a></font></td>
  </tr>
<?php
$query = "SELECT * FROM $linktable WHERE featured = '0' AND authorized = '1' ORDER BY `$uob` $uod";
$result = mysql_query($query);

// in the form TITLE - Description
while ($row = mysql_fetch_array($result))
{
    $url = stripslashes($row["url"]);
    $name = htmlspecialchars(stripslashes($row["name"]));
    $descr = htmlspecialchars(stripslashes($row["descr"]));
    $date = gmdate("M d, Y", $row["datesubmit"]);
?>
  <tr>
    <td><font face="Tahoma" size="2"><B><A href="<?=$_SERVER["PHP_SELF"]?>?goto=<?=$row[id]?>" title="<?=$url?>"><?=$name?></a></b></font></td>
    <td><font face="Tahoma" size="2"><?=$descr?></font></td>
    <td align="center"><font face="Tahoma" size="2"><?=$date?></font></td>
    <td><font face="Tahoma" size="2">    <?=$row[clicks]?></font></td>
  </tr>
<?php
}
?>
<tr><td><img src="linkadmin/images/spacer.gif" width="1" height="5"></td></tr>
<tr>
    <td colspan="4" align="right" valign="top" bgcolor="#545864"><font face="Tahoma" size="2" color="#FFFFFF"><b>Total Websites:</b>
<?php
// get and print number of rows in resultset
echo mysql_num_rows($result);
?>
     </font></td></tr>
</table></p>
</p>
<p align="center"><font face="Tahoma, Arial" size=2><a href="http://www.google.com">WEB LINKS</a> Version: <?=$version?> - © 2006</font></p>
</body></html>[/code]
Link to comment
https://forums.phpfreaks.com/topic/10799-new-window-code-for-php-link/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.