Jump to content

ERROR: Deprecated: Function eregi() is deprecated in and Notice: Undefined index: device in


Scotty13

Recommended Posts

My profile page is giving me the following errors. Deprecated: Function eregi() is deprecated in /home/******/public_html/root/res.php on line 185 Notice: Undefined index: device in /home/******/public_html/root/res.php on line 247 LINES 185 & 247 are marked below. Using PHP 5.3.x On line 185, I've tried preg and preg_match. They both gave me errors. I appreciate any help and please don't answer with to complicated replies. I'm only a rookie and as you can see this is all I could achieve. Thanks, Scott // ------- DETECT USER DEVICE ---------- $user_device = ""; $agent = $_SERVER['HTTP_USER_AGENT']; if (preg_match("/iPhone/", $agent)) { $user_device = "iPhone Mobile"; } else if (preg_match("/Android/", $agent)) { $user_device = "Android Mobile"; } else if (preg_match("/IEMobile/", $agent)) { $user_device = "Windows Mobile"; } else if (preg_match("/Chrome/", $agent)) { $user_device = "Google Chrome"; } else if (preg_match("/MSIE/", $agent)) { $user_device = "Internet Explorer"; } else if (preg_match("/Firefox/", $agent)) { $user_device = "Firefox"; } else if (preg_match("/Safari/", $agent)) { $user_device = "Safari"; } else if (preg_match("/Opera/", $agent)) { $user_device = "Opera"; } $OSList = array ( // Match user agent string with operating systems 'Windows 3.11' => 'Win16', 'Windows 95' => '(Windows 95)|(Win95)|(Windows_95)', 'Windows 98' => '(Windows 98)|(Win98)', 'Windows 2000' => '(Windows NT 5.0)|(Windows 2000)', 'Windows XP' => '(Windows NT 5.1)|(Windows XP)', 'Windows Server 2003' => '(Windows NT 5.2)', 'Windows Vista' => '(Windows NT 6.0)', 'Windows 7' => '(Windows NT 6.1)|(Windows NT 7.0)', 'Windows NT 4.0' => '(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)', 'Windows ME' => 'Windows ME', 'Open BSD' => 'OpenBSD', 'Sun OS' => 'SunOS', 'Linux' => '(Linux)|(X11)', 'Mac OS' => '(Mac_PowerPC)|(Macintosh)', 'QNX' => 'QNX', 'BeOS' => 'BeOS', 'OS/2' => 'OS/2', 'Mac OS' => 'Mac OS', 'Search Bot'=>'(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves/Teoma)|(ia_archiver)' ); // Loop through the array of user agents and matching operating systems foreach($OSList as $CurrOS=>$Match) { // Find a match LINE 185: if (eregi($Match, $agent)) { break; } else { $CurrOS = "Unknown OS"; } } $device = "$user_device : $CurrOS"; // ------- END DETECT USER DEVICE ---------- // ------- POST NEW BLAB TO DATABASE --------- $anno_outout_msg = ""; if (isset($_POST['anno_field']) && $_POST['anno_field'] != "" && $_POST['anno_field'] != " "){ $annoWipit = $_POST['annoWipit']; $sessWipit = base64_decode($_SESSION['wipit']); if (!isset($_SESSION['wipit'])) { } else if ($annoWipit == $sessWipit) { // Delete any annos over 50 for this member $sqlDeleteAnnos = mysql_query("SELECT * FROM announcing WHERE tkt_id='$id' ORDER BY anno_date DESC LIMIT 50"); $bi = 1; while ($row = mysql_fetch_array($sqlDeleteAnnos)) { $anno_id = $row["id"]; if ($bi > 20) { $deleteAnnos = mysql_query("DELETE FROM announcing WHERE id='$anno_id'"); } $bi++; } // End Delete any annos over 20 for this member $anno_field = $_POST['anno_field']; $anno_field = stripslashes($anno_field); $anno_field = strip_tags($anno_field); $anno_field = mysql_real_escape_string($anno_field); $anno_field = str_replace("'", "'", $anno_field); $sql = mysql_query("INSERT INTO announcing (tkt_id, the_anno, anno_date, anno_type, anno_device) VALUES('$id','$anno_field', now(),'a','$anno_device')") or die (mysql_error()); $anno_outout_msg = "Your announcement has been posted!"; } } // ------- END POST NEW BLAB TO DATABASE --------- // ------- MEMBER BLABS OUTPUT CONSTRUCTION --------- /////// Mechanism to Display Pic if (file_exists($check_pic)) { $anno_pic = '<div style="overflow:hidden; height:40px;"><a href="res.php?id=' . $id . '"><img src="' . $check_pic . '" width="40px" border="0" /></a></div>'; } else { $anno_pic = '<div style="overflow:hidden; height:40px;"><a href="res.php?id=' . $id . '"><img src="' . $default_pic . '" width="40px" border="0" /></a></div>'; } /////// END Mechanism to Display Pic $sql_annos = mysql_query("SELECT id, tkt_id, the_anno, anno_date, anno_type, anno_device FROM announcing WHERE tkt_id='$id' ORDER BY anno_date DESC LIMIT 30"); while($row = mysql_fetch_array($sql_annos)){ $annoid = $row["id"]; $announcer_id = $row["tkt_id"]; $the_anno = $row["the_anno"]; $the_anno = ($activeLinkObject -> makeActiveLink($the_anno)); $anno_date = $row["anno_date"]; $convertedTime = ($myObject -> convert_datetime($anno_date)); $whenAnno = ($myObject -> makeAgo($convertedTime)); $anno_date = $row["anno_date"]; $anno_type = $row["anno_type"]; LINE 247: $anno_device = $row["device"]; $announcerDisplayList .= ' <table style="background-color:#FFF; border:#999 1px solid; border-top:none;" cellpadding="5" width="100%"> <tr> <td width="10%" valign="top">' . $anno_pic . '</td> <td width="90%" valign="top" style="line-height:1.5em;"> <span class="liteGreyColor textsize9">' . $whenAnno . ' <a href="res.php?id=' . $announcer_id . '"><strong>' . $mainNameLine . '</strong></a> via <em>' . $anno_device . '</em></span><br /> ' . $the_anno . ' </td> </tr></table>'; }

Link to comment
Share on other sites

Line 183: Instead of if (eregi($Match, $agent)) try to replace with this: if (preg_match("/$match/",$agent))Line 247: It's because there is no such variable as: $row["device"] you therefore cannot assign nothing to another variable.Maybe you mean: $row["anno_device"];

Link to comment
Share on other sites

Spoke too soon. It works perfect in IE broser. When I test in Chrome, Safari and Firefox I get the following error...Warning: Cannot modify header information - headers already sent by (output started at /home/******/public_html/root/wi_class_files/autoMakeLinks.php:15) in /home/myglobal/public_html/root/res.php on line 45// ------- ESTABLISH THE PAGE ID ACCORDING TO CONDITIONS ---------if (isset($_GET['id'])) {$id = preg_replace('#[^0-9]#i', '', $_GET['id']); // filter everything but numbers} else if (isset($_SESSION['idx'])) {$id = $ckinOptions_id;} else {Line 45: header("location: index.php");exit();}// ------- END ESTABLISH THE PAGE ID ACCORDING TO CONDITIONS ---------

Link to comment
Share on other sites

read the error message, it's telling you output has started at line 15.

headers already sent by (output started at /home/******/public_html/root/wi_class_files/autoMakeLinks.php:15)
Look there. Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...