Stripping Data Help Needed
I'm taking text from a textarea object and want to strip out
characters other than A-Za-z0-9 before I send the data to MySQL table
- is there a function I can use to do this in PHP?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Reformatting Data In MySQL Database And Stripping The String
I have imported data via ODBC into MySQL and one of these fields is the web address. now due to the fact that MS Access formates the web address string differently, it has imported like so: www.acordis.com#http://www.acordis.com# I am initially looking to reformat this to the standard web address in the field. The second part is to strip this address and output the domain name into a separate field in the same table. i.e. from http://www.acordis.com i am looking to add acordis.com to another field called domain. Does anyone have any suggestions on how i may approach this?
Striping Data Help Needed
I have a need to completely remove links from a large number of text documents. I know that I could simply use the "$strip_tags()" functon. However, I have been asked to remove the entire link, text and all. There are several links per document in random locations throughout each document. So, how could I remove text from between <a and a> and then remove the leftover <aa>? (Or similar method) Is this even possible?
Varifying Forms Text Data Help Needed
I bought the PHP and MySQL For Dummies book and I'm having trouble understanding how I use PHP to verify and check forms input text data - the book shows snippets of code so I know how to do the actual check but I don't understand what web page the php checking code should go into? For example, I have a simple login web page (username and password) and then it calls my mainmenu php web page - I want to make a check that a username was actually typed in *before* calling the mainmenu php page - I also know that I can do this check using javascript but I'd like to stay in php if I can - how can I make the check and stay on this login form before calling the mainmenu page?
Suggestion Needed On Data Storage Format In Text File
The project I am developing doesn't involves database. I want to parse the mailbox file (.mbx) and store the summary in the text file for fast retrieval and display of information in the Inbox page. The sugegsted format are as: #1 ID [4 bytes]: Subject [100 bytes]: To Address[100 bytes]: From Address[100 bytes]...etc... #2 Instead of preassining fixed size to variable (as actual data may be much less or can grew to more), we can store the values continuously, seperated by some unique seperator (#|#, *#*, ...) 1324#|#Hi, How are you#|#me@google.com#|#you@google.com#|# ... and so on Which of these will be the efficeint one (as there will be frequent insert/delete/update of the individual information, eg. set message as read ..., delete message ..., new message ...) Also please suggest on how to determine the variable size (100 bytes as in #1), and assign the size to the variable accordingly and read it (differentiate multiple variables) when required.
Stripping
I have a small mail system for my site, however I need to sanatise any use input... I an familiar with: <?php $output = preg_replace("/[^a-zA-Z0-9s]/", "", $input); ?> to restrict the input to text and numbers only, however, I need to also allow spaces, dots and commers. So could somebody help me add these into this?
Stripping Xs Spaces
I have a string that contains words and spaces. I wan't to make sure there is only ONE space between each word.
Stripping Qoutes
My problem lies somewhere in the str_replace or preg_replace area. I have a function of regexp that sorts through a string no problem, but when I want to actually use a file instead of just a string it throws a fit. The file is a viewsource file(not sure if this is the best way) that I just go through for some variables to load into flash. Long story short when I try and open the file into a string or array it loads as an html page and doesnt display the txt file. Also if I try to copy and paste into a variable because of the qoutes ' and " it just throws abunch of errors and the file is too large to worry about putting in delimiters. Code:
Stripping Html
The TitleField in my DB reads: Some title <span class=BoldRed>*</span> This shows up correctly, with the asterisk in the correct format, when shown on the web. I also want to show this field without any of the formatting; i.e. Some title * I've tried: $notags = stripslashes($row['title']); and also $notags = htmlspecialchars($row['title']); but still get the tag info. How can I get rid of it?
Stripping Variable Name
Any easy way to strip variable names? As in: $iwantthis = 7345; I want some way to then have another variable with the value: $variable = iwantthis;
Stripping Characters
I need to strip whitespace, as well as character codes such as , , and from strings in PHP. I've tried using 'trim' but there seems to be a problem with it. The problem is, the strings I am formatting are being extracted by the XML SAX parser. So, in the event that it reaches a & character, for example, it is stored in the string as '&', with nothing else... but 'trim' doesn't seem to like this, and strips it anyway. What I need to strip EXACTLY are all characters, and all leading whitespace. Sometimes an entire string is JUST whitespace. Using 'trim' does work, but again, we run into the problem with special characters.
Stripping Out Characters
I have a group of names that I am gathering, a few have apostrophes. I need to search each string to see if it contains an apostrophy such as strstr(). But then if the string has a apostrophy strip it out and glue back together. Example: D'angelo Dangelo
Stripping Pages
I wanna make a script that will strip a web site page just for the information, then put specific information into variables for further use. I don't want it done for me obviously.
Stripping A Part Of The URL
I am planning to make a site where users can enter a video's url (youtube and such) and the video will be embedded into our site. Code:
Stripping A Domain
How to strip a domain name alone from an URL. For eg, User enters http://www.phpfreaks.com/forums/index.php?action=post;board=1.0 in a field. I need that to be converted into http://www.phpfreaks.com/ How do i do it ? Also how do i make so that http://phpfreaks.com/ is converted into http://www.phpfreaks.com/
Stripping Out Spaces And New Lines
I am trying to write a script that will go in to an included php file, strip out some things and save it back out. So far, so good. The problem is when netscape navigator gold editor is used it does some things to the code that is creating havoc when the page is displayed. I wish that using that as an editor was NOT a choice but that is what the client uses sooooo... Anyway, here is the problem:
Stripping Chars Before SQl Insertion
I have a form with an input box that the user puts in a dollar amount. I dont want them to put a dollar sign or anything else apart from the currency amount (1.00, 1,658 etc). How would I achieve this?
Webdav Stripping Out My Php Code
I am using a webdav to test my code in.. but if I 'get' the file after I have uploaded it to fix something it strips out all the php code from the file.. so I am just left with the html.
Stripping Characters From Strings
I'm looking to setup an automated email address generator based on information being provided (that information being a selected email address prefix and the user's firstname and surname). I am trying to get the first character from the firstname but don't know how to do this. e.g. firstname is eric. I want to get the 'e' from it.
Stripping Chars Before SQl Insertion
I have a form with an input box that the user puts in a dollar amount. I dont want them to put a dollar sign or anything else apart from the currency amount (1.00, 1,658 etc) How would I achieve this?
Preg_replace: Stripping Backslashes
I've been going mad trying to figure out how to do this--it should be easy! Allow the user to enter '\_sometext\_', i.e., literal backslash, underscore, some text, literal backslash, underscore and, after submitting via POST to a preg_replace filter, get back '_sometext_' (i.e., the same thing with the literal backslashes stripped) Unless I'm misunderstanding something (I don't know Perl at all), this should work: preg_replace( '/\\_(.*?)\\_/i', '_$1_', $thepostvar ) but it doesn't, and I don't know why. The filter apparently leaves the string unchanged, since it comes across in the POST array with the backslash doubled, and it comes out of the filter with the backslash still doubled. It doesn't seem to matter how many backslashes I use in the filter--I've tried between 4 and 10--the result is the same.
Stripping Non-ASCI Characters
I am currently using the following code to strip out non-ASCI characters for XML feeds. Is there an easier and less processor intensive way to do this? $char_range = array_merge(range(33, 45), range(58, 64), range(91, 96), range(123, 255)); $char_range = preg_quote(implode('', array_map('chr', $char_range))); return preg_replace('/['.$char_range.']+/', '', $subject);
Stripping MIRC Text Formats
is there a way that i could strip off mIRC text tags like : astring 11,12with colors and bolds 8,12 making it just : a string with colors and bolds
Stripping Characters From A VARCHAR Variable
Is there a way to remove characters from a VARCHAR variable? Take the $year variable. In my database the year is stored as a 4 character VARCHAR. I want to process the variable so that the first two characters are discarded, leaving me with a two character variable. $year = 񟬴' &newyear = $year - first two characters $newyear = ྔ' Can this be done?
Multiple Explodes And Character Stripping
I've got a fairly tough data string to manipulate and I could use a little help. Here is the data I am presented with (mysql column): <BR>OPTIONS: <BR>Black color, <BR>Large size The number of options can be basically unlimited, but generally less than 20. I need to take the data above and get it into these hidden tags. <input type="hidden" name="eop_color" value="Black"> <input type="hidden" name="eop_size" value="Large"> the eop_ is hardcoded, but the "color" or "size" is drawn from the db. Here's what I've got: PHP Code:
Stripping Quotes From Form Input.
Is there a (better,quicker,easier) way of stripping anything other than text, and numbers without using an if statement to catch errors, and have them re-enter the info? I'd rather just strip them all together. Something like.. if I want to stip out anything other then the alphabet, and 1-9, so I don't have entries that look like this.. Quote: ..%blah''''""""";blah!!!@@@~``
Stripping A Query String From A Header...
I am getting headers using getallheaders() and I need to strip the referrer query string...example: $HTTP_REFERER = http:///www.website.com/page.php?pa...s%is%the%error! I want to strip the query and just get this: http:///www.website.com/page.php
Stripping Commas From Real Numbers
I have an HTML form in a PHP script which queries the user for a dollar amount of sales. If a user enters "1,000,000" rather than "1000000" for 1 million, PHP (or MySQL?) treats the commas as a decimal and "1" is entered in the database. A simple work-around is to simply advise the user "Please enter numbers only, no commas or $'s" but this seems awkward. Is there a built in function or another easy way to have commas and currency signs stripped out of form-entered data?
Stripping Special Characters For Email
I've been given a form that simply takes some user input and relays a message. I've done this a hundred times before, but apparently, I've never taken into account all the special characters. I have tried any number of Google result suggestions to strip out the special characters that are being encoded in a strange way (specifically MS Word chars). Code:
Stripping Non-alpha Characters From MySQL
We've developed a labeling / tracking system for one of our clients. The number that's generated is a combination of the customer's ID number, lab ID and an auto-increment ID number. To keep it straight, we're storing the label numbers in MySQL like this: 0003-0058-00001 HOWEVER, we didn't have enough space on the label to include the dashes. So when our customer uses the admin we built for them and does a search for a particular label, they'll be searching for a label number WITHOUT any of the dashes, like this: 0003005800001 So the question is... how can I write a query that will match those up? I'm hoping there's something in MySQL that I can add to my query to just strip out the hyphens. Any ideas? SELECT * FROM labels WHERE ????? label_number=?'
Replacing Characters + Stripping HTML
I have a HTML parser that reads product pages from various retailers - and I want to optimize it somewhat: I download all HTML before I start the parsing - and to do that I want to: - Get rid of all HTML parts that I don't need, i.e. <head>, <title>, <javascript> etc. I'm considering using eregi_replace for this. Anyone have an example of how to set this up ? I tried this with no luck: $string = eregi_replace("<head>*</head>","", $string); - As some pages have special characters, I'd like to redo these to normal characters for ease when setting up new parser. Right now I have this (which I'm sure is not the fastest/best way): $cont = str_replace(".",".",$cont); $cont = str_replace(",",",",$cont); $cont = str_replace("£","£",$cont); $cont = str_replace("€","?",$cont); $cont = str_replace("'","'",$cont); $cont = str_replace("-","-",$cont); $cont = str_replace("(","(",$cont); $cont = str_replace(")",")",$cont); $cont = str_replace("[","[",$cont); $cont = str_replace("]","]",$cont); Any ideas to improve on this?
Stripping Of All Spaces And Line Returns From A String
When I get a string from a form feield being sbmitted from a web form, I need to strip out all non needed spaces, remove all carriage returns and line feeds, to essentially give me one long line of text for the string. Does anyone know of the code that woudl help me acheive this?? I would be greatful if Anyone could help me with this little problem. I have heard that ereg_replace can use a lot of CPU so I would like a solution with speed considerations.
Stripping HTML Tags With Regular Expressions
So I need a regular expression to strip out all HTML tags EXCEPT the ones I've allowed. I think I almost have it, but I can't get the negation right.. "/</?(^IMG|A|FONT|B|I|U|STRONG|EM|CODE|PRE|H1|H2|H3|H4|H5|H6)(.*)>?/i" Now the ^ isn't negating because it's not in a class. So how would I negate all those tags (meaning match anything EXCEPT those?) Also, what's a better alternative to the .* match so that they can't just throw a newline in there and **** things up?
Stripping Quotes Out Of A Comma Delimited File?
I have a flat file that I'm trying to stick into a MySQL database. One record per line, multiple fields per record, and many of them are null fields which are just double quotes without a space between. It's probably nothing really major for people who have done this before, but I'm a bit stumped. The file is comma delimited. Every field is surrounded by double quotes. I've done quite a bit of searching, on the php site and elsewhere, but I can't seem to get it to strip the quotes out so I can explode the file line by line to grab the fields.
Stripping Html Text And Newline Characters From String
I have used the strip_tags function to remove html from a string with reasonable success. But it still leaves /r/n characters. I've hunted around on various forums for solutions, and every time someone suggests a solution, it actually doesnt work. Code:
Cleaning User Input (Removing HTML/stripping Slashes Etc...)
How can I remove HTML and add slashes to a variable? I know I can add slashes with addslashes($var); but I need to know how to remove all HTML at the same time. Also - Are there any other characters I should strip from the variable (it will be stored in a database and displayed on a web page).
Help Needed..
I am Ronny from Germany, so please excuse my English. Since early 2002 I am trying to solve th following problem: I am trying to programm a meta search engine - which fetches the results of about 10 search engines. Now I solved the problem with fopen(), fread() etc. But it is to slow - and so my question is : Is it possible to make several http requests at the same time in PHP or do you know a Perl Program where I can put in maybe 10 URL´s and the results where saved in an array which I can use in PHP???
NOW() Help Needed
I am putting data into a mysql database, the database tells me the time a user signed up, this is placed in the table using the now function but the date always shows as 2002/11/06 not how i would like it, i want it to view as 06/11/2002, i think it can be manipulated in many ways. Also on manually updating a further table i have to place in a date manually, when i put the date in the fiels using phpmyadmin the date still looks like 2002/11/06, i try change the value but with no joy.
Help With Regexp Needed
Hello, I'm coding a simple templating system to fit in to my simple CMS system. The way this will work is that the administrator of the CMS can edit the template (stored in a db), and insert 'snippets' into the template. A snippet is a piece of code (also stored in the db) which may have PHP code in it, which will then be eval()'d. A simple example would be: <html> <head> <title>[[title]]</title> </head> <body> [[menu]] [[content]] </body> </html> The snippets here are [[title]], [[menu]] and [[content]]. This is fine as long as I know exactly which snippets will be in the template, but that's not always the case. So what I want to do, is search through the string containing the template, find all the snippets and save these in an array. My guess is that this'd be done with regular expressions, but I'm still very new at those, and have no idea how to do what I want. Does anyone have an idea about how to do this? Thanks! Alex
PHP Developers Needed
hello, My name is Joshua Abbott and I am project administrator of the AWHCP project on sourceforge.net. Our project is aiming to create an advanced web hosting control panel of 350 end user features (once final release) and a lot of security features in a packaged OS called extremeserv-linux @ extremeserv-linux.com . We desperately need PHP Developers to help in this endevour. So, if you are interested or want more information please email URL
Help Needed In Sending SMS With PHP
I want to know the process and the Implementation of sending text SMS to mobile phones with PHP. Is there any article regarding this? or any code example?
Nusoap & XML Help Needed
I am getting below result when accessing a web service. Now how can I separate the values and assign them in variables for further use?
Help Needed With DB_DataObject
I have just adopted a PHP project and need some help understanding DB_DataObject. I've looked around on the web and can't find a simple explanation. Basically, my MySQL database has no tables. I have a createTable.php script which I believe is a standard script, it runs but tell me "NO TABLES". There is a function in the script called _createTableList() which is looking for tables not finding any (I don't really understand why there should be pre-existing tables when the script is supposed to be creating them...) I have .ini files which seem to describe the schema, and classes which correspond to the entries in the .ini file - but no SQL, and I do not understand how to get the schema into the database. I believe the environment is set up correctly for the script to find the .ini files. I hope that was clear, and I hope somebody here can advise me - I'm sure it's simple enough for somebody who knows what they're doing with DB_DataObject! Using PHP5 btw, if that matters.
Help Needed With Nntp
Im having trouble with a script trying to display newsgroups. The script just hangs when trying to select a newsgroup (fget command)....
New Line Help Needed
I'm trying to insert a newline character into the string below for an <INPUT TYPE="image" ALT= tag but when I hold the mouse over the image I see the string but without a newline break in the string - how do I get the line to break?
Sql Optimize Help Needed
SELECT * FROM post WHERE forumid=1 ORDER BY ctime LIMIT x,10 ctime=creation time both forumid and ctime is index separately it take too much time when x is so large. how can i optimize this query?
Help Needed In IMAP+PHP
I am having a mail client script, which will read and send mail to mail server, using IMAP. When i am sending mail with attachment through forwarding, the attachment is not getting attached correctly, Plz any one can help me to come out of the problem. Note : I am using PHP 4.3.10 + IMAP + Apache +Zend Engine v1.3.0
|