[PHP] News System

Page 1 of 3 123 LastLast
Results 1 to 15 of 34
  1. #1
    Apprentice xGlast is offline
    MemberRank
    Jun 2010 Join Date
    9Posts
    Last edited by xGlast; 12-08-10 at 10:58 AM.


  2. #2
    Apprentice xiDax is offline
    MemberRank
    Jul 2010 Join Date
    6Posts

    Re: [PHP] News System

    Yaii thanks Bro for put Credits :)
    +1

  3. #3
    Account Upgraded | Title Enabled! Treachery is offline
    MemberRank
    Apr 2010 Join Date
    CaliforniaLocation
    363Posts

    Re: [PHP] News System

    You might want to make a backend script so the staff can post messages easier, as no one really wants to open SQL Management Studio every time they want to post a new message.

    Other than that, fairly nice release.

  4. #4
    Apprentice xiDax is offline
    MemberRank
    Jul 2010 Join Date
    6Posts

    information Re: [PHP] News System

    Easy, i am brother of xGlast.
    Here PHP Code to make new:
    PHP Code:
    <?php
    mssql_connect
    ("XXX\SQLEXPRESS""sa""pass");
    mssql_select_db("ACCOUNT_DBF");
    $ip $_SERVER['REMOTE_ADDR'];
    $time date("F j, Y, g:i a");
    echo 
    '
    <form action="add.php?accion=add" method="post">
    <input name="title" value="Title Here" type="text"/><br>
    <input name="external" value="#" type="text"/><br>
    <select name="category">
    <option value="1">News</option>
    <option value="2">Events</option>
    <option value="3">Patch Notes</option>
    </select><br>
    <input name="time" value="'
    .$time.'" type="text" readonly="readonly"/><br>
    <input name="who" value="" type="text"><br>
    <textarea name="content" value="Text here" type="text" width="111" rows="12"/></textarea><br>
    <input size="20" type="submit" value="Submit"/>
    </form>'
    ;
    if(@
    $_GET['accion'] == "add"){
    if(isset(
    $_POST["title"])){
    mssql_select_db("ACCOUNT_DBF");
    mssql_query("INSERT into NEWS_TBL (title,title_url,category,when,who,content,ip,blocked) VALUES ('$_POST[title]','$_POST[external]','$_POST[category]','$_POST[time]','$_POST[who]','$_POST[content]','$ip','no')");
    }
    }
    ?>
    Script Creted by XiDaX

    PD: Sry for me bad English ...
    Last edited by Dell Honne; 11-08-10 at 05:07 PM. Reason: Fix

  5. #5
    Proficient Member nightwolf0022 is offline
    MemberRank
    Nov 2008 Join Date
    182Posts

    Re: [PHP] News System

    nice but its saying error with the add page might want to look in to it D: i know some php but not where i can fix it xD

  6. #6
    Apprentice xiDax is offline
    MemberRank
    Jul 2010 Join Date
    6Posts

    Re: [PHP] News System

    Quote Originally Posted by nightwolf0022 View Post
    nice but its saying error with the add page might want to look in to it D: i know some php but not where i can fix it xD
    Post error here and i fix

  7. #7
    Proficient Member nightwolf0022 is offline
    MemberRank
    Nov 2008 Join Date
    182Posts

    Re: [PHP] News System

    OBJECT NOT FOUND ._. in big letters its looking for add.php but cant find it i changed it to create.php but it wouldnt work. since where on this subject the script to find the database for the news wont show up QQ i hate mssql thats why i made one for mysql xD

    edit: i made the add.php and got this error

    Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'when'. (severity 15) in C:\xampp\htdocs\FFSilence\add.php on line 24

    Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\FFSilence\add.php on line 24
    Last edited by nightwolf0022; 10-08-10 at 09:25 PM.

  8. #8
    Apprentice xiDax is offline
    MemberRank
    Jul 2010 Join Date
    6Posts

    Re: [PHP] News System

    Quote Originally Posted by nightwolf0022 View Post
    OBJECT NOT FOUND ._. in big letters its looking for add.php but cant find it i changed it to create.php but it wouldnt work. since where on this subject the script to find the database for the news wont show up QQ i hate mssql thats why i made one for mysql xD

    edit: i made the add.php and got this error

    Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'when'. (severity 15) in C:\xampp\htdocs\FFSilence\add.php on line 24

    Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\FFSilence\add.php on line 24
    Try the new i putted.
    I dont say it works because i use wamp and u xampp

  9. #9
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: [PHP] News System

    Well. Here goes all the best scripts being released.
    News system - A cool thing for a server to have. Sad it got released to the public.
    Nice release <.<

  10. #10
    Proficient Member nightwolf0022 is offline
    MemberRank
    Nov 2008 Join Date
    182Posts

    Re: [PHP] News System

    Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'when'. (severity 15) in C:\xampp\htdocs\FFSilence\add.php on line 23

    Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\FFSilence\add.php on line 23 tried D: i dunno i think my computer is failing xD

  11. #11
    Apprentice xiDax is offline
    MemberRank
    Jul 2010 Join Date
    6Posts

    Re: [PHP] News System

    Fixed SQL:
    Code:
    USE [ACCOUNT_DBF]
    GO
    /****** Object:  Table [dbo].[NEWS_TBL]    Script Date: 08/10/2010 11:06:46 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[NEWS_TBL](
    	[id] [int] IDENTITY(1,1) NOT NULL,
    	[title] [varchar](200) NULL,
    	[title_url] [text] NULL,
    	[category] [varchar](50) NOT NULL CONSTRAINT [DF_NEWS_TBL_category]  DEFAULT ('1'),
    	[date] [text] NULL,
    	[who] [text] NULL,
    	[detalle] [text] NULL,
    	[ip] [text] NOT NULL,
    	[blocked] [varchar](1) NOT NULL CONSTRAINT [DF_NEWS_TBL_isblock]  DEFAULT ('no')
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    
    GO
    SET ANSI_PADDING OFF
    Fixed "news.php"
    create news.php
    PHP Code:
    <?php
    function cat($cat)
    {
        if(
    $cat == '1')
        {
            return 
    "News";
        }
        else if(
    $cat == '2')
        {
            return 
    "Events";
        }
        else if(
    $cat == '3')
        {
            return 
    "Patch Notes";
        }
    }

    $nbsp "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $conexion mssql_connect("XXX\SQLEXPRESS""user""pass");
    $db mssql_select_db("ACCOUNT_DBF");
    $consulta mssql_query("SELECT * FROM NEWS_TBL WHERE blocked='no'");
    $asoc mssql_fetch_assoc($consulta);
    ?>
    <h2>Title: <strong><a href="<?php echo $asoc['title_url']; ?>" alt="<?php echo $asoc['title']; ?>"><?php echo $asoc['title'];?></a></strong><?php echo $nbsp?>Posted by <strong><?php echo $asoc['who']; ?></strong></h2> in <strong><?php echo cat($asoc['category']); ?> category.</strong><br>
    Content: <br>
    <?php echo $asoc['detalle']; ?><br><br>
    Date: <?php echo $asoc['date']; ?>
    Fixed "add.php"
    PHP Code:
       <?php
    mssql_connect
    ("XXX\SQLEXPRESS""sa""pass");
    mssql_select_db("ACCOUNT_DBF");
    $ip $_SERVER['REMOTE_ADDR'];
    $time date("F j, Y, g:i a");
    echo 
    '
    <form action="add.php?accion=add" method="post">
    <input name="title" value="Title Here" type="text"/><br>
    <input name="external" value="#" type="text"/><br>
    <select name="category">
    <option value="1">News</option>
    <option value="2">Events</option>
    <option value="3">Patch Notes</option>
    </select><br>
    <input name="time" value="'
    .$time.'" type="text" readonly="readonly"/><br>
    <input name="who" value="" type="text"><br>
    <textarea name="content" value="Text here" type="text" width="111" rows="12"/></textarea><br>
    <input size="20" type="submit" value="Submit"/>
    </form>'
    ;
    if(@
    $_GET['accion'] == "add"){
    if(isset(
    $_POST["title"])){
    mssql_select_db("ACCOUNT_DBF");
    mssql_query("INSERT into NEWS_TBL (title,title_url,category,date,who,detalle,ip,blocked) VALUES ('$_POST[title]','$_POST[external]','$_POST[category]','$_POST[time]','$_POST[who]','$_POST[content]','$ip','no')");
    }
    }
    ?>
    Sry for take a time to fix it.
    Just press in thanks :)
    Credits to XiDaX.

    ---------- Post added at 01:26 PM ---------- Previous post was at 01:22 PM ----------

    Quote Originally Posted by nightwolf0022 View Post
    Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near the keyword 'when'. (severity 15) in C:\xampp\htdocs\FFSilence\add.php on line 23

    Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\FFSilence\add.php on line 23 tried D: i dunno i think my computer is failing xD
    The problem is the script of query, SQL Server make a line called [when] and it is wrong, in query cant out [] extra, so just rename it or make me new script, [content] have the same problem.
    Scroll up and try me new code.
    Last edited by Dell Honne; 11-08-10 at 05:06 PM.

  12. #12
    Enthusiast kulaspero23 is offline
    MemberRank
    Mar 2010 Join Date
    PhilippinesLocation
    39Posts

    Re: [PHP] News System

    when i press Submit nothing happen

  13. #13
    Apprentice xiDax is offline
    MemberRank
    Jul 2010 Join Date
    6Posts

    Re: [PHP] News System

    yeah but it still add a new :P

  14. #14
    Infraction Banned BGxApixen is offline
    MemberRank
    May 2009 Join Date
    939Posts

    Re: [PHP] News System

    Quote Originally Posted by kulaspero23 View Post
    when i press Submit nothing happen
    See, This guy probably didn't notice this(The guy who "fixed" the php script).

    Here's the GOOD version:
    PHP Code:
       <?php
    mssql_connect
    ("XXX\SQLEXPRESS""sa""pass");
    mssql_select_db("ACCOUNT_DBF");
    $ip $_SERVER['REMOTE_ADDR'];
    $time date("F j, Y, g:i a");
    echo 
    '
    <form action="add.php?accion=add" method="post">
    <input name="title" value="Title Here" type="text"/><br>
    <input name="external" value="#" type="text"/><br>
    <select name="category">
    <option value="1">News</option>
    <option value="2">Events</option>
    <option value="3">Patch Notes</option>
    </select><br>
    <input name="time" value="'
    .$time.'" type="text" readonly="readonly"/><br>
    <input name="who" value="" type="text"><br>
    <textarea name="content" value="Text here" type="text" width="111" rows="12"/></textarea><br>
    <input size="20" type="submit" name="submit" value="Submit"/>
    </form>'
    ;
    if(@
    $_GET['accion'] == "add"){
    if(isset(
    $_POST["submit"])){
    mssql_select_db("ACCOUNT_DBF");
    mssql_query("INSERT into NEWS_TBL (title,title_url,category,date,who,detalle,ip,blocked) VALUES ('$_POST[title]','$_POST[external]','$_POST[category]','$_POST[time]','$_POST[who]','$_POST[content]','$ip','no')");
    }
    }
    ?>
    Replace that.

    -Apixen.

    It should process your request.

  15. #15
    Account Upgraded | Title Enabled! Nick1337 is offline
    MemberRank
    May 2009 Join Date
    357Posts

    Re: [PHP] News System

    Lets just make a whole new forums for flyff?
    Seriously guys -.-



Page 1 of 3 123 LastLast

Advertisement