[PostgreSQL] Unescaping Escaped Strings?
How do one unescape strings prepared with pg_escape_string() ?
stripslashes() will not work because both these functions are not
completely compatible.
View Complete Forum Thread with Replies
Related Forum Messages:
Unescaping An Escaped Entry
how to unescape an escaped database entry if that makes sense. When they fill out a comment form, it shows up with words like..."that/'s the reason I/'m doing this" if that makes sense. i want to remove the "/" and I assume its doing that b/c I had to escape the text box when they enter info into the database.
View Replies !
How To Search Strings Escaped By Mysql Real Escape String()?
I am currently developing an article script and there are Titles and Contents. To prevent sql injection, people say we must use mysql_real_escape_string(). So let's say if there is a Title that says "My Friend's best friend", if I look into the MySQL table record, the text will be saved as "My Friend's best friend", where the apostrophe is escaped. Code:
View Replies !
Unescaping Characters In Flat Files
I'm making a modular website using flatfiles (can't use mysql) and I realized I've never done a flatfile before (too much mysql) and I realized I'm having issues with quotes like if i say "data" it returns as "data" I know i can do a stringreplace on the out put to remove slahses, but there is a lot of characters to escape any tipsideas on making it easier on myself?
View Replies !
Escaped Or Not?
I have magic_quotes on. Therefore, backslashes are added before single quotes after a form is submitted. When executing a mysql_query, data is inserted into DB without problems. I remember that some time ago, my single quotes (and of course some other characters as well) were kept escaped in the DB. I could see that when I looked in phpmyadmin at the table records. As of now, my data is kept as it is, as it should look in the DB when I look in phpmyadmin. No escaped characters. As far as form injection and security is concerned, is this safe? How do you keep your records?
View Replies !
The Amazing Escaped Single-quote
Say you have a form with a textarea. Say you type something with single-quotes (e.g. I'm happy so I'm sad) in the textarea. When the textarea is POSTed to a PHP program, are they escaped with the backslash? I ran it on two different servers and one did and one didn't. Why is this? Is there some setting somewhere? Or is this a version diff thing? Here is the PHP code (I changed all angle brackets to square ones so it'll appear): Code:
View Replies !
How To Get Un-escaped Text From A Form Field
I have a php script that gets the text from a form field: <?php include("global.inc.php"); pt_register( 'POST', 'test1'); echo $test1; ?> The text comes back fine, just some characters (', " and ) are now escaped (', " and ). The problem is that I need the he text to be exactly as it was entered by the user. I could process the text myself, and replace the escaped characters, but I'd like first to understand why this is happening and if there is a way to disable this behavior and get the unmodified text directly.
View Replies !
Find A Single Or Double Quote In $desc That Was Not Escaped.
I am having problems getting php to escape characters, so I can use them with javascript. Here is the code. PHP Code: $desc = $item['description']; $desc = str_replace("'", "'", $desc); $desc = str_replace('"', "'+String.fromCharCode(34)+'", $desc); echo "<a href='index.php' onMouseover="showTooltip(event,'$desc');return false">Link</a>"; I am trying to get a tooltip to work. It seems to work most of the time, but sometimes the tooltip does not work, and when that happens I can find a single or double quote in $desc that was not escaped.
View Replies !
Splitting Strings - Break Strings Apart By Character
I am trying to make post code search and need to be able to break strings apart by character. I can do it by spaces and things using the explode() function, but I want to be able to get the first letter of the string only, the first and second only, first second and third etc.
View Replies !
Problem With "escaped Characters" Not All Double Quotes Show Up?
$tdsubclass=<<<bumelum <td><a href="http://www.ygabel.php/$artnr[$arayartnrcounter]" ="" onmouseout=" function onmouseout(event) { window.status = "Done"; return true; } " onmouseover=" function onmouseover(event) { window.status = "http://www.fup.dk"; return true; } "> <!--target="_Self"--> bumelum; When I print this the double quotes after Done" and after dk" are missing? I have also tried with escaped characters in double quotes
View Replies !
PostgreSQL++PHP...
I am slowly loosing my mind to this. All was well as long as I worked with MySQL. Now I have to work with PostgreSQL, and I just don't dig it. Is there anyone out there who worked on somethng like this before? Or knows of any good tutorials?
View Replies !
Php & Postgresql - All Or Nothing
Lets say I want to execute 3 postgresql queries in a row based on the inputs in a php form...Here's the catch though. What happens if #1 and #2 execute perfectly, but #3 fails for one reason or another. Is there a way to set things up so that the server knows and compensates... in other words... do queries 1,2&3, but if any query is unsuccessfull set the db back to the way it was before any of the queries executed.
View Replies !
Php And Postgresql
Can anyone tell me why when i select the object identifiers in my postgresql table and try to print them out using php it only gives me the first digit? Any ideas on how to get round this?
View Replies !
PHP PostGreSQL CMS ?
I can't seem to find any PHP CMS's built around PostGRES as a back-end. If I can't find one soon, I'm afraid I may have to build my own from scratch. Maybe make one that utlizes PDO from PHP5 so it's basically DB neutral. Any thoughts?
View Replies !
New To Postgresql
I am trying to write a query that says show me all records in the last_login field that are older then 30 days. How can I do this in postgresql I know in mysql you can use the currdate function.
View Replies !
PostgreSQL 8.1
PostgreSQL 8.1 is coming out, and it just keeps getting better. With new features like bitmap indexes, 2 phase commit, GiST indexes, 64 bit shared memory, integrated autovacuum, and faster aggregates, it's better than ever. And don't forget, it runs on Winders now since V 8.0.
View Replies !
Sphinx With PostgreSQL
I am new to both postgre and Sphinx. I need to configure full-text search in my PostgreSQL database field, which contains text data. I searched the net and found Sphinx. I downloaded the source, configured it with-mysql and with-pgsql and make and makeinstall. I have successfully run the example script given. But I could not test the indexer or, configure the sphinx.conf file to work with pgsql - by default it is configured to work with mysql. I propose to use php programs to do the search, by calling the sphinx indexer.
View Replies !
PostGreSQL INSERT
I've written some scripts to display information from a PostGreSQL database in a table format, and everything is fine. I've been adding data manually up until now. So, I've written a page where users input their information and this gets inserted into the relevant table. However, this isn't working. I have been chopping code out to the bare minimum just to get something working, but even the simplest thing doesn't work.Here's what I've got at the moment : $resultSet = pg_exec($conn, "INSERT INTO ntable (make, model) VALUES ('Suzuki', 'Bandit'))"; I have connected ok, so there's no problem there, but the above line produces : Parse error: parse error in /web/sites/042/grendel/www.grendel.f2s.com/addins.php3 on line 39 .
View Replies !
Php And MS-SQL And PostgreSQL (with Apache)
I have an architectural type question that centers around php. We have a website that people hit that uses php to dynamically generate web pages. We use Apache and php (although we don't have php compiled in with apache). Our Unix like server (FreeBSD) that has php (and Apache) on it that today communicates with the postgresql database on another Unix like server (Linux). I configured the php set of libraries with postgresql support in them. (Unix server) (Unix server) [Apache + PHP ] -----> [ postgresql ] - - - (Win 2003)[color=blue] > [ MS SQL 200 ][/color] We are adding a Windows server into our system that contains MS-SQL 2000 on it with another database to interact with. My question is to access both databases from the php server (freebsd), is it only a matter of compiling php with postgresql and mssql support in it or are there other things to consider? I know there are different function calls for each database type and even a PEAR interface that handles different databases with a common interface. I am just looking at my configurtion options/possibilities.
View Replies !
Cannot Connect To Postgresql
I am running on Win XP. I have installed Apache 2.2. Works fine. I have installed php-4.4.4-Win32 manually. Apache to php connection is working fine, I tested a couple of trivial php scripts. I have installed PostGreSQL v8. I can do stuff (create table, populate data) thru pgAdminIII tool, so I think that is also fine. I want to install phpBB. When I try to do the set up I get message "The PHP configuration on your server doesn't support the database type that you chose" So it tells me the issue is with php and PGSQL, hence my question here. I have modified php.ini to uncomment the line extension=php_pgsql.dll and restarted the server. No good. I tried running this script that I copied from a site <html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>' ?> <?php $conn = pg_connect("host=localhost port=5432 dbname=postgres user=postgres password=mypasswd"); $sql = "SELECT current_date AS today;"; $result = pg_query($conn, $sql); $row = pg_fetch_object($result, 0); echo "Today is: " .$row->today; ?> <?php phpinfo(); ?> </body> </html> It prints out the Hello World line. Doesn't print the phpinfo. Nor the current date. Needless to say, I know no php, just want to get the bulletin board up and running on my PC.
View Replies !
Too Many Connections To PostgreSQL
I'm running into a problem wherein I'm unable to connect to my postgresql db because the maximum number of connections has been reached. I use ADOdb for my db work, and the thing is I'm using the PConnect function, so it's supposed to be using persistent connections. Since this is the case, I find it very strange that I'm having problems with the number of connections to postgresql. Also, I'm the only one using Postgresql on this server (a test machine) and I'm working on one area of my project (two or three pages) so it should definitely be reusing the connections.
View Replies !
PHP With Sybase Or Postgresql
I was wondering how to connect to postgresql and sybase databases. I'm assuming that I need to recompile php with the flags for both Do I also need to install sybase and postgresql themselves first? I know that mysql support is built in, at least into php 4.
View Replies !
Is There A PHPMyAdmin For PostgreSQL?
I use MySQL databases for my websites but at work I use PostgreSQL databases. Is there such a thing, similar to PHPMyAdmin, for PostgreSQL where I can view table structure, browse table data, run sql queries, backup etc?
View Replies !
Export PostgreSQL
I have a database written in postgresql in computer "A" I would like to have the same database and tables in computer "B" Is it possible to do an export?
View Replies !
New Stuff In PostgreSQL 8.1
what new stuff in PostgreSQL 8.1 are you looking forward to? Moving pg_autovacuum into main sounds pretty significant. I guess I can remove my cron vacuums? The replacing of users and groups with roles sounds pretty significant too. wonder if I'll have to worry about that. The csv header option is a nice small touch. Looks like there's some new IN/INOUT functionality for plpgsql that may replace RETURN. Other than that, it appears there are also quite a few performance improvements.
View Replies !
Foreach() / PostgreSQL
I have a database full of names. each name could be linked to any number of sub-names, each sub-name could be linked to any number of sub-sub-names, to infinity (unlikely but possible). I need to iterate through this nest of names starting with a main name; lets call the main name Peter. Peter could have John, Tim & Mike working for him.
View Replies !
Getting Off The Ground With Postgresql
I have managed to install postgresql on my server and i've successfully added a database and user. HOWEVER, i can't figure out how to setup Postgresql and phppgadmin to work together. Ivisit the phppgadmin page which seems to work and prompts me for login but then i cannot log in no matter what. I checked the postgresql log file and it appears that postgresql is trying to use an ident server which i don't think i have. I've seen some docs that talk about making changes to pg_hba.conf but this looks a bit scary to me. I'm accustomed to the mysql/phpmyadmin approach which has a root user who can create databases and user accounts with access to them. I'd rather not have 'trust mode' on if I can help it as that sounds a bit like a security risk.
View Replies !
PostgreSQL Vs. MySQL
I have just started a new job as a webmaster where they use PostgreSQL. I have always used MySQL. What are the differences? How does PostgreSQL work with PHP as apposed to MySQL? And finally, how do you pronounce PostgreSQL? Is it post-gre-sequel or post-gre or what?
View Replies !
PostgreSQL Primary Key
I need to obtain the names of the fields that are the primary key of PostreSQL tables, but the only thing i find that is likely is pg_meta_data.
View Replies !
Postgresql... Transactions?
i studied them in theory and typed some transactions using oracle. But it's time to write an aplication in wich i need to use transactions. i am using postgresql and writing the aplication in php. can anybody paste here a fragment of code where i can see a transaction coded in php using postgres? Code:
View Replies !
Tranzactii In PostgreSQL
I want to use transactions for every query in my application. Something like: BEGIN UPDATE facturi SET valoare=540.46 WHERE id = ྉ' UPDATE .... DELETE... COMMIT I'm searching for some functions for verify the query result, in order to execute COMMIT if here isn't any database problem, or ROLLBACK if any problem. Is somethig about pg_result_status() or pg_result_error() functions from PostgreSQL?
View Replies !
PostgreSQL, Any Good
Does anybody here use this as there primary DBMS? How does it compare to say mySQL? I was considering trying it out. but I thought I'd see what you guys though about it first.
View Replies !
Postgresql Database
If any body know how to upload a file in PHP and store it in postgresql database tables and retrive the contents from the postgres database and download it. If any body give the code snipset or the resource link I will thankful for that.
View Replies !
Postgresql - How To Set Up Superuser
i just installed postgresql and i'm confused by the docs. at this point, i'm having to do all my database work using the postgresql command line client. this page supposedly describes how to create a superuser: Code:
View Replies !
Postgresql Function ?
I want to create a function in Postgres 8.0 that can take multiple rows and copy those into another table (table2) that has same field/properties as table1; Like a backup. Only thing, if row exists in table2, nothing should happen to that row. I've stfw and but cant seem to find anything real good Im guessing something like this, but still missing "if row exists, skip" : Code:
View Replies !
Mysql Vs. Postgresql
I have a problem writing PHP ODBC scripts that suit both MySQL and PostgreSQL. So far, the following syntaxes seem to apply to each database (this is an 'insert' example; the same differences apply to 'select commands): MySQL: INSERT INTO MyTable (col1, col2) VALUES ("value1","value2") PGSQL: INSERT INTO "MyTable" (col1, col2) VALUES ('value1','value2')
View Replies !
PHP And PostgreSQL - Simple Search
I just have a question about doing searches in the database. I'm sure it's really simple, but postgresql.org's documentation is really horrible (in my opinion). Anyway I just want to know how to make a simple search with php/sql. Just so people can enter a word or string and sql will select rows containing that text in a specified field.
View Replies !
Why Won't This Code Work In Postgresql And Php?
I am running this SQL statement in php 4.39 to Postgresql 7.3.4 and I keep getting this error Warning: pg_query(): Query failed: ERROR: syntax error at or near "WITHOUT" at character 29 in /var/www/html/liberty/includes/test2.php on line 12 I can't figure out why this is failing. $buildtableQ = "CREATE TABLE $tempname WITHOUT OIDS AS SELECT rt.resid, max(rt.transdate) FROM li_roomtransfer as rt JOIN li_resident AS r ON rt.resid = r.resid WHERE r.nursehomeid = Ƈ'AND r.distribid = Ƈ' GROUP BY rt.resid"; $buildtableR = pg_query($buildtableQ); This is Line 12. any suggestions?
View Replies !
Postgresql Or Mysql Future
why mysql is more diffused than postgresql? Postgresql licence is really free more than mysql, but why postgresql is not much diffusing? the future will be of mysql?
View Replies !
Backup PostgreSQL With PHP Or Perl
I need to backup a postgres database from a web page so I either have to use PHP or PERL. I'm familiar with backing up and restoring via the shell. Does anyone have an idea on how to do this?
View Replies !
Sort Of Bugzilla In PHP/PostgreSQL?
I've now become a HUGE fan of PHP and PostgreSQL on Red Hat 9. We're moving everything we can to it as fast as humanly possible in the next 2 years. Some other things we do are moving to Progress/Webspeed on Linux and AIX. Do you know of anyone out on the web who has made a kind of Bugzilla-knockoff (even primitive) and has implemented it in PHP/PostgreSQL? (Bugzilla is user-friendly and was written in Perl. It's also quickly becoming the industry standard among non-MS programming circles.) Can you show me a website demo? If I get to see some of these, I might be able to convince my boss to purchase a copy to install here and then customize for our environment. (Can't promise this, however.) I would code this myself, but I have been so under the gun to get so many other projects out the door. (Heck, I might even need to fly in a temp PHP programmer to come in and help me with all this other stuff I need to build, but again -- I can't promise anything.) So, if you're a PHP entrepreneur, get cracking! :)
View Replies !
Query Problems With PostgreSQL
I'm having intermittent problems with queries from my php script to a postgresql database. I have a form where I can enter a search query - for instance a last name. This leads to a results page with a brief bit of information about each of the matching results. From there, I can click a link associated with any of the results which takes me to a page with all of the details. Pretty standard stuff. Problem I'm having is that for some of the results, when I click the link to go to the full details page, no information is returned by the script. I basically end up with my html template & no data populated. For the majority of items, things work just fine. One thing I've noticed is that it seems to be reproducable - that is, for example item 5123 always fails to return any results on the full details page. Quote:
View Replies !
Can't Configure Php4 With Postgresql 7.4
looking for help getting php4 to work with postgresql I first tried the following; ../configure --with-pgsql and got a --with-pgsql comand not found error I then tried; ../configure --with-pgsql=/usr/local/pgsql/lib/libpq.so and got --with-pgsql=/usr/local/pgsql/lib/libpq.so: No such file or directory but I check and libpq.so is there with a link to libpq.so.3.1. Has anyone run into this problem and gotten it to work?
View Replies !
PostgreSQL - Copy Table
I have 2 postgreSQL databases called "DATA1" and "DATA2" with several tables inside them (table A, B, C). I modify the details in table "A" in database "DATA1" How can I copy table "A" from database "DATA1" and paste it in database "DATA2" using the same table name ??
View Replies !
|