Identifying Parts Of A String
$url = /blah/elephant/spaghetti/page.php
This gives you the whole path.
But how can you identify each directory in the url individually?
ie. I want $one to equal 'blah', $two to equal 'elephant' etc.
View Complete Forum Thread with Replies
Related Forum Messages:
Identifying Different Unicode/utf-8 Types Inside A Text String
I am dealing with a script that reverses a string that is in hebrew, so I can display it properly when I write that string onto an image, however sometimes the string might be half hebrew half english, so I need a way to identify what language is in the string and only reverse the hebrew parts. in technical terms the hebrew text is encoded in utf-8, and the english text will be encoded in the normal encoding for english, (anscii, latin-swedish whatever, i dont know the name of that encoding) so the simple question is how do I identify different types of encoding within a string? that way I can break up the parts that i identify as being utf-8 and reverse only those (yes I am well aware of methods to display hebrew properly in php, but when writing to an image this is another story, only method i found so far is reversing the hebew text string)
View Replies !
Separate Parts Of The String
I get a string from reading a cookie that looks like this: "View=MyName&With=MyPassword" Not sure why it was set up like that, but...I need to weed out MyName and MyPassword into separate strings for later use.
View Replies !
Isolate Different Parts Of A String
Supposing I have a string, $string="hello.world.today"; Is there any function I can use to isolate everything after the last ., so it would output "today" on its own? I'm trying to isolate the file extension of a URL (for example, www.whatever.com/index.php -> isolate 'php', or www.google.ie/index.html -> isolate 'html').
View Replies !
Cutting Parts Of A String
ive got 1/2 of what i was trying sorted out however i now need to get rid of some of the junk, i ned to strip the ?? (chr(0) and also the = sign and obviously the tag name i was thinking of an array containing the field names i.e. Artist loop through the array and compare it with the variable, if it is there use str_replace and cut it out? and same with the = and chr(0) i was wondering tho is there any way i can do it without needing a number of different statements Code:
View Replies !
Missing Parts Of String
i have a PHP prog. It sends a simple select query to mysql and shows the results on a html form. But two Strings are not whole. For example orderName is in the database like this: "Akku Siemens C25 C 28 C 25 Li-Ion" on html form i see only "Akku" when i use echo outside of the form i see the result correctly.
View Replies !
Replacing Parts Of A String
I want to display only the last four digits from a credit card number. I can't figure out how to either split or explode the string containing the card number. i.e. $str = ?' How do I split or explode it to have access only to the last four digits?
View Replies !
Extract Parts Of A String
I need some sort of preg_extract capacity (made up function name I wished existed). I want to match and return parts of a string based on a regexp pattern. Lets say haystack is "varchar(200)" I want to assign to variables "varchar" and "200". Here is my first attempt. $haystack='tinyint(1)' //$haystack='varchar(200)' $type=preg_split('#[a-z]*(#i',$haystack);$type=$type[1]; $length=preg_split('#([0-9]*)$#',$haystack);$length=$length[0]; print_r($type);print '<br/>' print_r($length);print '<br/>' it outputs: 1) tinyint I've stuck for changing the regexp pattern to not include the trailing ) on the first output or finding a better more efficient way of accomplishing the goal.
View Replies !
Editing Certain Parts Of A String
I am working on a script, and for it i need to edit certain occurances of a string within another string. Its not your basic str_replace type of thing. I will have a string like: "Hi, How are you today, are you ok?, i hope you are" Ehh, well not exactly like that haha but thats only an example. And with that i want to replace just say the second "you" I think i have it sorted out about how to get the position of only the second "you" with my own strpos function. But how when i have the pos, how would i edit only that part of the string.
View Replies !
Splitting A String Into It's Parts
I have a string, let's say "qx1234," which I would like to split into two parts, "qx" and "1234." Is there a funtion other than "explode" that performs this task? Maybe something such as "Left" or "right" functions? If I need to use "explode," how would I do that?
View Replies !
Replace Part Of String In Between Two Other Parts?
I'm trying to do is an str_replace or something within only a set of other strings. What I'm doing with some text that I put into a database is added a <br> whenever the ASCI character 10 (carraige return) comes up. It's like this. $text = eregi_replace(10, "<BR>", $text); what keeps happening though, is that when I make an HTML table in the text, it adds a <br> to that too, and since it's inside the table, it just adds the newline to outside of the table or something and screws everything up. So, what I want to do is only have it replace the newline with a <br> if it isn't inside of a <table></table> string. I've been all over the PHP documentation and have yet to see something that might work.
View Replies !
Function For Breaking A String Up Into Tiny Parts
I've been searching high and low to find a function for breaking a string up into tiny parts. For example, I would like "hello.php" to become... h e l l o . p h p I have checked out the explode function and various other string handling functions. HOWEVER, all of the functions I've looked at require you to declare a character to trigger each breaking up point. I don't want to do that. I want it to break up every single character (not whenever there is a space, as most demos seem to do).
View Replies !
PCRE Regex Function To Get Parts Of A String
I am using a PCRE regex function to get parts of a string. my current pattern is: $pattern = "/<([^s]+)s+([^s]+)s+([^s]+)s*></a>/i"; and my string is: $string = '<a href="123" href="456" ></a>' This will match. The problem is that ([^s]+)s+ in the pattern is repeated. in the string it is: ([^s]+)s+([^s]+)s+ How can I change my pattern so that ([^s]+)s+ does not need to be repeated like this. As I am capturing the output, I can not use (([^s]+)s+)+ as it will only capture the last string match, not all of them.
View Replies !
Removing Parts Of A String Before Creating An Array?
Okay, in my database, one of the fields will contain information that looks like: p.php?o=111, p.php?o=222, i.php?o=233, i.php?o=999, p.php?o=444, g.php?o=765 And after my query, I want to create an array based on this field, but I only want the items that start with "i.php..." in the array. Not only do the numbers after the "=" sign change, but the "p.php" parts change too, so I won't know exactly what the values in this field will be. I looked into functions like eregi_replace, but it seems like I need to know what I'm replacing before it's being replaced. I also looked into making the array first and then trying functions like array_slice, array_search, and array_filter, but I'm running into the same problem.
View Replies !
Regular Expression That Will Split A String Into Several Parts With ',' (comma)
with a regular expression that will split a string into several parts with ',' (comma) as the separator, but NOT where the separator is enclosed in parentheses. For example, take the string "field1, CONCAT(field2,' ', field3) as field23, field4". I would like to be able to split this into the following: [0] field1 [1] CONCAT(field2,' ', field3) as field23 [2] field4
View Replies !
$parts = $struct->parts;
Turning on error_reporting(E_ALL); was quite an eye opener as to how much "fixing" PHP will do for the sloppy coder. I fixed all of the errors except: Notice: Undefined property: parts in /ContactManagement/contact_mainpage.php on line 120 where the line in question is: $parts = $struct->parts; where $struct = = imap_fetchstructure($in, $mid); $struct is an object, parts is an array of objects what would the correct syntax of the statement be ?
View Replies !
Identifying Browser
Is there a way to identify the brwser a visitor to my site is using? I would like to include site style based on the visitor's browser. If their us IE show layout one way, if their using Firefox show it another way...etc...etc.
View Replies !
Identifying People
on my website i'm finding people are coming back and signing up again and again... how can i log them so i know who has logged in before. was thinking IP but does this not change per session online with dial up?
View Replies !
Identifying A Value Range
i have a form that submits to a php file, the form basically has a hidden field called number: <input type="hidden" name="number" value="12"> i know how to read the value of that, its simply putting <?php echo $_POST['number']?> but what i want to do is check if the number is between 1 and 25 and if it is then echo A else if it is between 25-75 then echo B else if it is anything above 75 then echo C .
View Replies !
Identifying SSL Clients
I have a site that uses PHP sessions through SSL, my employer does not wish the site to require cookies so I have switched on the use_trans_sid option for users who have cookies disabled. The problem I have is stopping session hijacking. If I am on a page "https://secure.mysite.com/page.php?PHPSESSID=XXXXX" And I email the url to someone else they can get onto the site without being challenged for a logon. I am trying to find a way to check that the connection is still coming from the same SSL connection, e.g. by checking the clients public key, but I can't find a way to get any information about the SSL connection from PHP.
View Replies !
Identifying An Image
Ive got a tracking system which tracks how many times a user clicks on an advert on my site. At the moment all the listings are set as one so when a user clicks on that advert it gets one click. However, one of the adverts is now going to contain two images advertising two separate companies. Ive set it up so the images and urls are different and they go to their own websites and in my tracking table i have just added an extra column called image and the number 1 goes in if image 1 is clicked on or 2 if image 2 is clicked on. However, to display this is the bit im not sure about. At the moment its displayed in a table like this: Advert Name Category Number of clicks Advert 1 Shopping 257 However, if advert 1 has two images, meaning two separate companies, how can I show this in the above table?
View Replies !
Identifying The Clicked Record
i already know how to load the my list of suppliers using mysql/php/apache, but what i would like to do now is put a link for each and every supplier and when someone clicks it, they will automatically go to that supplier's list of products. i want something like this: SUPPLIERS TABLE supplierID, Name, Address, AA Alfin21 1506 w. 66th street <>EDIT<>
View Replies !
Identifying Search Engines
my website is pretty much database driven and i've typically parsed the data in PHP and just output flat HTML. however, i'm trying to save some badwidth by spitting out just the critical information, and have javascript parse out the data. however, i'm kinda worried how search engines would react to this. (especially google) would search engines ignore the keywords if they are inside javascript tags? how do i detect search engines? maybe i can just setup a special script that output's "search-engine-friendly" output.
View Replies !
Identifying Black Images
I would like to be able to identify completely black images in order that I can exclude them. I am thinking I could use gdlib but I cannot find a suitable function. If I can find the rgb of the image then I can exclude it.
View Replies !
Identifying Individual Users
I know that you can identify users using an ip address. But what if you have several users with different computers in one room sharing the same ip address. Is there anyway to differentiate each individual. Is there a unique signature from the computers that can be used?
View Replies !
Identifying Off-site Links
Is there an easy way to identify off-site links using php? For example, on a forum site like phpbuilder.com, I'm looking for code to flag posts that contain: Code:
View Replies !
Identifying A Page Via Hyperlink
I have a page (product_wide.php) that displays sale items. In that page, I "include" a 2nd page that contains hyperlinks to general item categories. The hyperlinks in filternavbar point to product_wide, and display items from the category selected. I need a way, using the same hyperlinks I am using now in filternavbar, to tell, from product_wide, that it was from filternavbar that the link was clicked (as opposed to some other page in the site that takes you to product_wide. I can't change the configuration of the filternavbar url because of duplicate content issues with google.
View Replies !
Identifying Dynamic Form Fields
User goes to page which is a form that asks for some basic info regarding returning products for credit/exchange, and also asks for how many products are going to be returned. Upon submitting, a return authorization form is presented to them with the specified number of product fields. I now want to take the input from this form and email it to myself, as well as, display a confirmation page to the user. The problem I have is a can't say, for instance, echo "$field_name"; because field_name will get created dynamically after the user specifies how many products to return. For example, say the user says 5 products, this will generate a form with field names like: return_code0 inv_num0 qty0 product0 cre_exch0 stockout0 return_code1 inv_num1 qty1 product1 cre_exch1 stockout1 return_code2 inv_num2 qty2 product2 cre_exch2 stockout2 and so on.... These get created with a for() loop. Once this form is submitted, how can I address the field names? Code:
View Replies !
Identifying Non-Supported Characters In A TTF File With GD?
I've managed to get GD working (mostly anyway) on my site - and am utilising the "imagettftext" function. I am using this function to display individual characters on my website - with a nominated Font. However, sometimes the characters in my StringText are not supported by the particular font that I am using ... Directly from http://www.php.net/manual/en/function.imagettftext.php imagettftext - "If a character is used in the string which is not supported by the font, a hollow rectangle will replace the character." Can anyone suggest some code that would: 1) compare/look at the StringText supplied within the "imagettftext" function (in my case the StringText will comprise of a single character only) 2) where the supplied StringText (ie character) is NOT supported by the font, then I need for that character to be reported as not supported. ie. either; return a flag or skip the non-supported character entirely - rather than displaying the standard "hollow rectangle".
View Replies !
Identifying Opening Link For Database Query?
I've got a tricky problem i need to solve, i'm building a banner exchange type site in which there are already about 100 banners so i've had to code things around what already exists to a certain extent. Now each of the banners that go out on other sites have a link on the banner which pops open a window with details of the banner. this would be fine if all my banners were gifs and jpgs but there are also swf and dcr banners so i have no real control over the actual link on the banner. up until now each banner had a html page made for it so when you clicked on a banner it would open a page banner_1.html which had the details of that banner. for obvious reasons i'm going to replace all these redundant pages and put a htaccess redirect at their url to all redirect to a common page popup.php so all details will be dealt with in one file. ok this is fine but my problem is in this page popup.php i need to identify the link that just opened the window so that i can then get the info from the database to put on the page.. remember i can't use the url like so... bannerpage.php?thisbanner=1 but all existing links have unique addresses, is there a way to do this, i'm pretty sure there must be but i can't get my head around it?
View Replies !
Identifying Auto Increment Values For Each Of The Fields
I have set up a database i mysql, identifying auto increment values for each of the fields (eg AdminID). I was wondering how i can set up a form which will, when i go to add a new member, have the autoincrement value already present in the field and i can continue to input the rest of my data as usual.
View Replies !
Identifying User's Pick From Selection List
I have an application that uses PHP to access a MySQL table and extract rows which match the user's search entry. Data from the matching rows are loaded into an HTML selection list, and the user can scan the list and highlight a selected item. My question: In PHP, what is the syntax for identifying which row is highlighted? My goal is to pass the unique row ID of the selected item to a subsequent form where all the fields will be displayed for the user to edit. I already have the code that loads the selection list and the code that displays the fields. I just need to know how to determine the highlighted item. I have two PHP books, and both discuss loading the selection list, but there is no mention of what to do next.
View Replies !
Form, Type=file And Identifying By Isset()
Windows XP PHP 4.4.2 Apache 2.2 Register_Globals = Off Safe_Mode = On ----------------------- Hi All, I am having a problem getting a file browse input field to be recognized on the next page. Let me show you... page1.php Contains a web form with a file input to attach a file using a browse button. <form method='POST' action='page2.php' enctype='multipart/form-data'> <input name='uploadFile1' type='file' id=uploadFile1'> page2.php contains a validator to check the input and perform an action based on whether or not the browse input field has been populated. // IF THE POST CONTAINS A FILE UPLOAD, PROCESS SECTION 1 IF NOT PROCESS SECTION 2. if (isset($_POST['uploadFile1'])) { echo "File is attached so print this."; } if (!isset($_POST['uploadFile1'])) { echo "File is NOT attached so print this."; } If the user uses the browse button on the form page to populate the field with a file path to a file on his pc, then I expect to see the "File is attached message". However, regardless of whether someone does or does not browse a file, the message is always that they have NOT browsed a file and the variable "uploadFile1" is effectively left unpopulated. OUTPUT File is NOT attached so print this. Conversley, I thought I might be able to use the _FILES variable instead of _POST, but I get the exact opposite, that the browse field is populated all the time whether or not someone has browsed a file or left the browse field blank. if (isset($_FILES['uploadFile1'])) { echo "File is attached so print this."; } if (!isset($_FILES['uploadFile1'])) { OUTPUT File is attached so print this. So, I am missing something. Can someone give me some direction so that I can simply identify (with register_globals = Off) whether or not an input field (input type=file) has been populated or left blank? Is this even possible? What am I missing?
View Replies !
Voting System - Identifying Voter And Integrity Of The Vote
I am trying to setup a voting system for our intranet (staff awards - free text fields). I have the database adding the votes no problem. What I would like to do however is the following: 1. It's our intranet, there is no need for each person to login so it just uses "user/user". However I need to capture the person's login on the vote record so I can identify who voted. 2. restrict the users to one vote each. I have done some research and it looks like I have to create a cookie.
View Replies !
Selecting Certain Parts Of An Id
I have message board post IDs like 34.148 or gdis.9834 the bit before the full stop is the forum ID and the bit after is the post ID. What I need to do is select the forum ID and the post ID separately (without the full stop) how would I do this?
View Replies !
Selecting Parts Of An ID
I need to select certain parts of my ID's. They are stored like this: //ID// A10-0 A10-1 A124-0 A124-1 A124-2 A28-0 Now I just need to select the parts shown below: //ID// A10 A124 A28 So somehow I need to snip the text off after or before the "-" How can I do this please?
View Replies !
Random Parts
I'm making a down-n-dirty captcha for one of my sites, but I need some help. I've pulled random values using MySQL, but in this case I'm not using a db to store anything, so I don't know how to do this. I've made a verification box in the user registration where the registrant descrambles a motorcycle manufacturer to register. What I need to do is for the form to pick a different preset manufacturer and then scramble it differently each time. Honda Yamaha Suzuki And we'll take Honda. It might come up onHad one time, and dHoan another. How do I do this two step obfuscation process?
View Replies !
Meaning Of Specified Parts Of This Code
if ($result) { $rs->datums = mysql_fetch_array ($result, MYSQL_ASSOC); What does -do after the recordset variable $rs? Is datums a field name or something else? I have a text by Larry Ullman and have searched the web for these 2 answers with no result.
View Replies !
Select First Parts Of Variable
I have a bit of code that selects the first 5 words of a variable: $short = join(' ', array_slice (explode(' ', $posmes['message']), 0, 5)); Works great, butI want it to select the first 30 Characters instead... How do I change it from words to characters??
View Replies !
Parts Of Page Disappearing
I have a message board page that displays one page of one forums' messages using pagination. It all works really well unless there are no messages in which case nothing below the bit in the pagination code that echoes 'first prev [1] [2] ... next last' is shown. Below this section I have the form to add a thread and some links, but they aren't shown because of this problem in the script. This means that the first message in each forum can only be put in from PhpMyAdmin or by a script I make specifically for it. Code:
View Replies !
Drill Down Through A Parts Database
I want to create a DB that will contain a selection of car parts. I want the user to select a make. Then select a model. Then select a type of car part. What is the best way to do this. Should I save the make and model as a cookie and then search the whole DB or is there a better way?
View Replies !
Download A File As Parts
I need to download a file as parts, like take the first 1 mb of a file and next mb and so on. Also the download has to be using only the resource url as input.
View Replies !
Cuting Out Parts Of A Image
im intressted in a function that can cut out a part of a image. I know that there should be a way to do this with PHP, but i can't seem to find the correct functions that i need to creata a own function to fix this. Does anyone know wish functions that i might need from www.php.net/image
View Replies !
Parts Of Date From Datestamp
I have the date stored in db. How can I using PHP and not MySQL get the parts of the date separately, i.e. PHP Code: 2005-01-25 $year = ��' $month= ༽' $date = ཕ' it's only 7 am and I already had two cups of coffee.
View Replies !
Looping Parts Of A Function
I have a function that queries URLS for certain keywords, but at present it stops after the first 10 I want it to be able to carry on for as many as i require so lets say 1000 $start is the variable that denotes the starting point How do i get it to loop, so that it keeps doing it for $start =10 then 20 etc right up to 1000 the function is Code:
View Replies !
Regex To Get Sql Statement Parts
Does anyone have a regex (or knows how to make one) that will get the parts of an sql statement? $sql = "SELECT (* or 'id, username, etc') FROM `(tablename)`, [WHERE `id` = 1 and `username` = ".$username."][LIMIT (#)]" it should return the following array: $returnd_val = array( 'fields'=>''(* or 'id, username, etc')", 'table'=>"(tablename)", 'where'=>"(`id` = 1 and `username` = "joe user")", 'limit'=>"1" ); A similar regex for update, delete, and insert would help too.
View Replies !
Extracting Parts Of An Html File
Given a regular formed html document, what would be the easiest way to grab 3 parts of the file? 1- everything from beginning of file up to and including the <body> tag 2- everything between the <body> and </body> tags 3- everything from and including the </body> tag to the end of file Storing the contents of the file into an array I think would be best but I can read the 2nd set into an array if I could figure out how to isolate it.
View Replies !
|