Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by rswildy

  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
  15. But the Question was can i do this with PHP....Javascript may be the better option though...
  16. I don't see why you'd expierience a problem like this..What browsers seem to be having problems, Are you sure they are just not working?If its an older browser it may not be compatible with frames.Provide us with a screenshot of the problem? Also supply us the code for the frame.
  17. Yes, It can be done and it isn't to hard.Lets say you had a text box and they wrote "nav" you could have it as something like this... <ul><li class="dark"><a href="#">Product Ranges</a></li><li class="dark"><a href="#">Shanghai</a></li><li><a href="#">Table</a></li><li><a href="#">Chairs</a></li><li><a href="#">Chest of drawers</a></li><li><a href="#">Cabinet</a></li><li><a href="#">Nightstand</a></li><li><a href="#">Dresser</a></li>if ( $_POST['name'] == 'nav' ) { // Hide/show option<li><a href="#">Nav</a></li>}<li><a href="#">Mirror</a></li><li><a href="#">Small cabinet</a></li><li><a href="#">Tall cabinet</a></li><li><a href="#">Tall cabinet</a></li></ul><ul><li class="dark"><a href="#">View by Room</a></li></ul> You can just use that example for show for a tick box option or whatever.Hope this helped..
  18. looks fine to me.You could try adding table background to match the images or you could try making the images cell background.
  19. What do you mean?If you mean on the page just create the file and write on the page?If you mean when browser doesnt support frames <noframe>Text...</noframe>
  20. just use align? <p align="left">Content</p> or use css.
  21. Could you post the code so we could see what you mean more clearly?
  22. rswildy

    How to update ?

    You could try storing the answer in a variable then using something like value="<?php echo $total ?>" then just add up the values and store in the variable $total
  23. rswildy

    ID pages

    I mean more advanced than just an include() - i wanted to edit the include without editing the include file.I don't need help with it now so this topic doesn't matter.
  24. Try Google, It's a pretty common type of script pretty easy to find.If your looking for a script / Easy to customise Id suggest maybe using a PHP tutorial;http://php.about.com/od/finishedphp1/ss/php_login_code.htm.
  • Create New...