Elimnating duplicate images; using relative link for step3
authoroes <oes@users.sourceforge.net>
Tue, 2 Apr 2002 07:22:19 +0000 (07:22 +0000)
committeroes <oes@users.sourceforge.net>
Tue, 2 Apr 2002 07:22:19 +0000 (07:22 +0000)
doc/webserver/actions/step2.php

index 0a1d94f..9020ffd 100644 (file)
 /*
  * For testing: 
  */
-$base_url = "http://www.oesterhelt.org/actions";
-//$base_url = "http://privoxy.org/actions";
-//$base_url = "http://localhost/actions";
 //phpinfo();
-//error_reporting(E_NONE);
-error_reporting(E_ALL);
+//error_reporting(E_ALL);
+error_reporting(E_NONE);
 
 
 /* 
@@ -220,7 +217,7 @@ switch($problem)
   </div>
 
   <div class="box">
-   <form action="<?php echo($base_url); ?>/step3.php" method="post">
+   <form action="step3.php" method="post">
     <p>
      <input type="hidden" name="problem" value="<?php echo ($problem) ?>">
      <input type="hidden" name="referrer_url" value="<?php echo ($referrer_url) ?>">
@@ -246,7 +243,9 @@ else
     * in a table for the user to select
     */
    preg_match_all('|<img\s+[^>]*?src=[\'"]?(.*?)[\'" >]|i', $page, $matches);
-   $count = count($matches[0]);
+   $image_urls = array_values(array_unique($matches[1]));
+   $count = count($image_urls);
+
    if ($count > 0)
    {
       /* 
@@ -283,7 +282,7 @@ else
        */
       for ($i=0; $i< $count; $i++)
       {
-         $image_url = $matches[1][$i];
+         $image_url = $image_urls[$i];
  
          /*
           * Make image URLs absolute: