Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2006
    Location
    Merseyside
    Posts
    2,335
    Tokens
    0

    Latest Awards:

    Default Timetable Problem

    Im having a few timetable problems Can you help?

    Im getting this error:
    PHP Code:
    Fatal error:  Call to undefined function:  anti_hack() in /home/blagos/public_html/users/mod/timetable.php on line 55 
    When I remove it to make the timetable work it doesnt book slots Can you help, if so thanks

    Heres the timetable code:
    PHP Code:
    <?php
    ob_start
    (); # Allows Cookies 
    include("config.php"); # Includes Your Configuration File 
    include("funcs.php");
    if(
    $logged[username] && $logged[level] == 11 OR $logged[level] == 12# If Logged In AND Level 5 

    if(
    $_GET["action"] == "book")
    {
        
    $day $_GET["date"];
        
    $time $_GET["slot"];
        
        
    $worked mysql_fetch_array(mysql_query("SELECT `$time` FROM `timetable` WHERE `day`='$day'"));
        if(
    $worked[$time] != "")
        {
            
    header("Location: ?date=$day");
        }
        else
        {
            
    mysql_query("UPDATE `timetable` SET `$time`='{$logged[username]}' WHERE `day`='$day'");
        }
        
    header("Location: ?date=$day");
    }
    elseif(
    $_GET["action"] == "unbook")
    {
        
    $day $_GET["date"];
        
    $time $_GET["slot"];

        
    $worked mysql_fetch_array(mysql_query("SELECT `$time` FROM `timetable` WHERE `day`='$day'"));

        
    $split explode(";"$worked[$time]);
        if(
    $split[0] == "Enumeric" and $logged[username] != "Enumeric")
        {
            
    header("Location: $PHP_SELF?day=$day");
        }
        if(
    $split[0] == $logged[username] or $logged[level] == "12")
        {
            
    mysql_query("UPDATE `timetable` SET `$time`='' WHERE `day`='$day'");
        }
        
    header("Location: $PHP_SELF?date=$day");
    }
    elseif(
    $_GET["action"] == "clear")
    {
        
    $day anti_hack($_GET["date"]);
            
    mysql_query("UPDATE `timetable` SET `1`='', `2`='', `3`='', `4`='', `5`='', `6`='', `7`='', `8`='', `9`='', `10`='', `11`='', `12`='', `13`='', `14`='', `15`='', `16`='', `17`='', `18`='', `19`='', `20`='', `21`='', `22`='', `23`='', `24`='' WHERE `day`='$day'");
            
    header("Location: $PHP_SELF?date=$_GET[date]");
    }
    else
    {
        if(
    $_GET["date"] == "")
        {
    $day date("l");
        }
        else
        {
        
    $day anti_hack($_GET["date"]);
        }
        
    $time mysql_fetch_array(mysql_query("SELECT * FROM `timetable` WHERE `day` = '$day'"));
        if(
    $time["1"] == "")
        { 
    $one "<a href=\"?action=book&date=$day&slot=1\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["1"] or $time["1"] != "" and $logged[level] == "12")
        { 
    $one "<a href=\"?action=unbook&date=$day&slot=1\">{$time["1"]} (Unbook)</a>"; }
        else
        { 
    $one "{$time["1"]}"; }
        
        if(
    $time["2"] == "")
        { 
    $two "<a href=\"?action=book&date=$day&slot=2\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["2"] or $time["2"] != "" and $logged[level] == "12")
        { 
    $two "<a href=\"?action=unbook&date=$day&slot=2\">{$time["2"]} (Unbook)</a>"; }
        else
        { 
    $two "{$time["2"]}"; }
        
        if(
    $time["3"] == "")
        { 
    $three "<a href=\"?action=book&date=$day&slot=3\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["3"] or $time["3"] != "" and $logged[level] == "12")
        { 
    $three "<a href=\"?action=unbook&date=$day&slot=3\">{$time["3"]} (Unbook)</a>"; }
        else
        { 
    $three "{$time["3"]}"; }
        
        if(
    $time["4"] == "")
        { 
    $four "<a href=\"?action=book&date=$day&slot=4\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["4"] or $time["4"] != "" and $logged[level] == "12")
        { 
    $four "<a href=\"?action=unbook&date=$day&slot=4\">{$time["4"]} (Unbook)</a>"; }
        else
        { 
    $four "{$time["4"]}"; }
        
        if(
    $time["5"] == "")
        { 
    $five "<a href=\"?action=book&date=$day&slot=5\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["5"] or $time["5"] != "" and $logged[level] == "12")
        { 
    $five "<a href=\"?action=unbook&date=$day&slot=5\">{$time["5"]} (Unbook)</a>"; }
        else
        { 
    $five "{$time["5"]}"; }
        
        if(
    $time["6"] == "")
        { 
    $six "<a href=\"?action=book&date=$day&slot=6\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["6"] or $time["6"] != "" and $logged[level] == "12")
        { 
    $six "<a href=\"?action=unbook&date=$day&slot=6\">{$time["6"]} (Unbook)</a>"; }
        else
        { 
    $six "{$time["6"]}"; }
        
        if(
    $time["7"] == "")
        { 
    $seven "<a href=\"?action=book&date=$day&slot=7\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["7"] or $time["7"] != "" and $logged[level] == "12")
        { 
    $seven "<a href=\"?action=unbook&date=$day&slot=7\">{$time["7"]} (Unbook)</a>"; }
        else
        { 
    $seven "{$time["7"]}"; }
        
        if(
    $time["8"] == "")
        { 
    $eight "<a href=\"?action=book&date=$day&slot=8\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["8"] or $time["8"] != "" and $logged[level] == "12")
        { 
    $eight "<a href=\"?action=unbook&date=$day&slot=8\">{$time["8"]} (Unbook)</a>"; }
        else
        { 
    $eight "{$time["8"]}"; }
        
        if(
    $time["9"] == "")
        { 
    $nine "<a href=\"?action=book&date=$day&slot=9\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["9"] or $time["9"] != "" and $logged[level] == "12")
        { 
    $nine "<a href=\"?action=unbook&date=$day&slot=9\">{$time["9"]} (Unbook)</a>"; }
        else
        { 
    $nine "{$time["9"]}"; }
        
        if(
    $time["10"] == "")
        { 
    $ten "<a href=\"?action=book&date=$day&slot=10\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["10"] or $time["10"] != "" and $logged[level] == "12")
        { 
    $ten "<a href=\"?action=unbook&date=$day&slot=10\">{$time["10"]} (Unbook)</a>"; }
        else
        { 
    $ten "{$time["10"]}"; }
        
        if(
    $time["11"] == "")
        { 
    $eleven "<a href=\"?action=book&date=$day&slot=11\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["11"] or $time["11"] != "" and $logged[level] == "12")
        { 
    $eleven "<a href=\"?action=unbook&date=$day&slot=11\">{$time["11"]} (Unbook)</a>"; }
        else
        { 
    $eleven "{$time["11"]}"; }
        
        if(
    $time["12"] == "")
        { 
    $twelve "<a href=\"?action=book&date=$day&slot=12\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["12"] or $time["12"] != "" and $logged[level] == "12")
        { 
    $twelve "<a href=\"?action=unbook&date=$day&slot=12\">{$time["12"]} (Unbook)</a>"; }
        else
        { 
    $twelve "{$time["12"]}"; }
        
        if(
    $time["13"] == "")
        { 
    $thirteen "<a href=\"?action=book&date=$day&slot=13\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["13"] or $time["13"] != "" and $logged[level] == "12")
        { 
    $thirteen "<a href=\"?action=unbook&date=$day&slot=13\">{$time["13"]} (Unbook)</a>"; }
        else
        { 
    $thirteen "{$time["13"]}"; }
        
        if(
    $time["14"] == "")
        { 
    $fourteen "<a href=\"?action=book&date=$day&slot=14\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["14"] or $time["14"] != "" and $logged[level] == "12")
        { 
    $fourteen "<a href=\"?action=unbook&date=$day&slot=14\">{$time["14"]} (Unbook)</a>"; }
        else
        { 
    $fourteen "{$time["14"]}"; }
        
        if(
    $time["15"] == "")
        { 
    $fifteen "<a href=\"?action=book&date=$day&slot=15\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["15"] or $time["15"] != "" and $logged[level] == "12")
        { 
    $fifteen "<a href=\"?action=unbook&date=$day&slot=15\">{$time["15"]} (Unbook)</a>"; }
        else
        { 
    $fifteen "{$time["15"]}"; }
        
        if(
    $time["16"] == "")
        { 
    $sixteen "<a href=\"?action=book&date=$day&slot=16\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["16"] or $time["16"] != "" and $logged[level] == "12")
        { 
    $sixteen "<a href=\"?action=unbook&date=$day&slot=16\">{$time["16"]} (Unbook)</a>"; }
        else
        { 
    $sixteen "{$time["16"]}"; }
        
        if(
    $time["17"] == "")
        { 
    $seventeen "<a href=\"?action=book&date=$day&slot=17\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["17"] or $time["17"] != "" and $logged[level] == "12")
        { 
    $seventeen "<a href=\"?action=unbook&date=$day&slot=17\">{$time["17"]} (Unbook)</a>"; }
        else
        { 
    $seventeen "{$time["17"]}"; }
        
        if(
    $time["18"] == "")
        { 
    $eighteen "<a href=\"?action=book&date=$day&slot=18\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["18"] or $time["18"] != "" and $logged[level] == "12")
        { 
    $eighteen "<a href=\"?action=unbook&date=$day&slot=18\">{$time["18"]} (Unbook)</a>"; }
        else
        { 
    $eighteen "{$time["18"]}"; }
        
        if(
    $time["19"] == "")
        { 
    $nineteen "<a href=\"?action=book&date=$day&slot=19\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["19"] or $time["19"] != "" and $logged[level] == "12")
        { 
    $nineteen "<a href=\"?action=unbook&date=$day&slot=19\">{$time["19"]} (Unbook)</a>"; }
        else
        { 
    $nineteen "{$time["19"]}"; }
        
        if(
    $time["20"] == "")
        { 
    $twenty "<a href=\"?action=book&date=$day&slot=20\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["20"] or $time["20"] != "" and $logged[level] == "12")
        { 
    $twenty "<a href=\"?action=unbook&date=$day&slot=20\">{$time["20"]} (Unbook)</a>"; }
        else
        { 
    $twenty "{$time["20"]}"; }

        if(
    $time["21"] == "")
        { 
    $twentyone "<a href=\"?action=book&date=$day&slot=21\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["21"] or $time["21"] != "" and $logged[level] == "12")
        { 
    $twentyone "<a href=\"?action=unbook&date=$day&slot=21\">{$time["21"]} (Unbook)</a>"; }
        else
        { 
    $twentyone "{$time["21"]}"; }
        
        if(
    $time["22"] == "")
        { 
    $twentytwo "<a href=\"?action=book&date=$day&slot=22\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["22"] or $time["22"] != "" and $logged[level] == "12")
        { 
    $twentytwo "<a href=\"?action=unbook&date=$day&slot=22\">{$time["22"]} (Unbook)</a>"; }
        else
        { 
    $twentytwo "{$time["22"]}"; }
        
        if(
    $time["23"] == "")
        { 
    $twentythree "<a href=\"?action=book&date=$day&slot=23\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["23"] or $time["23"] != "" and $logged[level] == "12")
        { 
    $twentythree "<a href=\"?action=unbook&date=$day&slot=23\">{$time["23"]} (Unbook)</a>"; }
        else
        { 
    $twentythree "{$time["23"]}"; }
        
        if(
    $time["24"] == "")
        { 
    $twentyfour "<a href=\"?action=book&date=$day&slot=24\">BOOK THIS SLOT</a>"; }
        elseif(
    $logged[username] == $time["24"] or $time["24"] != "" and $logged[level] == "12")
        { 
    $twentyfour "<a href=\"?action=unbook&date=$day&slot=24\">{$time["24"]} (Unbook)</a>"; }
        else
        { 
    $twentyfour "{$time["24"]}"; }
        echo 
    "
    <link href=\"content.css\" rel=\"stylesheet\" type=\"text/css\">
    <span class=\"title\">The Timetable</span><br>
    <span class=\"desc\">BOOK now to avoid disappointment!</span><br><br>
    You are currently viewing "
    ;
    if(
    $_GET["date"] == "")
        {
            
    $day date("l");
        }
        else
        {
            
    $day anti_hack($_GET["date"]);
        }
        echo 
    "$day";
        echo
    "<br>Book your slots now ;o<br><br>
         <hr align=\"left\" size=\"1\">
         <center>
    <a href=\"?date=Monday\">Monday</a> | <a href=\"?date=Tuesday\">Tuesday</a> | <a href=\"?date=Wednesday\">Wednesday</a> | <a href=\"?date=Thursday\">Thursday</a> | <a href=\"?date=Friday\">Friday</a> | <a href=\"?date=Saturday\">Saturday</a> | <a href=\"?date=Sunday\">Sunday</a> |
        </center>
        <hr align=\"left\" size=\"1\">

    <div align=\"center\">

    <table border=\"0\">
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">Time</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">Moderator Booked</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">00:01 - 01:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $one</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">01:01 - 02:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $two</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">02:01 - 03:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $three</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">03:01 - 04:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $four</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">04:01 - 05:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $five</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">05:01 - 06:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $six</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">06:01 - 07:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $seven</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">07:01 - 08:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $eight</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">08:01 - 09:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $nine</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">09:01 - 10:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $ten</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">10:01 - 11:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $eleven</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">11:01 - 12:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $twelve</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">12:01 - 13:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $thirteen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">13:01 - 14:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $fourteen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">14:01 - 15:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $fifteen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">15:01 - 16:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $sixteen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">16:01 - 17:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $seventeen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">17:01 - 18:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $eighteen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">18:01 - 19:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $nineteen</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">19:01 - 20:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $twenty</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">20:01 - 21:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $twentyone</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">21:01 - 22:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $twentytwo</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">22:01 - 23:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $twentythree</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">23:01 - 00:00</td>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $twentyfour</td>
        </tr>
        <tr>
            <td height=\"9\" width=\"150\">
            <p align=\"center\">
    $day</td>
            <td height=\"9\" width=\"150\">
            "
    ;?> <?php if ($logged[level] == "12")
            { echo(
    "<p align=\"center\"><a href=\"?action=clear&date=$day\">CLEAR TODAY</a>");} ?> <?php echo("</td>
        </tr>
    </table>
    </div>
    "
    );
    }
    } else { 
    # User Isn't Logged In Or Level 5 
    echo("You Are Not Logged In Or Level 5"); # Shows Message 
    }
    ?>

  2. #2
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    You need include the file which has the function 'anti_hack()' defined within it, or if there isn't such a file, define it yourself in that file. Presumably it's in 'funcs.php'?
    kinda quit.

  3. #3
    Join Date
    Oct 2006
    Location
    Merseyside
    Posts
    2,335
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    ob_start
    ();
    function 
    anti_hack($value)
    {
       if(
    get_magic_quotes_gpc()) {
           
    $value stripslashes($value);
       }

       if(!
    is_numeric($value)) {
           
    $value mysql_real_escape_string($value);
       }
       return 
    $value;
    }
    function 
    login()
    {
        if(!isset(
    $logged[username]) || empty($logged[username]) || $_SERVER["REMOTE_ADDR"] != $logged[ip])
        {
            
    session_unset();
            
    session_destroy();
            die(
    "Umm.. gotta login there mate");
        }
    }
       function 
    generateRandStr($length)
       {
          
    $randstr "";
          for(
    $i=0$i<$length$i++)
          {
             
    $randnum mt_rand(0,61);
             if(
    $randnum 10)
                 {
                    
    $randstr .= chr($randnum+48);
                 }
                 else if(
    $randnum 36)
                     {
                        
    $randstr .= chr($randnum+55);
                     }
                     else
                         {
                            
    $randstr .= chr($randnum+61);
                         }
                      }
                  return 
    $randstr;
               }
    ?>
    funcs.php sorry

  4. #4
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    ill release a fixed one today or tommorow

    It messes up cause its a terd.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •