PHP countdown ticker

Can someone help me please? Client wants to move their hosting to my account, however there is a PHP countdown ticker that counts down to the next game. The database is hidden, and the company its hosted with went out of business and changed hands twice and the new company refuses to respond to our inquiry. I do have the ticker PHP and corresponding javascript file. I will post here, but where do I begin with the database? Any help would be greatly appreciated. Thanks

This is the ticker.php file

<? $query = " SELECT DATE_FORMAT( DTTM, '%c/%d/%Y %r' ) as DTM, DTTM as ndate , Opponent FROM game_countdown WHERE DTTM > CURDATE( ) ORDER BY DTTM ASC LIMIT 1 "; $db->execute($query); $db->move_cursor(0); @extract($db->get_results()); ?>
<script language="javascript">
    var cd1 = new countdown('cd1');
    cd1.TargetDate        = "<?=$DTM ?>";        
</script>
<?=$Opponent?> : <?=date("n/d g:i A",strtotime($ndate))?>

Here is the corresponding JS file

function countdown(obj)
{
this.obj = obj;
this.TargetDate = “12/31/2020 5:00 AM”;
this.CountActive = true;

this.DisplayStr;

this.Calcage        = cd_CalcTime;
this.CountBack        = cd_CountBack;
this.Setup        = cd_Setup;

}

function cd_CalcTime(secs, num1, num2)
{
s = ((Math.floor(secs/num1))%num2).toString();
if (s.length < 2) s = “0” + s;
return (s);
}
function cd_CountBack(secs)
{
document.getElementById(‘day’).innerHTML = this.Calcage(secs,86400,100000);
document.getElementById(‘hour’).innerHTML = this.Calcage(secs,3600,24);
document.getElementById(‘min’).innerHTML = this.Calcage(secs,60,60);
document.getElementById(‘sec’).innerHTML = this.Calcage(secs,1,60);
if (this.CountActive) setTimeout(this.obj +".CountBack(" + (secs-1) + “)”, 990);
}
function cd_Setup()
{
var dthen = new Date(this.TargetDate);
var dnow = new Date();
ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
this.CountBack(gsecs);
}

There must be a code where a connection to database is established. If this is MySQL, then there must be a call to mysql_connect() and mysql_select_db() functions. Once you find db settings in the script, you can create database/user with the same names as in your script. Then, create table named game_countdown with two fields: DTTM- date field type, and Opponent - text field type.

I am learning on the fly here with PHP and the database. It is indeed a MySQL database. When I emailed the supposed tech support they replied that yes in deed, it is MySQL. Never mind my question and the problems we are having. If I can simply replicate this database, then I can use the existing website without redesigning one. Which I prefer. This site came with an interactive login to change content, which is being a real pain. When I log in with ftp, a bunch of folders pops up, one is httpdocs which contains the site. From there, there are a bunch of PHP files index.php, index_page.php and index_page_original.php. Which one should the domain point to? When I try to load index. php I get these errors, take a look http://www.the-student-abroad.com/index.php

Then when I try index_page.php http://www.the-student-abroad.com/index_page.php the site looks like it is starting to load but get a fatal error, call to a member function or non-object on line 46 of the header.php on line 46 this is the code that is there [b]$db->execute($query);

[/b]

Well, if you read the very first warning message, it is self explanatory:

No such file or directory in /home/content/d/o/b/dobeonguard1/html/student/index.php on line 2

Check the path to the included file zorebo_common.php on line #2 in your index.php and check if this file really exists in specified folder. It looks like the current path is wrong in the index.php.

Thats what I don’t get, the file is actually there and the address is correct.

Here is what is contained on line 2:

