PHP - Moved: Deprecated: Function In Wordpress Blog Comments
This topic has been moved to PHP Applications.
http://www.phpfreaks.com/forums/index.php?topic=343263.0 Similar TutorialsThis topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=358821.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=359592.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347050.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=311235.0 hey, i need some help if possible. I basicly have 2 tables, one has the blog posts and one has the blog comments. I'm trying to display the latest 5 blog posts (which works) but underneath each of the blog posts i need to display about 3 of the latest comments for that post but it isn't showing any. any ideas? here's my code: Code: [Select] <? session_start(); $myusername = $_SESSION['myusername']; $db_host = 'localhost'; $db_user = 'HIDDEN'; $db_pwd = 'HIDDEN'; $database = 'tjwebsol_dev'; $table = 'posts'; $table2 = 'blog_comments'; $tab = '&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;&#38;#160;'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // sending query $result = mysql_query("SELECT * FROM {$table} ORDER BY blog_id DESC LIMIT 5"); if (!$result) { die("Query to show fields from table failed"); } $sql = mysql_query("SELECT * FROM {$table2} ORDER BY comment_id ASC LIMIT 5 "); $fields_num = mysql_num_fields($result); $fields_num2 = mysql_num_fields($sql); while($row2 = mysql_fetch_assoc($sql)) { $blog_comments = $row2['comment_content']; $date_commented = $row2['date_commented']; $time_commented = $row2['time_commented']; $blog_username2 = $row2['username']; $blogid = $row2['blogid']; $comment_id = $row2['comment_id']; } while($row = mysql_fetch_assoc($result)) { $blog_title = $row['title']; $blog_content = $row['content']; $blog_username = $row['username']; $blog_date = $row['date_posted']; $blog_time = $row['time_posted']; $blog_id = $row['blog_id']; echo "<hr>"; echo "<div class='post'>"; echo "<h2 class='title'><a href='#'>$blog_title</h2></a>"; echo "<p class='byline'>posted by <b>$blog_username</b> on <b>$blog_date</b> ($blog_time)</p>"; echo "<br>"; echo "<div class='entry'>$blog_content</div><br>"; if ($blogid == $blog_id) { echo "<b>User Posted Comments:</b><br><br>"; echo "$tab<b>$comment_id</b>. $blog_comments"; echo "<br><br>"; echo "Commented posted by <b>$blog_username2</b> on <b>$date_commented ($time_commented)</b>"; echo "<br><br><br>"; } if (!isset($_SESSION['logged']) || $_SESSION['logged'] !== true) { // not logged in, move to login page echo "<b><a href='login.php'>Login</a></b> to post your comments!"; } echo "<br><br><br>"; include('blognewcomment.php'); echo ""; echo "</div>"; } mysql_free_result($result); ?> Would anyone have the answer to solve this error message? Deprecated: Function split() is deprecated in /includes/modules/shipping/table.php on line 57 Here is the code. Line 57 is in Bold. Preg_split is suppose to work. Tried preg_explode but that didn't work. Appreciate any help! $table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLE_COST); $size = sizeof($table_cost); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_total <= $table_cost[$i]) { $shipping = $table_cost[$i+1]; break; } } I have configure Xampp my site is fully functional except for the error Deprecated: Function split() is deprecated in C:\Images_Database\imagesdb\htdocs\jpserver\system\frameworks\read_site_info.php on line 15 Line 15 code shown Below $sub_folders = split("/", $_SERVER["SCRIPT_NAME"]); how to split in a proper way can any one help me God Blessings Continue from mysql_num_rows() thread which was fixed. I am having a problem with my log in script. Especially with this one below. Please help me in this one. I got this " Deprecated: Function session_register() is deprecated in... " by using this code: Quote " <?php session_start(); if(!session_is_registered($uname)) { header("location: mainpage.php"); } ?> <html> <head> </head> <body> Log in Successful </body> </html> " Any suggestions please, on how to fix it? Thanks in advance. Hi, I wonder if someone could help me, Just moved to a new server running PHP5 and getting the "Deprecated: Function sql_regcase() is deprecated" error, I don't want to disable the messages in php.ini, I would prefer to get the coding right. The error relates to the anti-injection function posted below:- Code: [Select] function anti_injection($sql) { // removes words that contain sql syntax $s = array("`","~","!","@","#","$","%","^","&","*","(",")","+","=","[","]",";","<",">","http","//","www"); $sql = str_replace($s, "", $sql); $sql = preg_replace(sql_regcase("/(from|truncate|expalin|select|insert|delete|where|update|empty|drop table|limit|show tables|#|\*|--|\\\\)/"),"",$sql); $sql = trim($sql); // strip whitespace $sql = strip_tags($sql); // strip HTML and PHP tags $sql = addslashes($sql); // quote string with slashes return $sql; } If anyone can help recode the snippet it would be greatly appreciated. Thanks Ian Hi, My host upgrade PHP yesterday and broke some code on my site. My developer is not avail... ERROR MSSG: Deprecated: Function session_is_registered() is deprecated in...followed by directory Here's the live of code that contains the error. if(!isset($_POST[$param_name]) && !isset($_GET[$param_name]) && session_is_registered($param_name)) Im assuming it has to do with "session_is_registered". Any ideas? thanks. How to solve this error out PHP Deprecated: Function ereg_replace() is deprecated in using this code Code: [Select] $shoutcast_on_off =''; $scsuccs = ''; $listenlink = ''.$scdef.''; $scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30); if(!$scfp) { $scsuccs=1; } $page = ''; if($scsuccs!=1){ fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n"); while(!feof($scfp)) { $page .= fgets($scfp, 1000); } $loop = array("STREAMSTATUS"); $y=0; while($loop[$y]!=''){ $pageed = ereg_replace(".*<$loop[$y]>", "", $page); $scphp = strtolower($loop[$y]); $$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed); $y++; } fclose($scfp); } $online1 = ''; if ($streamstatus == "1") { $online1 = '<center><img src="'.$BASEURL.'/styles/'.$theme.'/theme_images/DJ.png" border="0" height="150"></center><br> <center><a href="'.$BASEURL.':'.$scport.'/listen.pls"><img src="'.$BASEURL.'/styles/'.$theme.'/theme_images/klausom.png" width="150px" height="auto"></a></center>'; } else { $online2 = ''; $online2 = '<center><img src="'.$BASEURL.'/styles/'.$theme.'/theme_images/off.png" border="0" height="150"></center>'; } // BEGIN Plugin: shoutcast_on_off $shoutcast_on_off = $online1.$online2; // END Plugin: shoutcast_on_off eval("\$shoutcast = \"".$TSUE['TSUE_Template']->LoadTemplate('shoutcast')."\";"); return $shoutcast; Can anyone help me with this - I don't normally do coding.
I've just moved an old site onto new hosting and I'm getting this message: Deprecated: Function ereg_replace() is deprecated
The code looks like this:
if( preg_match( '/sl/i', $sOption ) )
$sContent = addslashes( $sContent );
else
$sContent = stripslashes( $sContent );
$sContent = ereg_replace( "\r", '', $sContent );
if( preg_match( '/len/i', $sOption ) )
$sContent = checkLengthOfTxt( $sContent );
I changed it to look like this:
if( preg_match( '/sl/i', $sOption ) )
$sContent = addslashes( $sContent );
else
$sContent = stripslashes( $sContent );
$sContent = preg_replace( "\r", '', $sContent );
if( preg_match( '/len/i', $sOption ) )
$sContent = checkLengthOfTxt( $sContent );
But now get this warning message:
Warning: preg_replace() [function.preg-replace]: Empty regular expression
I didn't build the site so I don't even know what the script is trying to do - forgive my ignorance!
Can anyone help me fix this problem: Deprecated: Function session_is_registered() is deprecated in/includes/functions/sessions.php on line 81 The code is: function tep_session_is_registered($variable) { return session_is_registered($variable); } function tep_session_unregister($variable) { return session_unregister($variable); } Fairly new to PHP and would greatly appreciate any help! This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=307486.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=323879.0 Hi have a webpage (homepage) that has a wordpress blog linked to it. when i save the page exactly as it is for example. home.php then saves as home1.php and load the home1.php the wordpress blog is missing. i dont use wordpress normally this is a site i have been sent to amend some part in php. Is the reason for this wordpress backend is pointing to the home.php?
here is the code for the blog
<div class="blog_container"> <a href="/blog" class="title_link">Latest Blog Posts</a> <? if ($posts) { ?> <ul> <? foreach ($posts as $post) { ?> <li> <a href="<?= $post->guid ?>"> <?= word_limiter($post->post_title, 10) ?> <span><?= date('d-m-Y', strtotime($post->post_date)) ?></span> <strong>read more ></strong> </a> </li> <? } ?> </ul> <? } ?> </div>thanks I had a wordpress site setup for my maintenance company. I am not trying to setup a blog on the site. I have the blogroll showing up on this page: http://handymore.com/blog/ but when you click the individual articles the single post page shows a Error 404 message. Could anyone point me in the right direction as to how to fix this so that the individual post pages are found? Any guidance would be appreciated. Hi, I have this money related function: function getMoneyUS( $pricesUS ) { setlocale( LC_MONETARY, 'en_US.UTF-8' ); return money_format( '%n', $pricesUS ); } Now, after the update to 7.4, it is showing in the logs as deprecated. The issue is money_format. I tried with NumberFormatter::formatCurrency but I either get an error or empty results. Examples I'm finding are not functions that can be applied multiple times, but for fixed values only. Examples like this: $fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY ); echo numfmt_format_currency($fmt, 1234567.891234567890000, "EUR")."\n"; Or this: $fmt = new NumberFormatter( 'de_DE', NumberFormatter::CURRENCY ); echo $fmt->formatCurrency(1234567.891234567890000, "EUR")."\n"; I could not adapt them to my function. I understand that I do not need setlocale anymore, but this NumberFormatter only. But the exact working replacement is a challenge for me. I tried removing variable $fmt and replacing the fixed amount with my $priceUS, always some error or no result. Hi Guys,
Firstly I would like state that I do not have a clue about PHP coding, I have merely signed up to gain some help with the following errors I have with my site I have recently setup with a PHP sports application.
I downloaded the application from the following website http://phpmysport.sourceforge.net/ and as far as I know the software is opensource and no longer supported by its developer.
The following http://www.proevoeliteleagues.esy.es/ is my website which displays the error messages.
Please see following code the files in question:
menu.php
<?php /* * phpMySport : website for team sport clubs and leagues * * Copyright (C) 2006-2009 Jerome PLACE. All rights reserved. * * Email : djayp [at] users.sourceforge.net * Website : http://phpmysport.sourceforge.net * Version : 1.4 * Last update : 4 march 2009 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ /****************************/ /* MENUS */ /****************************/ $file=ROOT."/menu.csv"; # file containing the website menu # list of default pages $default_pages=array( array('level'=>'parent','title'=>$lang['general']['home'],'url'=>'index.php','class'=>'menu_home'), array('level'=>'parent','title'=>$lang['general']['news'],'url'=>'index.php?r='.$lang['general']['idurl_news'].'&v1=news_list','class'=>''), array('level'=>'parent','title'=>$lang['general']['information'],'url'=>'index.php?r='.$lang['general']['idurl_information'],'class'=>''), array('level'=>'parent','title'=>$lang['general']['team_list'],'url'=>'index.php?r='.$lang['general']['idurl_team'].'&v1=team_list','class'=>''), array('level'=>'parent','title'=>$lang['general']['member_list'],'url'=>'index.php?r='.$lang['general']['idurl_member'].'&v1=member_list','class'=>''), array('level'=>'child','title'=>$lang['general']['member_list'],'url'=>'index.php?r='.$lang['general']['idurl_member'].'&v1=member_list','class'=>''), array('level'=>'child','title'=>$lang['general']['player_list'],'url'=>'index.php?r='.$lang['general']['idurl_team'].'&v1=player_list','class'=>''), array('level'=>'child','title'=>$lang['general']['manager_list'],'url'=>'index.php?r='.$lang['general']['idurl_member'].'&v1=manager_list','class'=>''), array('level'=>'child','title'=>$lang['general']['coach_list'],'url'=>'index.php?r='.$lang['general']['idurl_team'].'&v1=coach_list','class'=>''), array('level'=>'child','title'=>$lang['general']['referee_list'],'url'=>'index.php?r='.$lang['general']['idurl_member'].'&v1=referee_list','class'=>''), array('level'=>'parent','title'=>$lang['general']['match_list'],'url'=>'index.php?r='.$lang['general']['idurl_match'],'class'=>''), array('level'=>'child','title'=>$lang['general']['match_list'],'url'=>'index.php?r='.$lang['general']['idurl_match'].'&v1=match_list','class'=>''), array('level'=>'child','title'=>$lang['general']['standings'],'url'=>'index.php?r='.$lang['general']['idurl_match'].'&v1=standings','class'=>''), array('level'=>'child','title'=>$lang['general']['stats_player'],'url'=>'index.php?r='.$lang['general']['idurl_match'].'&v1=stats_player','class'=>''), array('level'=>'parent','title'=>$lang['general']['competition_list'],'url'=>'index.php?r='.$lang['general']['idurl_competition'].'&v1=competition_list','class'=>''), //array('order'=>'6.1','title'=>$lang['general']['statistics'],'url'=>'index.php?r='.$lang['general']['idurl_match'].'&v1=statistics','class'=>''), //array('order'=>'8.0','title'=>$lang['general']['search_member'],'url'=>'index.php?r='.$lang['general']['idurl_member'].'&v1=search_member','class'=>''), array('level'=>'parent','title'=>$lang['general']['club_list'],'url'=>'index.php?r='.$lang['general']['idurl_club'],'class'=>''), array('level'=>'parent','title'=>$lang['general']['field_list'],'url'=>'index.php?r='.$lang['general']['idurl_field'],'class'=>''), array('level'=>'parent','title'=>$lang['general']['forum_list'],'url'=>'index.php?r='.$lang['general']['idurl_forum'],'class'=>'') ); $website_menu=array(); # we load the menu if(file_exists($file) AND $fp=fopen($file, "r") AND filesize($file)!=0) { $i=0; while (($data = fgetcsv($fp, 1000, ";")) !== FALSE) { $website_menu[$i]['level']=$data[0]; $website_menu[$i]['title']=$data[1]; $website_menu[$i]['url']=$data[2]; $website_menu[$i]['class']=$data[3]; $website_menu[$i]['target']=$data[4]; $i++; } fclose($fp); } else { $website_menu=$default_pages; } $k=0; $i=-1; foreach($website_menu AS $value) { if(!isset($value['target'])) $value['target']=''; if(!eregi("http",$value['url'])) { $value['url']=convert_url($value['url']); } if($value['level']=='parent') { $i++; $j=0; $index['menu'][$i]=$value; $index['menu'][$i]['i']=$k; $index['menu'][$i]['submenu']=array(); } else { $index['menu'][$i]['submenu'][$j]=$value; $index['menu'][$i]['submenu'][$j]['i']=$k; $j++; } $k++; } /* # team of the club $index['team']=array(); if(CLUB!=0) { if(!isset($_SESSION['menu_team'])) { $var['condition']=""; $var['limit']=""; $var['order']=" ORDER BY e.sex_id, ne.team_name_name ASC"; $included=1; include_once(create_path("team/sql_team.php")); include_once(create_path("team/tpl_team.php")); include_once(create_path("team/lg_team_".LANG.".php")); include(create_path("team/team_list.php")); unset($included); $_SESSION['menu_team']=$page['team']; } $index['team']=$_SESSION['menu_team']; } # information pages list $index['information']=array(); if(!isset($_SESSION['menu_information'])) { $var['condition']=""; $var['limit']=""; $var['order']=""; $included=1; include_once(create_path("information/sql_information.php")); include_once(create_path("information/tpl_information.php")); include_once(create_path("information/lg_information_".LANG.".php")); include(create_path("information/page_list.php")); unset($included); $_SESSION['menu_information']=$page['page']; } $index['information']=$_SESSION['menu_information']; # forums list $index['forum']=array(); if(!isset($_SESSION['menu_forum'])) { $var['condition']=""; $var['limit']=""; $var['order']=""; $included=1; include_once(create_path("forum/sql_forum.php")); include_once(create_path("forum/tpl_forum.php")); include_once(create_path("forum/lg_forum_".LANG.".php")); include(create_path("forum/forum_list.php")); unset($included); $_SESSION['menu_forum']=$page['forum']; } $index['forum']=$_SESSION['menu_forum']; # competition list $index['competition']=array(); if(!isset($_SESSION['menu_competition'])) { $var['condition']=""; $var['limit']=""; $var['order']=""; $included=1; include_once(create_path("competition/sql_competition.php")); include_once(create_path("competition/tpl_competition.php")); include_once(create_path("competition/lg_competition_".LANG.".php")); include(create_path("competition/competition_list.php")); unset($included); $_SESSION['menu_competition']=$page['competition']; } $index['competition']=$_SESSION['menu_competition']; # plugins $index['plugin']=array(); $nb_plugin=sizeof($plugin); $j=0; for($i=0; $i< $nb_plugin; $i++) { if($plugin[$i]['active']==1) { $index['plugin'][$j]['name']=$plugin[$i]['name']; $index['plugin'][$j]['link']=$plugin[$i]['link']; $index['plugin'][$j]['class']=$plugin[$i]['class']; $j++; } } #text $index['L_home']=$lang['general']['home']; $index['L_news']=$lang['general']['news']; $index['L_information']=$lang['general']['information']; $index['L_member']=$lang['general']['member']; $index['L_member_list']=$lang['general']['member_list']; $index['L_player_list']=$lang['general']['player_list']; $index['L_manager_list']=$lang['general']['manager_list']; $index['L_coach_list']=$lang['general']['coach_list']; $index['L_referee_list']=$lang['general']['referee_list']; $index['L_match']=$lang['general']['match']; $index['L_match_list']=$lang['general']['match_list']; $index['L_standings']=$lang['general']['standings']; $index['L_stats_player']=$lang['general']['stats_player']; $index['L_competition_list']=$lang['general']['competition_list']; $index['L_team_list']=$lang['general']['team_list']; $index['L_statistics']=$lang['general']['statistics']; $index['L_search_member']=$lang['general']['search_member']; $index['L_club_list']=$lang['general']['club_list']; $index['L_view_club']=$lang['general']['view_club']; $index['L_field_list']=$lang['general']['field_list']; $index['L_forum_list']=$lang['general']['forum_list']; */ # mode club $index['link_view_club']=""; $index['class_view_club']=""; if(CLUB!=0){ $index['link_view_club']=convert_url("index.php?r=".$lang['general']['idurl_club']."&v1=view&v2=".CLUB); $index['L_club_list']=$lang['general']['club_opponent_list']; $index['L_information']=$lang['general']['the_club']; if(isset($_GET['r']) AND $_GET['r']==$lang['general']['idurl_club'] AND isset($_GET['v2']) AND $_GET['v2']==CLUB) { $index['class_information']="on"; $index['class_club']=""; } } ?>fonctions.php Im new to php and Im working on a script that I purchased. I'm getting this error when I try to setup my script. I did some research and understand that I "eregi" is old code and not being used anymore. So I tried to use preg_match but I'm stuck. If anyone can look at the code and help with some notes. I would like to understand what im doing wrong not just a fix. Deprecated: Function eregi() Code: [Select] if (eregi($file,$_SERVER["HTTP_ACCEPT_LANGUAGE"]) && !$use_lang) $use_lang = $file; This is what I get when using preg_match. preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash Code: [Select] if (preg_match($file,$_SERVER["HTTP_ACCEPT_LANGUAGE"]) && !$use_lang) $use_lang = $file; |