Jump to content

RRT

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

RRT's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am looking for help trying to select multiple checkboxes to delete entries from a DB via a php web page. I know the SQL syntax on *how* to delete a row of data within a SQL database, just not how to create a php array where I can do multiple delete commands at once. For example, if I have a PostgreSQL database with the following rows: database1=# SELECT * FROM table1; cid | home_location | asking_price ----+---------------------+----------------- 1 123 Main Street 200000 2 345 First Ave 210000 3 456 Frontage Rd 199900 4 678 5th Street 205000 5 1001 Elm Street 225000 I would like to display the results of this SELECT ALL query onto a php web page with checkboxes next to each row, giving me the ability to check multiple rows and then delete them from the database. The php code to display the selections looks something like this: <?php // Connecting to the database server $dbconnect = pg_connect("host=aaa.bbb.ccc.ddd dbname=database1 user=user1 password=password1") or die("Could not connect: " . pg_last_error()); //Performing the SQL query $removequery = sprintf("DELETE FROM table1 WHERE CID="?"); How would you suggest that i put all the desired queries together to be able to delete various ones at the same time? I assume that I need to create some sort of array and then be able to delete them all at once, just not sure of how to go about coding that to work.
  2. That did it! THANKS!!! I had to use "pg_escape_string" instead of "mysql_real_escape_string" since I am using postgres, but other than that its similar. Besides string data, do they make escape methods for other types of data, such as integers, floats, etc? Maybe those types aren't suseptable to exploit? That would make sense to me, as commands aren't numbers but strings of words.
  3. Thanks for the info about the SQL injection, I will take that into account. So you are suggesting that I change my code to something like this, right?: ======================= $query = sprintf("INSERT INTO inventory VALUES ('%s','%s','%s','%s', '%s','%s','%s','%s','%s','%s')";, mysql_real_escape_string($CID), mysql_real_escape_string($ImageFile), mysql_real_escape_string($ItemTitle), mysql_real_escape_string($ItemNo), mysql_real_escape_string($Barcode), mysql_real_escape_string($Description), mysql_real_escape_string($Dept), mysql_real_escape_string($Price), mysql_real_escape_string($Quantity), mysql_real_escape_string($Shipping)); mysql_query($query); =======================
  4. I can't do an INSERT via a web query. Can you look at my syntax and see if I have a typo below?: ------------------------------------- <?php $CID = $_POST['CID']; $ImageFile = $_POST['ImageFile']; $ItemTitle = $_POST['ItemTitle']; $ItemNo = $_POST['ItemNo']; $Barcode = $_POST['Barcode']; $Description = $_POST['Description']; $Dept = $_POST['Dept']; $Price = $_POST['Price']; $Quantity = $_POST['Quantity']; $Shipping = $_POST['Shipping']; . . . $query = 'INSERT INTO inventory (cid, image_pic, item_title, item_no, barcode, description, dept, price, quantity, ship_rate) VALUES ('$CID','$ImageFile','$ItemTitle','$ItemNo', '$Barcode','$Description','$Dept','$Price','$Quantity','$Shipping')'; ------------------------------------- This is what I get back when I try to submit the query (Line 20 is the query line posted above.): Parse error: syntax error, unexpected T_VARIABLE in /perform_insert.php on line 20
  5. I tried the solution to Q.7 but it didn't fix it. I tried "python", "import yum" but it fails saying >>> import yum Traceback (most recent call last): File "<stdin>", line 1, in ? File "yum/__init__.py", line 23, in ? import rpm ImportError: No module named rpm >>>
  6. OK, I am taking your advice and trying to get yum fixed, but keep getting this Python error: ----------------------------------------- yum check-update php5 There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: cannot import name flagToString Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.4.1 (#1, May 16 2005, 15:19:29) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq ----------------------------------------- Any ideas as to what I need to do to get this issue fixed? I am running yum version 3.2.23 and Python version 3.1.1. Thanks.
  7. OK, I'm really starting to get irked about his whole PHP configuration issue; I've been working on this problem for over a month. Modifying the httpd.conf and adding LoadModule php5_module "/full/path/to/php/php5apache2_2.so" AddType application/x-httpd-php .php has not informed the server to parse PHP files as PHP. Here's another thing, why are their so many php.ini and httpd.conf files? Shouldn't there just be one of each? Here's the locations I am finding on my server: /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/original/httpd.conf /usr/local/apache2/docs/conf/httpd.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf.d/php.conf /usr/local/lib/php.ini /usr/local/php/php-5.2.9/php.ini /etc/php.ini /etc/php.d/php.ini I just want to get this thing working correctly so I can get the server to parse PHP files as PHP. I need to get past this so that I can move forward onto other things... Thanks!
  8. OK. What does this error mean? There is no text containing "sqlite3ExprDelete" anywhere within the httpd.conf file: # apachectl start httpd: Syntax error on line 57 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/php/php-5.2.9/libs/libphp5.so into server: /usr/local/php/php-5.2.9/libs/libphp5.so: undefined symbol: sqlite3ExprDelete
  9. These are the .so files that I could find on my server. Which module(s) should I load to get PHP working with Apache?: ============ /usr/lib/httpd/modules/libphp5.so /usr/lib/httpd/modules/mod_imap.so /usr/lib/httpd/modules/mod_vhost_alias.so /usr/lib/httpd/modules/mod_unique_id.so /usr/lib/httpd/modules/mod_info.so /usr/lib/httpd/modules/mod_alias.so /usr/lib/httpd/modules/mod_mem_cache.so /usr/lib/httpd/modules/mod_access.so /usr/lib/httpd/modules/mod_asis.so /usr/lib/httpd/modules/mod_headers.so /usr/lib/httpd/modules/mod_auth_digest.so /usr/lib/httpd/modules/mod_dav.so /usr/lib/httpd/modules/mod_logio.so /usr/lib/httpd/modules/mod_include.so /usr/lib/httpd/modules/mod_autoindex.so /usr/lib/httpd/modules/mod_env.so /usr/lib/httpd/modules/mod_proxy_ftp.so /usr/lib/httpd/modules/mod_negotiation.so /usr/lib/httpd/modules/mod_ldap.so /usr/lib/httpd/modules/mod_status.so /usr/lib/httpd/modules/mod_ext_filter.so /usr/lib/httpd/modules/mod_usertrack.so /usr/lib/httpd/modules/mod_python.so /usr/lib/httpd/modules/mod_proxy_http.so /usr/lib/httpd/modules/mod_userdir.so /usr/lib/httpd/modules/mod_actions.so /usr/lib/httpd/modules/mod_disk_cache.so /usr/lib/httpd/modules/mod_speling.so /usr/lib/httpd/modules/mod_mime_magic.so /usr/lib/httpd/modules/mod_auth_ldap.so /usr/lib/httpd/modules/mod_perl.so /usr/lib/httpd/modules/mod_cgid.so /usr/lib/httpd/modules/mod_dir.so /usr/lib/httpd/modules/mod_rewrite.so /usr/lib/httpd/modules/mod_auth.so /usr/lib/httpd/modules/mod_file_cache.so /usr/lib/httpd/modules/mod_dav_fs.so /usr/lib/httpd/modules/mod_log_forensic.so /usr/local/apache2/modules/libphp5.so /usr/local/apache2/lib/apr-util-1/apr_dbd_pgsql-1.so /usr/local/apache2/lib/apr-util-1/apr_dbd_sqlite3.so /usr/local/apache2/lib/apr-util-1/apr_dbd_pgsql.so /usr/local/php/OLD/php-5.2.8/modules/pgsql.so /usr/local/php/OLD/php-5.2.8/.libs/libphp5.so /usr/local/php/OLD/php-5.2.8/ext/pgsql/.libs/pgsql.so /usr/local/php/php-5.2.9/.libs/libphp5.so /usr/local/php/php-5.2.9/libs/libphp5.so ============ I didn't see any .so file named "php5apache2_2.so", unless you were just making up that filename as an example. Thanks.
  10. I'm on Fedora 2.6.11-1.1369_FC4 on that particular server. I'm running PHP 5.2.9 which I downloaded directly from the php web site, then untarred, ran make, and make install commands as described in the php INSTALL file that was included with the distribution.. ================== Example 2-4. Installation Instructions (Apache 2 Shared Module Version) 1. gzip -d httpd-2_0_NN.tar.gz 2. tar xvf httpd-2_0_NN.tar 3. gunzip php-NN.tar.gz 4. tar -xvf php-NN.tar 5. cd httpd-2_0_NN 6. ./configure --enable-so 7. make 8. make install ================== You will probably try to talk me into using yum, which I have already tried to do, but it will not work on my system; it always fails on 'setting up repositories'. Fixing this will have to be another project on its own and in th future.
  11. How to I set it to do that? I am running Apache version 2.2.11.
  12. PHP pages won't open at all on my server. HTML pages open fine, but when going to the PHP pages that are on my server, the browser tries to download the page like a file instead of presenting it by the browser. What can I do to make the PHP processor to be handled properly? Do I need to recompile it again, and if so, what switches should I use?
  13. This issue is still not solved. If I can't get Yum to work correctly, then that means that I will have to config and compile manually. Any suggestions on what I should try next?
  14. When I try that I guess this: Setting up Install Process Setting up repositories Cannot find a valid baseurl for repo: updates-released That is as far as I get. Do I need to run some other command to setup yum first?
  15. Did this fix your issue? Would I do the same thing for Postgres, such as this: yum install php-postgres Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.