include_once($_SERVER[‘DOCUMENT_ROOT’] . “http://www.the-student-abroad.com/lib/zorebo_common.php”);

This path in line 2 is not valid. You’re using weird combination of server’s filesystem path and web path. These two are not the same. Obviously, your line 2 must look like this:

[php]include_once($_SERVER[‘DOCUMENT_ROOT’] . “/student/lib/zorebo_common.php”);
[/php]

Ok, that eliminated that error. I thought I could simply put in the direct path. I am getting this error now.

Fatal error: Call to undefined function: get_content() in /home/content/d/o/b/dobeonguard1/html/student/index.php on line [b]13

This is what appears on line 13 of index.php

$content = get_content($split_url, 0);
[/b]

This error message means that you call the function get_content() that is not defined anywhere in your code. Probably again missing some path or include file where this function is defined.

This isn’t my code, it is someone else’s. What exactly is the get_content($split_url, 0); I will attach the code from index.php and index_page.php maybe there is something I am overlooking. I really, really appreciate your help.

This is index.php

<? include_once($_SERVER['DOCUMENT_ROOT'] . "/student/lib/zorebo_common.php"); $root = $_SERVER['DOCUMENT_ROOT']; $url = $_SERVER['REDIRECT_URL']; $file = $_SERVER['SCRIPT_FILENAME']; $split_url = (explode("/", $url)); // Split URL at forward slash array_shift($split_url); if ($split_url[count($split_url)-1] == "") array_pop($split_url); // if last element is empty, remove if ($url == "/" || $url == "/index.php" || $url == "" || $url == "/home") { $content = get_content($split_url, 0); @extract($content[1]); include("index_page.php"); exit(); } $query = "SELECT category_id FROM content_categories WHERE category_url = '$split_url[0]'"; $db->execute($query); @extract($db->get_results()); if ($content = get_content($split_url, $category_id)) { @extract($content[1]); if ($content_script && file_exists($content_script)) include($content_script); else include("content.php"); exit(); } // IF REAL FILE EXISTS, INCLUDE IT $scripts = array($root.$url, $root.$url.".php", $root.$url.".htm", $root.$url.".html"); foreach ($scripts as $script) { if (file_exists($script) && !is_dir($script)) { include($script); exit(); } } // PAGE OR FILE NOT FOUND ON THE SERVER @extract(check_seo(array())); // Load default meta information include("404.php"); exit(); ?>

This is index_page.php

<? include("header.php"); ?> <? $query = " SELECT content.*, content_revisions.* FROM content LEFT JOIN content_revisions ON content.content_id = content_revisions.content_id WHERE content.content_id = '4' AND content_revisions.revision_published='1' "; $db->execute($query); if ($db->num_rows()) { $row = $db->get_results(); @extract($row); } ?>
        <div id="flash_box">
            <div id="flash">
                <script>get_flash();</script>
            </div>
            <div id="ticker">
            <? include("ticker.php"); ?>
            </div>

        </div>
                                    
        <div id="title_area">
            <div id="title_left"></div>            
            <div id="title_right"><span class="main_title"><?=$revision_title;?></span></div>            
        </div>
                            
        <div id="content_wrapper">
            <? include_once("photo_nav.php"); ?>
            <div id="content">
                <?=$revision_content;?>
            </div>
                    
            <div id="sponsors_wrapper">
                <div id="pac_7" align="center">                    
                    <a href="/pac7"><img src="images/helmets.jpg" border="0"></a>
                    <!-- <a href="/pac7">For more information about the Principal Athletic Conference (PAC-7), Click Here</a> --!>
                    <a href="http://www.ohiohelmetproject.com">Helmet artwork was provided by www.ohiohelmetproject.com</a>                        
                </div>    
            </div>
                
        </div>
<? include("footer.php"); ?>

Probably some part of code is missing. Try to search within .php files what you have for: get_content

I have a content.php file.

Here is the code on content.php

<? include_once($_SERVER['DOCUMENT_ROOT'] . "/student/lib/zorebo_common.php"); include_once("header.php"); ?>
        <div id="title_area">
            <div id="title_left_2"></div>            
            <div id="title_right"><span class="main_title"><?=$revision_title;?></span></div>            
        </div>
                            
        <div id="content_wrapper">
            <? include_once("left_images.php"); ?>
            <div id="content">
                <?=$revision_content;?>
            </div>                
            
            <div id="sponsors_wrapper">
                <div id="pac_7" align="center">                    
                    <a href="/pac7"><img src="images/helmets.jpg" border="0"></a>
                    <!-- <a href="/pac7">For more information about the Principal Athletic Conference (PAC-7), Click Here</a> --!>
                    <a href="http://www.ohiohelmetproject.com">Helmet artwork was provided by www.ohiohelmetproject.com</a>                        
                </div>    
            </div>
        </div>
<? include_once("footer.php"); ?>

Here is index_page.php

<? include("header.php"); ?> <? $query = " SELECT content.*, content_revisions.* FROM content LEFT JOIN content_revisions ON content.content_id = content_revisions.content_id WHERE content.content_id = '4' AND content_revisions.revision_published='1' "; $db->execute($query); if ($db->num_rows()) { $row = $db->get_results(); @extract($row); } ?>
        <div id="flash_box">
            <div id="flash">
                <script>get_flash();</script>
            </div>
            <div id="ticker">
            <? include("ticker.php"); ?>
            </div>

        </div>
                                    
        <div id="title_area">
            <div id="title_left"></div>            
            <div id="title_right"><span class="main_title"><?=$revision_title;?></span></div>            
        </div>
                            
        <div id="content_wrapper">
            <? include_once("photo_nav.php"); ?>
            <div id="content">
                <?=$revision_content;?>
            </div>
                    
            <div id="sponsors_wrapper">
                <div id="pac_7" align="center">                    
                    <a href="/pac7"><img src="images/helmets.jpg" border="0"></a>
                    <!-- <a href="/pac7">For more information about the Principal Athletic Conference (PAC-7), Click Here</a> --!>
                    <a href="http://www.ohiohelmetproject.com">Helmet artwork was provided by www.ohiohelmetproject.com</a>                        
                </div>    
            </div>
                
        </div>
<? include("footer.php"); ?>

I am also getting this error in reference to the content page

Fatal error: Call to a member function on a non-object in /home/content/d/o/b/dobeonguard1/html/student/header.php on line [b]46

This is what is contained on line 46 and 47 of header.php

$db->execute($query);
while($row = $db->get_results()) {
[/b]

Regardless of the errors. Can someone please look at my original post, and using that code that is present for the countdown ticker with the javascript file, please point me in the right direction to create a database to get that script running. Where do I begin?

Can anyone please help me with this?

Sponsor our Newsletter | Privacy Policy | Terms of Service