I'm working on a form that will input information into a MySQL. I want to make sure that I don't get any malicious code allowed in the forms. Does anyone have good resources on sterilizing form information?
i finally installed php5 as a cgi on my server because the server company has not upgraded to php5 yet. PHP5 runs only in 1 specific directory.(.htaccess file) Php appears to work fine as php5 but now i can't get it to read the mysql db.
the mysql library is compiled and i don't get an error when the connection string is called. the results from the query just doesn't appear. I'm definite it's not the php code because I haven't altered the code.
Anyone have any idea as to why? -Thank you all in advance!
here is the php code: maybe something changed w/ php5? $sql="SELECT categoryid, category FROM t_category ORDER BY category ASC"; $result=$this->f_selectquery($sql); foreach ($result as $key => $value) { echo " \n"; }
here is the configure command. './configure' '--prefix=/home/acctname/php' '--enable-force-cgi-redirect' '--with-xml' '--with-libxml-dir=/home/acctname/php/lib' '--enable-soap' '--with-xsl=/home/acctname/php/lib' '--with-mysql=/home/acctname/php/lib' '--with-curl=/home/acctname/php/lib' '--with-mhash-dir=/home/acctname/php/lib' '--with-mcrypt-dir=/home/acctname/php/lib' '--with-zlib-dir=/home/acctname/php/lib' '--with-jpeg-dir=/usr/' '--with-png-dir=/usr/' '--with-gd' '--enable-gd-native-ttf' '--enable-ftp' '--enable-sockets' '--enable-wddx' '--with-iconv' '--enable-soap'
here are the mysql properties under php MySQL Support enabled Active Persistent Links 0 Active Links 0 Client API version 4.1.8 MYSQL_MODULE_TYPE external MYSQL_SOCKET /var/run/mysqld/mysqld.sock MYSQL_INCLUDE -I/usr/include/mysql MYSQL_LIBS -L/usr/lib -lmysqlclient
Directive Local Value Master Value mysql.allow_persistent On On mysql.connect_timeout 60 60 mysql.default_host no value no value mysql.default_password no value no value mysql.default_port no value no value mysql.default_socket no value no value mysql.default_user no value no value mysql.max_links Unlimited Unlimited mysql.max_persistent Unlimited Unlimited mysql.trace_mode Off Off
Anyone know of any good pagaination functions - I've tried to code my own and I seem to be going around in cicles. What I've writen is:-
function disp_page($offset, $max_rows, $table, $base_url)
{
mysql_select_db(DB);
if(!isset($offset))
{
$offset=0;
}
$offset=($offset+$max_rows);
// Define the SQL calls
$sql="select * from $table limit $offset, $max_rows";
$sql_tmp="select * from $table";
// Make the SQL calls
$result=mysql_db_query(DB, $sql);
$tmp=mysql_db_query(DB, $sql_tmp);
$total_rows=@mysql_num_rows($tmp);
// Define other variables
$total_pages=(ceil($total_rows/$max_rows));
paginate($offset, $total_rows, $base_url, $max_rows, $total_pages);
// Display the results
while($row=@mysql_fetch_row($result))
{
disp_row($row);
}
echo"$ltbr>";
paginate($offset, $total_rows, $base_url, $max_rows, $total_pages);
}
function paginate($offset, $total_rows, $base_url, $max_rows, $total_pages)
{
// PREV link
if($offset > 0)
{
disp_prev($limit, $base_url, $max_rows);
}
// Page Numbers
if($total_pages > 1)
{
// disp_page_nums($offset, $base_url, $total_pages, $max_rows);
}
// Next link
if(($offset + $max_rows) < $total_rows)
{
disp_next($offset, $base_url, $total_rows, $max_rows);
}
// Empty Results set
if($total_rows==0)
{
echo"$ltbr>$ltcenter>No Records to Display$lt/center>
";
}
}
function disp_row($row)
{
// This function is to be edited to display the data how needed
echo"$lta href=\"?disp_t=topic&topic_id={$row[0]}\">".$row[2]."$lt/a>$ltbr>";
}
function disp_prev($offset, $base_url, $max_rows)
{
$tmp_offset=($offset-$max_rows);
if($tmp_offset $lt 0)
{
$tmp_offset = 0;
}
$offset=$tmp_offset;
$url=$base_url."&offset=".$offset;
echo"$lta href=".$url.">PREV$lt/a> ";
}
function disp_next($offset, $base_url, $total_rows, $max_rows)
{
$tmp_offset=($offset + $max_rows);
// echo"$ltp>tmp_offset=$tmp_offset offset=$offset
I'm used to working with MySQL and I have to make this forray into SQL server. So, I need a quick bit of help.
I need to be able to browse through a database one record at a time. For that, I guess I need a way to give my query a start row and. I can end it just fine. What should I use? And how do I figure out what row I am currently on. With MySQL theres the LIMIT clause and I know thats not available in SQL server.
I'm trying to create a PHP browser-based chat room application. It will include Savant, JPSpan, and a custom MySQL wrapper class. The server is running PHP 4.3.10 and MySQL 4.0.18-standard. Now that the background information is out of the way, to the real issue at hand...
I obviously want the application to be able to support as many users as the server will allow. That said, the application must be as efficient as possible in terms of the database design and implementation. The database will be relational in design. There will be tables for rooms, users, and posts made by users to rooms. The application will also include a feature to allow users to search posts. My plan at the moment is to use a HEAP table as a buffer for current posts, given that they provide a speed advantage because they exist in memory and use hash indexing. On some sort of timed interval, posts would be moved from the HEAP table to a separate permanent table for archived posts.
However, this approach would require that posts be archived regularly over the course of the day. The more frequently posts are archived, the smaller the number of posts that could potentially be lost due to a server crash, power less, etc. The HEAP table really only needs to hold posts long enough for them to propagate to users. I'm not certain what frequency would be best.
Also, because HEAP tables don't support the TEXT field type, the HEAP table would initially need a VARCHAR(255) field for the post body. The application would have to check the length of posts when users submit them and then ALTER the table to add additional VARCHAR(255) fields, split the post body up to store it across those fields, and then concatenate the value of those fields to display the post. Since displaying each post would require getting all fields in the table anyway, it should be fairly easy for the application to figure out with each display how many fields it needs to concatenate to display the post body.
Any input? Any alternative approaches? I probably neglected to mention some tenant of my application requirements, so if you have questions, please ask, and I'll most certainly answer them. I think I've covered most of the bases, though. HEAP tables are a new concept to me, so I'm mostly lingering in the world of hypotheses before I actually try to make this work.
Hi, I do not know how to code PHP, but I do know how to impliment PHP scripts. I've been looking for a GPL one that does the following:
Forces download (header script that forces the "save" dialog. I'm serving mp4s and I want to make sure they don't load in the browser).
Anti-Leech (hides the true URL of my mp4s, and allows only referring servers I've entered into the script to download, otherwise people are redirected to the page of my choice)
Download Counter (either flat files or MySQL).
And that's it. I found scripts that do bits and pieces of this, but only one that does it all—and you have to pay for it (you can actually use it for free but it appends the site's name to the downloaded files unless you register the pro version). This script is called "Download Center Lite" and can be found at www.Stadtaus.com. I tried to crack it, but they've done clever things in the script to prevent that.
Also, I've found "Download Centers" that do much of these, but that's just for having a specific page with download links. I want to be able to dynamically call to these mp4 links from various pages on my website, not just from one.
Ideas?
This message was also posted in the LJ community "PHP."
Hi, I do not know how to code PHP, but I do know how to impliment PHP scripts. I've been looking for a GPL one that does the following:
Forces download (header script that forces the "save" dialog. I'm serving mp4s and I want to make sure they don't load in the browser).
Anti-Leech (hides the true URL of my mp4s, and allows only referring servers I've entered into the script to download, otherwise people are redirected to the page of my choice)
Download Counter (either flat files or MySQL).
And that's it. I found scripts that do bits and pieces of this, but only one that does it all—and you have to pay for it (you can actually use it for free but it appends the site's name to the downloaded files unless you register the pro version). This script is called "Download Center Lite" and can be found at www.Stadtaus.com. I tried to crack it, but they've done clever things in the script to prevent that.
Also, I've found "Download Centers" that do much of these, but that's just for having a specific page with download links. I want to be able to dynamically call to these mp4 links from various pages on my website, not just from one.
i'm looking for a good webhost company to host my website. what are your recomendations?
my needs are pretty standard.
- php (5 would be nice) - mysql - ftp - email - subdomains - +200mbs space - +20gbs bandwith - CPanel, URCHIN statistics are a plus - if possible, ssh access. :)
so far, and based on my past experience, i'm set on using eyow.com. but i want to hear what you guys recommend.
(sorry if there is a list somewhere of recommended webhosts. i've searched the lj communities and nothing has come up.)
i'm looking for a good webhost company to host my website. what are your recomendations?
my needs are pretty standard.
- php (5 would be nice) - mysql - ftp - email - subdomains - +200mbs space - +20gbs bandwith - CPanel, URCHIN statistics are a plus - if possible, ssh access. :)
so far, and based on my past experience, i'm set on using eyow.com. but i want to hear what you guys recommend.
(sorry if there is a list somewhere of recommended webhosts. i've searched the lj communities and nothing has come up.)
i'm looking for a good webhost company to host my website. what are your recomendations?
my needs are pretty standard.
- php (5 would be nice) - mysql - ftp - email - subdomains - +200mbs space - +20gbs bandwith - CPanel, URCHIN statistics are a plus - if possible, ssh access. :)
so far, and based on my past experience, i'm set on using eyow.com. but i want to hear what you guys recommend.
(sorry if there is a list somewhere of recommended webhosts. i've searched the lj communities and nothing has come up.)
hi all ~ i have a vB board out there in cyberland and it's got a "random quote" hack (the UQH by kurafire) ~
anyway, after three years of smooth sailing, it recently developed some kvetchy sickness and i can't figure out the problem.
this is the error message:
Database error in vBulletin 2.3.0:
Invalid SQL: SELECT * FROM quotes WHERE 1=1 AND mod!='N' ORDER BY letter,name ASC LIMIT 0,30 mysql 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 '!='N' ORDER BY letter,name ASC
where it says "script" ~ that URL is completely wrong and i'm not sure where it's trying to call it from ~ (don't know if that's part of the problem? is that in a template?)
anyway, i'm a complete dummitz about mysql ~ do you think i should just delete the table and rehack the whole thing? (please say no ~ hahahahaha) ~
anyway, sorry if this is obnoxious. any hints would be very much appreciated.
Open source bundling is the new trend. Martin Lamonica's story yesterday about SourceLabs describes one such bundles. Most are aimed at businesses. Many, like the SourceLabs bundle, are AMP Stacks, with the Apache Web Server, MySQL database, and PHP scripting tools. The idea is for a company to give ...
I’m working on some code and I am trying to make sure all the incoming data is secure. I currently call mysql_real_escape_string() on all incoming data, but I am wondering if it would be worth my while to call htmlspecialchars() on it as well. Does anyone else have any good tips on un-tainting user data.
Hello Yesterday I started work on a small FAQ or help system, made with PHP, mod_rewrite, and MySQL I really just starting to learn MySQL and I thought that this would be a good place to start. I have not started on the Style yet,
I've finally put together a code-based load balancing scheme for distributing server load to a pool of slaves. The issue I'm up against now is a way to poll the slaves to see which has the lowest load, and there doesn't seems to be a standard simple MySQL command to report that.
I'd like to keep the methods confined to SQL commands that can be executed via remote connections. The only option I can see at the moment is do "show processlist" and filter it to see the number of currently executing queries and get the average execution time, though that seems to be a bit "heavy".
I haven't seen anything in show status or the like that shows something as basic as server load.
I'm sure this has been covered before but I haven't been able to find any references. Any ideas?
SELECT * from schedule WHERE (clientid = 95145) AND (date BETWEEN '2005-04-10' AND '2005-04-30') ORDER BY date
Any one know of a good site with a elaborate description of the WHERE clause of the SELECT statement? I am trying to select data that matches a client id and a date range. The MySQL manual doesn't seem to get into it in detail.
I got it to work. I had left out the quotes. Sheesh.