canadian_angel Posted June 26, 2010 Share Posted June 26, 2010 Hi, I have a problem, everytime I run this this code I get these error messages, and I can't figure out why, I have gone over every line but I must be missing something. Warning: eregi() [function.eregi]: REG_ECTYPE in C:\AppServ\www\chapter13\convert_url.php on line 26 Warning: eregi() [function.eregi]: REG_ECTYPE in C:\AppServ\www\chapter13\convert_url.php on line 31 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title>Make URL Click-able</title> </head> <body> <?php // Script 13.2 - convert_url.php // This script turns a valid URL into an HTML link. // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); if ( isset ($_POST['submit'])) { // Has the form been submitted? // Trim off extraneous spaces, just in case. $url = trim ($_POST['url']); // Establish the patterns. $pattern1 = '^((http|https|ftp)://){1}([[:alum:]-])+(\.)([[:alum:]-]){2,4}([[:alum:]/+=%&_.~?-]*)$'; $pattern2 = '^([[:alum:]-])+(\.)([[:alum:]-]){2,4}([[:alum:]/+=%&_.~?-]*)$'; // Test the submitted value against the patterns. if (eregi ($pattern1, $url)) { // Check for an existing http/https/ftp. $url = eregi_replace ($pattern1,'<a href="\\0">\\0</a>', $url); print "<p>Here is the URL: $url<br />The code is now: " . htmlentities ($url) . '</p>'; } elseif (eregi ($pattern2, $url)) { // No http/https/ftp, add http://. $url = eregi_replace ($pattern2,'<a href="http://\\0">\\0</a>', $url); print "<p>Here is the URL: $url<br />The code is now: " . htmlentities ($url) . '</p>'; } else { // Invalid URL. print '<p>Please enter a valid URL.</p>'; } } // End of main conditional. // Display the HTML form. ?> <form action="convert_url.php" method="post"> <p>URL: <input type="text" name="url" size="30" /></p> <input type="submit" name="submit" value="Convert" /> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/205952-code-producing-error-message-please-help/ Share on other sites More sharing options...
kenrbnsn Posted June 26, 2010 Share Posted June 26, 2010 The error is referring to the string ":alum" in these two line: <?php $pattern1 = '^((http|https|ftp)://){1}([[:alum:]-])+(\.)([[:alum:]-]){2,4}([[:alum:]/+=%&_.~?-]*)$'; $pattern2 = '^([[:alum:]-])+(\.)([[:alum:]-]){2,4}([[:alum:]/+=%&_.~?-]*)$'; ?> which should be ":alnum" <?php $pattern1 = '^((http|https|ftp)://){1}([[:alnum:]-])+(\.)([[:alnum:]-]){2,4}([[:alnum:]/+=%&_.~?-]*)$'; $pattern2 = '^([[:alnum:]-])+(\.)([[:alnum:]-]){2,4}([[:alnum:]/+=%&_.~?-]*)$'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/205952-code-producing-error-message-please-help/#findComment-1077702 Share on other sites More sharing options...
canadian_angel Posted June 26, 2010 Author Share Posted June 26, 2010 Thanks so much I can't believe my error, a typo ugh! Link to comment https://forums.phpfreaks.com/topic/205952-code-producing-error-message-please-help/#findComment-1077713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.