well here it is crashing on line 76 and throwing the error in the Preg_match statement Why?
Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /home/content/73/9352073/html/includes.php on line 76

line 76 reads if(preg_match("index.php", $_SERVER[SCRIPT_NAME]))

I cannot see a syntax error can you?

Thanks Rob

'

Recommended Answers

All 10 Replies

Member Avatar for diafol

You don't have any delimiters around the pattern, try:

if(preg_match("/index.php/", $_SERVER['SCRIPT_NAME']))

Try posting more of your code next time as errors for specific lines can sometimes be caused 'upstream'. I think we may have been lucky this time.

thanks workedlike a charm...

but what about this

Warning: unlink(../banners/1337667558_dell_logo_text_sm.gif/) [function.unlink]: No such file or directory in /home/content/73/9352073/html/siteadmin/delete_banner.php on line 9

Warning: Cannot modify header information - headers already sent by (output started at /home/content/73/9352073/html/siteadmin/delete_banner.php:9) in /home/content/73/9352073/html/siteadmin/delete_banner.php on line 14

here are the files

delere_banner.php

<?
require_once("../conn.php");
require_once("access.php");

$q1 = "select * from class_banners where BannerID = '$_GET[id]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

unlink("../banners/$a1[BannerFile]/");

$q1 = "delete from class_banners where BannerID = '$_GET[id]' ";
mysql_query($q1) or die(mysql_error());

header("location:banners.php");

exit();

?>

any idea where the error lies it is still in the directory structure nomenclature correct?

Are you trying to delete a file or a folder ? For folders you need to use rmdir. If it is a file, remove the last slash.

thanks.. it was a file the problem was where the add_banner page was creating the image store directory and the location noted delete image file directory were differnt.

a new problem just croped up though

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 38

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 38

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 38

Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 38

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 39

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 39

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 39

Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/includes.php on line 39

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /home/content/73/9352073/html/includes.php on line 41

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/info.php on line 59

Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /home/content/73/9352073/html/info.php on line 60

this is happening in a script that creates a membership timelimit

<?
require_once("conn.php");

//get the settings
$qset = "select * from class_settings";
$rset = mysql_query($qset) or die(mysql_error());
$aset = mysql_fetch_array($rset);

//delete the expire listings
$q1 = "select * from class_catalog where DateExp <= '$t' ";
$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) > '0')
{
    while($a1 = mysql_fetch_array($r1))
    {
        if(!empty($a1[images]))
        {
            $MyImages = explode("|", $a1[images]);

            while(list(,$v) = each($MyImages))
            {
                unlink("images/$v");
            }
        }

        $DelID[] = $a1[ProductID];
    }

    $DelStr = implode("', '", $DelID);

    $q1 = "delete from class_catalog where ProductID in ('$DelStr') ";
    mysql_query($q1) or die(mysql_error());
}


***//notify a member that his account will expire after 5 days
$after5_1 = mktime(0,0,0,date(m),date(d) + 5,date(Y));
$after5_2 = mktime(23,59,59,date(m),date(d) + 5,date(Y));***

if(mysql_num_rows($rexp) > '0')
{
    while($aexp = mysql_fetch_array($rexp))
    {
        $ExpID[] = $aexp[MemberID];

        //send an email
        $to = $aexp[email];
        $subject = "5 days to the Expiration Date";
        $message = "Hello $aexp[FirstName] $aexp[LastName],\nThere are only 5 days to your account expiration date. To save your account, you need to login, click at \"Your account\" and follow the \"Renew account\" link.\n\nUsername: $a2[username]\nPassword: $a2[password]\n\nTo login, follow this link:\nhttp://$_SERVER[HTTP_HOST]/login.php\n\nThank you!";

        $headers = "MIME-Version: 1.0\n"; 
        $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
        $headers .= "Content-Transfer-Encoding: 8bit\n"; 
        $headers .= "From: $_SERVER[HTTP_HOST] <$aset[ContactEmail]>\n"; 
        $headers .= "X-Priority: 1\n"; 
        $headers .= "X-MSMail-Priority: High\n"; 
        $headers .= "X-Mailer: PHP/" . phpversion()."\n"; 

        mail($to, $subject, $message, $headers);

    }

    $IDstr = implode("', '", $ExpID);
    $qexp2 = "update class_members set notified = 'y' where MemberID in ('$IDstr') ";
    mysql_query($qexp2) or die(mysql_error());
}

