Server IP : 51.89.169.208 / Your IP : 3.22.248.193 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/staff/validation/ |
Upload File : |
<?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); } } // $str = "cairn terrier companies"; // $singular = ucwords(Inflect::singularize($str)); // $plural = ucwords(Inflect::pluralize($str)); // echo "Original: $str<br>"; // echo "Singular: $singular<br>"; // echo "Plural: $plural<br>"; // $sql = "SELECT * FROM google_suggest where junk = 0 order by rand() LIMIT 1"; // // $result = mysqli_query($connect, $sql); // $result = $mysqli->query($sql); // if ($result) { // while ($row = mysqli_fetch_assoc($result)) { // echo $row['keyword'] . "<br>"; // $query = str_replace(" near me", "", $row["keyword"]); // $singular = ucwords(Inflect::singularize($query)); // $plural = ucwords(Inflect::pluralize($query)); // echo "<pre>"; // echo "Original Val : ". $query . "<br/>"; // // Display the singular and plural forms // echo "Singular: $singular<br>"; // echo "Plural: $plural<br>"; // echo "</pre>"; // // Insert singular and plural forms into the table // $id = $row["id"]; //here's an "id" column in the table // $sql = "UPDATE google_suggest SET keyword_singular='$singular', keyword_plurals='$plural', junk = 1 WHERE id=$id"; // mysqli_query($connect, $sql); // } // // Calculate the next offset // //$next_offset = $offset + 1; // echo "<meta http-equiv=\"refresh\" content=\"0;URL=https://www.yellowdev.co.uk/all_scripts/ai-script/conversion.php\">"; // } else { // echo "Error retrieving records: " . mysqli_error($conn); // } // // Close connection // mysqli_close($connect); // Execute query $sql = "SELECT * FROM google_suggest where junk = 0 order by rand() LIMIT 100"; $result = $connect->query($sql); if ($result->num_rows > 0) { // Process the results while ($row = $result->fetch_assoc()) { echo $row['keyword'] . "<br>"; $query = str_replace(" near me", "", $row["keyword"]); $singular = ucwords(Inflect::singularize($query)); $plural = ucwords(Inflect::pluralize($query)); $singular = addslashes(trim($singular)); $plural = addslashes(trim($plural)); echo "<pre>"; echo "Original Val : " . $query . "<br/>"; // Display the singular and plural forms echo "Singular: $singular<br>"; echo "Plural: $plural<br>"; echo "</pre>"; // Insert singular and plural forms into the table $id = $row["id"]; //here's an "id" column in the table $sql = "UPDATE google_suggest SET keyword_singular='$singular', keyword_plurals='$plural', junk = 1 WHERE id=$id"; $connect->query($sql) || die("Error: ".$connect->error); } // Redirect to another page echo "<meta http-equiv=\"refresh\" content=\"0;URL=https://www.yellowleaf.co.uk/staff/validation/3.plural_check.php\">"; }else{ echo "No any data left"; } // Free the result set $result->free(); // Close the connection $connect->close(); ?>