Hi!

Got neat ad posting thingy but

Deprecated: Function ereg() is deprecated in /home/content/13/11394913/html/ads/index.php on line 34

is repeated all the way down page, and then some.

Index.php is SO LONG I can't get it on here!

So I'll post enuf to cover ln 34.

<?PHP
include "inc/global.php";
include "temp.fun.php";
$rq = $_REQUEST;
$pst = $_POST;
$do = $_REQUEST['do'];
$system = $DB->sys_optn("sys");
set_visitor();


if($rq['tag'])
{

    $sql_chk = $DB->fetch_q("select * from tags where tags_name='".urlencode($rq['tag'])."' ");
    if($sql_chk['con'] != 0)
    {
        $tag =  str_replace(" ", "+", $rq['tag']);
        $pst['search_fr'] =  $tag;
        $clk = $sql_chk['rs']['clicks'];
        $clk++;
        $tags_up['clicks'] = $clk;
        $ups = $DB->updt("tags", $tags_up, "where idtags='".$sql_chk['rs']['idtags']."' ");
        $_SESSION['tags'] = $tag;
    }
}


$style_file = "styles/".$style.".html";
$file_lang = @fopen("lang/".$lang_file.".php", r);
$_Phrase = array();
while(!feof($file_lang))
{
    $line = fgets($file_lang);
    if(!ereg("die()", $line) && !ereg("//", $line))
    {
        $phrase_ar = explode("=", $line);
        if($phrase_ar[0] && $phrase_ar[1])
        {
            $_Phrase[strip_space($phrase_ar[0])] = str_replace("\n", "", strip_space($phrase_ar[1]));
        }
    }
}

//Database
if($_POST['titl'] && $_POST['nam'] && $_POST['website'] && $_POST['data'] && $_POST['cap'] && $_POST['email'] && !$pst['name_contact'])
{
    if(check_mail($_POST['email']))


and so on...... to ln 781!

Thanks,
L-D

Recommended Answers

All 3 Replies

Hey.

The main problem is just like the notice sais: the ereg() function is deprecated and shouldn't be used. These days people use the PCRE extension for regular exrpessions.

However, this notice is not actually an error so your code will still work with it. But being deprecated, the ereg() function is due to be removed at any time, so if you upgrade your PHP version while still using that function, you may find that it no longer exists. - The best move here would be to replace the function.

The quick and bad move here would be to just silence the error, which you can do by disabling PHP's error display. That you can do by adding this to the top of the page, or editing the same PHP configuration value in the php.ini file.

ini_set("display_errors", false);

On production servers, this should be disabled anyway, and the errors logged to a file or a database. I suggest you look into that!

Hi Atli,

I put it here, is that ok?

<?PHP
include "inc/global.php";
include "temp.fun.php";
ini_set("display_errors", false);
$rq = $_REQUEST;
$pst = $_POST;
$do = $_REQUEST['do'];
$system = $DB->sys_optn("sys");
set_visitor();

I'm a HTML guy... I have to be held by the hand in this!

L-D

Ok, I tried it and it works!

http://www.universal-abundance.com/ads/index.php

Thanks, I'll put it in a iframe so it shows on the main site!

Thanks again!
L-D

Nope, it's not accepting ads. Gives visit count but new ad does not show up.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.