if(!empty($_SESSION[MemberID]))
{
    $LogoutLink = " | <a class=BlackLink href=\"logout.php\">Logout</a>";

    if(preg_match("/index.php/", $_SERVER[SCRIPT_NAME]))
    {
        $WelcomeMessage = nl2br($aset[message])."<br><hr width=\"100%\" size=1 color=dddddd>";
    }
}

?>

it is hapening in the mktime statments on lines 38 etc. where should i insety a set_time_zone statement?

At the top of the script. But the easier way, would be to set a default timezone in your php.ini

thanks your awesome

last error ive been able to generate while testing is this on the same includes.php file
Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /home/content/73/9352073/html/includes.php on line 42

here is the code in qestion

if(mysql_num_rows($rexp) > '0')
{

you can seee the rest of the file above. im trying to produce a response when there is no time left on the membership what have i done wrong in the syntax

Thanks

Show some more code before that.

here it is

<? date_default_timezone_set('America/Los_Angeles'); ?>
<?
require_once("conn.php");

//get the settings
$qset = "select * from class_settings";
$rset = mysql_query($qset) or die(mysql_error());
$aset = mysql_fetch_array($rset);

//delete the expire listings
$q1 = "select * from class_catalog where DateExp <= '$t' ";
$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) > '0')
{
    while($a1 = mysql_fetch_array($r1))
    {
        if(!empty($a1[images]))
        {
            $MyImages = explode("|", $a1[images]);

            while(list(,$v) = each($MyImages))
            {
                unlink("images/$v");
            }
        }

        $DelID[] = $a1[ProductID];
    }

    $DelStr = implode("', '", $DelID);

    $q1 = "delete from class_catalog where ProductID in ('$DelStr') ";
    mysql_query($q1) or die(mysql_error());
}


//notify a member that his account will expire after 5 days
$after5_1 = mktime(0,0,0,date(m),date(d) + 5,date(Y));
$after5_2 = mktime(23,59,59,date(m),date(d) + 5,date(Y));

if(mysql_num_rows($rexp) > '0')
{
    while($aexp = mysql_fetch_array($rexp))
    {
        $ExpID[] = $aexp[MemberID];

        //send an email
        $to = $aexp[email];
        $subject = "5 days to the Expiration Date";
        $message = "Hello $aexp[FirstName] $aexp[LastName],\nThere are only 5 days to your account expiration date. To save your account, you need to login, click at \"Your account\" and follow the \"Renew account\" link.\n\nUsername: $a2[username]\nPassword: $a2[password]\n\nTo login, follow this link:\nhttp://$_SERVER[HTTP_HOST]/login.php\n\nThank you!";

        $headers = "MIME-Version: 1.0\n"; 
        $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
        $headers .= "Content-Transfer-Encoding: 8bit\n"; 
        $headers .= "From: $_SERVER[HTTP_HOST] <$aset[ContactEmail]>\n"; 
        $headers .= "X-Priority: 1\n"; 
        $headers .= "X-MSMail-Priority: High\n"; 
        $headers .= "X-Mailer: PHP/" . phpversion()."\n"; 

        mail($to, $subject, $message, $headers);

    }

    $IDstr = implode("', '", $ExpID);
    $qexp2 = "update class_members set notified = 'y' where MemberID in ('$IDstr') ";
    mysql_query($qexp2) or die(mysql_error());
}

if(!empty($_SESSION[MemberID]))
{
    $LogoutLink = " | <a class=BlackLink href=\"logout.php\">Logout</a>";

    if(preg_match("/index.php/", $_SERVER[SCRIPT_NAME]))
    {
        $WelcomeMessage = nl2br($aset[message])."<br><hr width=\"100%\" size=1 color=dddddd>";
    }
}

?>

$rexp is never given a value. It should be a result from a query.

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.