Jump to content

rswildy

Members
  • Posts

    98
  • Joined

  • Last visited

rswildy's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Well im writing some framework in PHP and i started on the template system after almost finishing i thought to myself whats the point.Why not just include PHP instead of HTML , Can anyone give me some good reasons to use a template system with things such as <-- if (condition) --> {login box} <-- end if --> When i could just simply use a PHP file.
  2. rswildy

    Sql Injection

    Can you check these 2 functions i wrote up and tell me anything i should change or is not needed. Also explain anything that needs adding to it.I need suggestions, I'm creating a script that is not vulnerable to SQL attacks and my framework is going to be open source. /* * Encode the value to stop SQL * injection. */ function mysql_encode ($value) { $value = trim($value); $value = nl2br($value); $value = htmlentities($value, ENT_QUOTES); if ($value == null) { $value = 'NULL'; } if (is_bool($value)) { $value = $value ? 1 : 0; } if (is_numeric($value)) { intval($value); } if (get_magic_quotes_gpc()) { $value = stripslashes($value); } if (!is_numeric($value)) { mysql_real_escape_string($value); } $value = addcslashes($value, '%_'); return $value; } /* * decode the value from SQL */ function mysql_decode ($value) { $value = html_entity_decode($value, ENT_QUOTES); if ($value == 'NULL') { $value = ''; } $value = stripslashes($value); return $value; }
  3. Is it possible to connect to a SQL database using MYSQL hosted on a completely different server. Is there any security issues with doing so if possible. And can anyone explain how, or link a tutorial.Thanks, In advance.
  4. rswildy

    Error in php/mysql

    the query is: $sql = "SELECT * FROM gallery WHERE category = " . $catName . " LIMIT {$limitStart} , {$limit}"; $sqlp = "SELECT * FROM gallery WHERE category = " . $catName . " LIMIT {$limitStartp} , {$limit}"; the error is: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 12 , 12' at line 1
  5. new error. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's notes', 'Construction notes for Dwarf cannon ammo. ')' at line 2 it adds the first 3 from the list theres 7,8k to add. how can i avoid the errors like this?
  6. <?php // Connects to your Database mysql_connect("localhost", "....", "....") or die(mysql_error()); mysql_select_db("rswildy") or die(mysql_error()); function InsertToDB($id, $name, $desc) { mysql_query("INSERT INTO ids_items (id, name, desc) VALUES('".$id."', '".$name."', '".$desc."') ") or die(mysql_error()); } $lines = file( 'http://www.lukesrealm.co.uk/lists/317/ALL%20ITEMS.txt' ); foreach ( $lines as $line ) { $amount++; $done = list( $id, $name, $desc ) = preg_split( '/ - /', $line ); InsertToDB($done[0], $done[1], $done[2]); echo $amount."<br />\n"; }?> error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc) VALUES('0', 'Dwarf remains', 'The body of a Dwarf savaged by Goblins. ')' at line 2
  7. Hm, It wont jus let me use /me, How do i add colours/the /me command to: fputs($socket, "PRIVMSG $to :Dodian is $status\n");
  8. its working now, so how can i make a command go !msg (message) then it will say it.
  9. I'm not part of the SwiftIRC network although i was once. I'm not trying to connect to the IRC.. thats what this does. $socket = fsockopen("irc.dodian.com", 6667) or die('Could not connect to the server'); I'm trying to print the status of a runescape private server.
  10. i normally do ID in capitals as it doesn't matter the reason some of it is id is because that's how he put it
  11. Create a new table Comments, in it put:title - Comment TitlenewsID - Use the ID from for the news article they are commenting on.poster - Who added the commentcomment - The actual comment..id - The comment IDThen just use the same method for printing the news and on the news page also print the comments where newsID in the comments field is the same id in the news field...
  12. case ':!status':if($ex[2] != $nick){$to = $ex[2];}else{$arr = explode('!', $ex[0]);$to = ltrim($arr[0],':');} $portS = 43594; $ipS = dodian.com; $sock = @fsockopen($ipS, $portS, $errno, $errstr, 5); if ($sock) { $status = online; } elseif (!$sock) { $status = offline; } fputs($socket, "PRIVMSG $to :Dodian is $status\n");break; Is there a reason why this will always return offine even when its clearly online.Im fairly new to IRC Bots and i was wondering how can we do something like !msg (message) and bot will say it?
  13. That would be the better option as you would educate yourself in the process.
  14. Yes, But you could use an online tutorial and learn from it to make your own comment system?I found one here; http://www.phpeasystep.com/workshopview.php?id=12
×
×
  • Create New...