Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

user input question

>> smattering of PHP (if you saw the code for the
>> I'm making you would give yourself a tummy ache
>> giggling) I assumed that those were variables I'm

>Do tell!  And let us know what you need help with.

Well if I'm going to ask a question it should probably
be on the part where I'm most likely to get cracked,
user input.  Below is the page to handle a form on
index.php.  Now stop laughing!  It's my first module. 
Anyway, if any of you real programmers see any
particularly idiotic screwups please let me know.  A
friend mentioned that I should sanitize the users
input.  Any suggested reading on some simple ways to
do this?  Thanks for suggestions.
- Eric C.


 * xpsTorrent! -  a bittorrent tracker module for
 * form.php

global $xoopsDB;
global $xoops_url;


// Let's check to see if this hash is already in the
".$xoopsDB->prefix('xps_torrents'). " WHERE hash =
$result = $xoopsDB->query($query);
if ($result) {
   if ($xoopsDB->getRowsNum($result) > 0) {
echo " <p>This torrent is already in our database. 
<b>Please try again.</b></p>
     <a href=$linkback>Click here to return to the
main page.</a>";
else {
// Insert a row into the table
$sql .= " ( name, hash, announce, metadata,
last_scrape ) VALUES ";
$sql .= " ( '$name', '$hash', '$announce',
'$metadata', NOW() )";

if ( ! $xoopsDB->query($sql) ) {
echo( $xoopsDB->error." : ".$xoopsDB->errno );
   echo " <p>Your information has been successfully
added to the database.</p>
     <a href=$linkback>Click here to return to the
main page.</a>";



This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /