Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2006
    Posts
    450
    Tokens
    0

    Default Help me - Im Tired. ;[

    Im really tired and i cant spot the error >.<

    tut_management.php:

    PHP Code:
    <?
    include("config.php");
    include(
    "ubb.php");
    include(
    "lockedadmin.php");
    switch(
    $_GET[func])
    {
    default:

    $pendingtut mysql_query("select * from tutorials where active = 'no'");
    $pendingtut mysql_num_rows($pendingtut);
    ?>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
      <tr>
        <td width="100%" bgcolor="#E3E3E3"><font face="Verdana" size="1"><b>Tutorial 
        Management</b></font></td>
      </tr>
      <tr>
        <td width="100%"><font face="Verdana" size="1">
        <a style="text-decoration: none" href="?view=tut&func=write">
        <font color="#000000">Write Tutorial</font></a> ·
        <a style="text-decoration: none" href="?view=tut&func=approve">
        <font color="#000000">Approve Tutorials</font></a> ·
        <a style="text-decoration: none" href="?view=tut&func=edit">
        <font color="#000000">Edit Tutorials</font></a> ·
        <a style="text-decoration: none" href="?view=tut&func=delete">
        <font color="#000000">Delete Tutorials</font></a></font></td>
      </tr>
    </table>

    <?
    break;

    case 
    'write':
    if (!
    $_POST[add])
    {
    echo(
    "<font face=\"Verdana\" size=\"1\"><b>Please full out the form</b><br><br><form method=\"post\" style=\"margin: 0xp;\">
    Tutorial Title<br>
    <input type=\"text\" name=\"title\" style=\"border: 1px solid #808080; background-color: #efefef; font-family:Verdana; font-size:10px\" size=\"30\" /><br><br>
    Tutorial Description<br>
    <input type=\"text\" name=\"desc\" style=\"border: 1px solid #808080; background-color: #efefef; font-family:Verdana; font-size:10px\" size=\"30\" /><br><br>
    Tutorial Category:<br>
    <select size=\"1\" style=\"background-color: #efefef; font-family:Verdana; font-size:10px\" name=\"cat\">
    "
    );
    $getcats mysql_query("select * from tutcat order by id asc");
    while (
    $cats mysql_fetch_array($getcats))
    {
    echo(
    "
    <option value=\"
    $cats[id]\">$cats[title]</option>");
    }
    echo(
    "
    </select><br><br>
    Tutorial Text<br>
    <textarea cols=\"53\" rows=\"12\" name=\"body\" style=\"font-family: Verdana; font-size: 10px; border: 1px solid #808080; background-color: #efefef;\"></textarea>
    <br><br>
    <input type=\"submit\" value=\"Add Tutorial\" name=\"add\" style=\"border: 1px solid #808080; background-color: #e6e6e6; font-family:Verdana; font-size:10px; width:96;\" />
    </form>"
    );
    }
    else
    {
    $insert mysql_query("INSERT INTO `tutorials` ( `id` , `title` , `cat` , `text` , `author` , `views` , `desc` , `active` )
    VALUES (
    '', '
    $_POST[title]', '$_POST[cat]', '$_POST[body]', '$logged[username]', '2', '$_POST[desc]', 'yes'
    )"
    );
    echo(
    "<font face=\"Verdana\" size=\"1\">Tutorial has been added to the site.");
    }
    break;

    case 
    'edit':
    if(
    $_GET[id])
    {
    $gettutorial mysql_query("Select * from tutorials where id = '$_GET[id]'");
    $ifexists mysql_num_rows($gettutorial);
    if(
    $ifexists == 0)
    {
    echo(
    "<font face=\"Verdana\" size=\"1\">Invalid Tutorial");
    }
    else
    {
    if (!
    $_POST[add])
    {
    $tutorial mysql_fetch_array($gettutorial);

    echo(
    "<font face=\"Verdana\" size=\"1\"><form method=\"post\" style=\"margin: 0xp;\">
    Tutorial Title<br>
    <input value=\"
    $tutorial[title]\" type=\"text\" name=\"title\" style=\"border: 1px solid #808080; background-color: #efefef; font-family:Verdana; font-size:10px\" size=\"30\" /><br><br>
    Tutorial Description<br>
    <input value=\"
    $tutorial[desc]\" type=\"text\" name=\"desc\" style=\"border: 1px solid #808080; background-color: #efefef; font-family:Verdana; font-size:10px\" size=\"30\" /><br><br>
    Tutorial Category<br>
    <select size=\"1\" style=\"background-color: #efefef; font-family:Verdana; font-size:10px\" name=\"cat\">
    "
    );
    $getcats mysql_query("select * from tutcat order by id asc");
    while (
    $cats mysql_fetch_array($getcats))
    {
    echo(
    "<option value=\"$cats[id]\"");
    if(
    $cats[id] == $tutorial[cat])
    {
    echo(
    " selected");
    }
    echo(
    ">$cats[title]</option>");
    }
    echo(
    "
    </select><br><br>
    Tutorial Text<br>
    <textarea cols=\"53\" rows=\"12\" name=\"body\" style=\"font-family: Verdana; font-size: 10px; border: 1px solid #808080; background-color: #efefef;\">
    $tutorial[text]</textarea><br><br>
    <input type=\"submit\" value=\"Update Tutorial\" name=\"add\" style=\"border: 1px solid #808080; background-color: #e6e6e6; font-family:Verdana; font-size:10px; width:96;\" /></dd>
    </dl>
    </form>"
    );
    }
    else
    {
    $update mysql_query("update tutorials set `title` = '$_POST[title]', `cat` = '$_POST[cat]', `desc` = '$_POST[desc]', `text` = '$_POST[body]' where id = '$_GET[id]'");
    echo(
    "<font face=\"Verdana\" size=\"1\">The tutorial has been updated.");
    }
    }}
    else
    {
    $select mysql_query("Select * from tutcat order by 'id' asc");
    $catnum 0;
    while(
    $cats mysql_fetch_array($select))
    {
    if(
    $catnum != 0)
    {
    echo(
    "<br />");
    }
    echo(
    "<font face=\"Verdana\" size=\"1\"><b>$cats[title]</b>");
    $gettuts mysql_query("select * from tutorials where cat = '$cats[id]' order by 'id' asc");
    while(
    $tuts mysql_fetch_array($gettuts))
    {
    echo(
    "<br /><font face=\"Verdana\" size=\"1\"><a href=\"?view=admin&admin=tutorials&func=edit&id=$tuts[id]\">$tuts[title]</a>");
    }
    $catnum $catnum+1;
    }
    }
    break;

    case 
    'approve':
    if(
    $_GET[id])
    {
    $select mysql_query("Select * from tutorials where id = '$_GET[id]'");
    $select mysql_fetch_array($select);
    $update mysql_query("update tutorials set active = 'yes' where id = '$_GET[id]'");
    $send mysql_query("INSERT INTO `pmessages` ( `title` , `message` , 
    `touser` , `from` , `unread` , 
    `date` ) VALUES ('Tutorial Approved', 'Your tutorial has been approved by a member of our Tutorial Staff, thankyou for submitting it.<br><br><b>This message is automated</b>!', '
    $select[author]', 
    '
    $logged[username]', 'unread', NOW())");
    echo(
    "<font face=\"Verdana\" size=\"1\">The tutorial you selected has been approved");
    }
    else
    {
    $gettuts mysql_query("select * from tutorials where active = 'no'");
    $n 0;
    while(
    $tuts mysql_fetch_array($gettuts))
    {
    if(
    $n != 0)
    {
    echo(
    "<br />");
    }
    echo(
    "<font face=\"Verdana\" size=\"1\"><a href=\"http://www.pixelresources.co.uk/index.php?view=tutorials&act=tutorial&id=$tuts[id]\">$tuts[title]</a> - <a href=\"?view=admin&admin=tutorials&func=approve&id=$tuts[id]\">Approve This tutorial</a><br />");
    }
    break;

    case 
    'delete':
    if(
    $_GET[id])
    {
    $delete mysql_query("delete from tutorials where id = '$_GET[id]'");
    $delete mysql_query("delete from tutcomments where tut = '$_GET[id]'");
    echo(
    "<font face=\"Verdana\" size=\"1\">The tutorial you selected has been deleted");
    }
    else
    {
    $select mysql_query("Select * from tutcat order by 'id' asc");
    $catnum 0;
    while(
    $cats mysql_fetch_array($select))
    {
    if(
    $catnum != 0)
    {
    echo(
    "<br />");
    }
    echo(
    "<font face=\"Verdana\" size=\"1\"><b>$cats[title]</b>");
    $gettuts mysql_query("select * from tutorials where cat = '$cats[id]' order by 'id' asc");
    while(
    $tuts mysql_fetch_array($gettuts))
    {
    echo(
    "<font face=\"Verdana\" size=\"1\"><br /><a href=\"?view=admin&admin=delete&id=$tuts[id]\">$tuts[title]</a>");
    }
    $catnum $catnum+1;
    }
    }
    break;

    ?>
    >.<

  2. #2
    Join Date
    Sep 2006
    Posts
    450
    Tokens
    0

    Default

    Update - Fixed

  3. #3
    Join Date
    Sep 2006
    Location
    Doncaster, UK
    Posts
    574
    Tokens
    0

    Default

    Ich suggests going to sleep.

    Or Horlicks.
    Cheesecake.

  4. #4
    Join Date
    Sep 2006
    Posts
    450
    Tokens
    0

    Default

    Nein, nicht schlafe danke.

  5. #5
    Join Date
    Sep 2006
    Location
    Doncaster, UK
    Posts
    574
    Tokens
    0

    Default

    Gees, that's bad grammatical german.

    Nein, ich nicht werde schlafe.
    Cheesecake.

  6. #6
    Join Date
    Sep 2006
    Posts
    450
    Tokens
    0

    Default

    Imrubbish at deautch :{

  7. #7
    Join Date
    May 2006
    Location
    Huntingdon (Cambridgeshire UK)
    Posts
    3,395
    Tokens
    0

    Latest Awards:

    Default

    Yar, Ich bin Dan.

Posting Permissions

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