Kostenloses Webkatalog Script - Link Script

 
  Download Webkatalog Script   Demo Webkatalog   Demo Adminbereich   PHP & Mysql   Impressum  
 
Home » Forum
Benutzername:

Passwort:




Einbindungsbeispiel Surftipps & Linkpartner
Webkatalog und Partner Seiten

<?
/* Beispiel zum Einbinden */
define('CG_LINK', true);
@include (
'url-anmelden-link-eintragen
/cg_config.php'
);
/*
Varibale $linkswebkat in *.php einbinden
<? echo $linkswebkat; ?>
Erzeugte Ausgabe:
Surftipps & Linkpartner
Webkatalog und Partner Seiten
*/
?>

#1 2007-01-19 18:03:03

siteadmin
Administrator
Registriert: 2007-01-12
Beiträge: 26

Function Backlink Check, Link Check

Wie kann ich die Links zu meiner Seite überprüfen?

Derzeit besitzt das Webkatalog Skript noch keinen Funktionsblock zum überprüfen der Backlinks. Jedoch wird beim Ausfüllen der Anmeldung neuer Seiten im Webkatalog ein kleiner Header Test durchgeführt. 

Ein Backlinktest sollte beim Linktausch- Partner eigentlich nicht notwendig sein. Die Realität unter den Webmastern sieht leider anders aus. sad

Die erste Beta Version zum Backlink Check ist fertig!

Code:

  1. /*==================================================*\
  2. Linkparser
  3. - findet alle Links im Quelltext
  4. - findet Backlink
  5. - findet meta Angaben NOINDEX|NOFOLLOW|NONE
  6. - findet nofollow Angabe
  7. - findet versteckte Links in:
  8. * Html Tags
  9. * Javascript Events
  10. * Kommentare
  11. \*======================================================*/

Code: php

  1. $link_partner_url       = 'testseite.php';          //  http://www.domain.de      Partnerseite die geprüft werden soll
  2. $my_link_url        = 'http://www.phplist.de/'// hier Dein Link
  3. $my_link_text      = 'Webkatalog Script';     // hier Dein Link
  4.  
  5. $quelltext            = file_get_contents($link_partner_url);       // Partner Url besuchen und Inhalt in $quelltext speichern
  6.  
  7. $quelltext            = trim(@preg_replace("/ +/", " ",@preg_replace("/\s\s+|\t\t+|\n\r+|\n\n+|\r\r+/", " ",$quelltext)));
  8. $my_link_url        = preg_replace("|/$|","",$my_link_url);
  9.  
  10.  
  11. if (preg_match_all("!<a [^>]*>(.*)<\s*/\s*a\s*>!Ui", $quelltext, $links_array)) //alle Links erfassen
  12. {
  13.         /*      Robots Tag auswerten    */
  14.         if(preg_match_all("!<meta[^>]+name[ \r\n\t]*=[ \r\n\t]*([\"\']?)robots\\1[^>]*content[ \r\n\t]*=[ \r\n\t]*[\"\']([^>\"\']*)[\"\'][^>]*>!is",$quelltext,$match_meta))
  15.         {
  16.                 $noindex_nofollo_array = preg_grep("/(NOINDEX|NOFOLLOW|NONE)/Ui", $match_meta[2]);
  17.         }
  18.  
  19.         /*      Links mit nofollow erkennen   */
  20.         $check_nofollow = preg_grep("/rel\s*=\s*([\"\'])?(?(1)nofollow?\\1|([^\"'\s\>]+))/Ui", $links_array[0]);
  21.  
  22.         /*      Backlink finden                     */
  23.         $check_my_links = preg_grep("@href\s*=\s*([\"\'])?(".preg_quote($my_link_url)."\s*\\1)@Ui", $links_array[0]);
  24.  
  25.         if(is_array($check_my_links))
  26.         {
  27.                 /*      mein(e) Link(s) gefunden      */
  28.  
  29.                 /*      doppelte Links entfernen      */
  30.                 $check_my_links  = array_unique($check_my_links);
  31.  
  32.                 /*      javascript events definieren  */
  33.                 $link_filter_javascript_events  = 'javascript:|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup';
  34.  
  35.                 /*      Html Tags definieren    */
  36.                 $link_filter_html_tags    = 'noindex|textarea|script|style';
  37.  
  38.                 $i=0;
  39.                 foreach ($check_my_links as $my_link_key => $my_link_html)
  40.                 {
  41.                         $my_link_status = "ok";
  42.  
  43.                         /*      finde versteckte Links im Html                */
  44.                         if(preg_match_all("@<\s*(".$link_filter_html_tags.").*?>.*(".$my_link_html.").*<\s*/\s*\\1\s*>@msi",$quelltext,$match_html_tags))
  45.                         {
  46.                                 $fehler_ausgabe['html_tag_bezeichnung'][$i]     = $match_html_tags[1];
  47.                                 $fehler_ausgabe['html_tags_quelltext'][$i]      = $match_html_tags[0];
  48.                                 unset($match_html_tags);
  49.                                 $my_link_status = "error";
  50.                         }
  51.                         /*      finde versteckte Links Kommentare     */
  52.                         if(preg_match_all( "@<!--\s*.*\s*[^-->]*-->@siU",$quelltext,$match_coment))
  53.                         {
  54.                                 $helpcoment = preg_grep("@(".$my_link_html.")@Ui", $match_coment[0]);
  55.                                 if(count($helpcoment))
  56.                                 {
  57.                                         $fehler_ausgabe['kommentar'][$i]        = $helpcoment;
  58.                                         $my_link_status = "error";
  59.                                 }
  60.                                 unset($match_coment,$helpcoment);
  61.                         }
  62.                         /*      finde Links mit Javascript        */
  63.                         if(preg_match_all("/(".$link_filter_javascript_events.")\s*=\s*[\"|'](.*)[\"|']/siU", $my_link_html, $match_javascript_events))
  64.                         {
  65.                                  $fehler_ausgabe['javascript_tag_bezeichnung'][$i]      = $match_javascript_events[1];
  66.                                 $fehler_ausgabe['javascript_tags_quelltext'][$i]        = $match_javascript_events[2];
  67.                                 unset($match_javascript_events);
  68.                                 $my_link_status = "error";
  69.                         }
  70.                         /*      nofollow im Link vorhanden        */
  71.                         if(preg_match("/rel\s*=\s*([\"\'])?(?(1)nofollow?\\1|([^\"'\s\>]+))/Ui", $my_link_html, $match_nofollow))
  72.                         {
  73.                                 $fehler_ausgabe['nofollow_tag'][$i] = $match_nofollow[0];
  74.                                 unset($match_nofollow);
  75.                                 $my_link_status = "error";
  76.                         }
  77.                         $link_ausgabe['html_my_link'][$i]       = trim(htmlspecialchars($my_link_html));
  78.                         $link_ausgabe['html_my_posi'][$i]       = $my_link_key;
  79.                         $link_ausgabe['status_my_link'][$i]     = $my_link_status;
  80.                         $i++;
  81.                 }
  82.         }
  83. }
  84. echo "<pre><u>Fehlerausgabe:</u>";
  85. print_r($fehler_ausgabe);
  86. echo "</pre>";
  87. echo "<pre><u>Linkstatus:</u>";
  88. print_r($link_ausgabe);
  89. echo "</pre>";

Attachments:
Attachment Icon stepp3.php, Größe: 5,149 bytes, Downloads: 98
Attachment Icon testseite.php, Größe: 2,936 bytes, Downloads: 116

Offline

 

#2 2007-01-19 19:41:56

siteadmin
Administrator
Registriert: 2007-01-12
Beiträge: 26

Re: Function Backlink Check, Link Check

Stepp 1

Überlegung:
Was sollte der Backlink Tester können?
- Link zu meiner Seite überprüfen.

Code: php

  1. <?php
  2. //$quelltext = file_get_contents('http://www.partner-domain.de'); // Partner Url besuchen und Inhalt in $quelltext speichern
  3.  
  4. /* zum Verständnis ein einfacher html Quelltext */
  5.  
  6. $quelltext = '
  7. <html>
  8. <head>
  9. <title></title>
  10. <meta name="author" content="phplist">
  11. <style type="text/css">
  12. <!--
  13. .link{
  14. BACKGROUND: #333;
  15. }
  16. -->
  17. </style>
  18. </head>
  19. <body text="#000000" bgcolor="#FFFFFF" link="#000000" alink="#000000" vlink="#000000">
  20. Besuche phplist das
  21. <a class="link" href="http://www.phplist.de" style="color:#C0C0C0" target="_blank">Webkatalog Script</a>
  22. </body>
  23. </html>
  24. ';
  25.  
  26. /*  Ausgabe Browser Anzeicht für Quelltext
  27. exit($quelltext);
  28. */
  29.  
  30.  
  31. $link_partner_url= 'http://www.webkatalog-script.phplist.de/'// Partnerseite die geprüft werden soll
  32. $my_link_url = 'http://www.phplist.de';    // hier Dein Link
  33.  
  34. if (preg_match("!<a[^>]*".$my_link."[^>]*>!Uis", $quelltext, $links))
  35. {
  36.         echo "<b>Link vorhanden</b><pre>";
  37.         echo htmlspecialchars($links[0]);
  38.         echo "</pre>";
  39. }
  40. ?>

Nachteil:
Linktext fehlt und leicht zu manipulieren!
Also muss was besseres her tongue


Attachments:
Attachment Icon stepp1.php, Größe: 1,010 bytes, Downloads: 36

Offline

 

#3 2007-01-19 20:11:06

siteadmin
Administrator
Registriert: 2007-01-12
Beiträge: 26

Re: Function Backlink Check, Link Check

Stepp 2

Überlegung:
- Finde alle Links und Linktexte

Code: php

  1. <?php
  2. //$quelltext = file_get_contents('http://www.partner-domain.de'); // Partner Url besuchen und Inhalt in $quelltext speichern
  3.  
  4. /* zum Verständnis ein einfacher html Quelltext */
  5.  
  6. $quelltext = '
  7. <html>
  8. <head>
  9. <title></title>
  10. <meta name="author" content="phplist">
  11. <style type="text/css">
  12. <!--
  13. .link{
  14. BACKGROUND: #333;
  15. }
  16. -->
  17. </style>
  18. </head>
  19. <body text="#000000" bgcolor="#FFFFFF" link="#000000" alink="#000000" vlink="#000000">
  20. Besuche phplist das
  21. <a class="link" href="http://www.phplist.de" style="color:#C0C0C0" target="_blank">Webkatalog Script</a>
  22. <a href="http://www.google.de">google</a>
  23. <a href=http://www.yahoo.de><i style="color:#FF0000" >yahoo</i></a>
  24. <a href=\'http://www.msn.de\'><u>msn</u></a>
  25. <a href="../">home</a>
  26. </body>
  27. </html>
  28. ';
  29.  
  30. /*  Ausgabe Browser Anzeicht für Quelltext */
  31. //exit($quelltext);
  32.  
  33.  
  34.  
  35. $link_partner_url= 'http://www.webkatalog-script.phplist.de/'// Partnerseite die geprüft werden soll
  36. $my_link_url = 'http://www.phplist.de';    // hier Dein Link
  37.  
  38. // Alle Links + Linktext auslesen
  39.  
  40. if (preg_match_all("!<a [^>]*>.*\s*<\s*/\s*a\s*>!Uis", $quelltext, $links_array))
  41. {
  42.         foreach ($links_array[0] as $anzahl => $link)  echo $anzahl." : ".htmlspecialchars($link)."<br>\n";
  43. }
  44. ?>

Attachments:
Attachment Icon stepp2.php, Größe: 1,256 bytes, Downloads: 82

Offline

 

Brett Fußzeile

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson