Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Exploding At Real Breaks Not Wraps


I am working on reading my  pop3 email , and I am trying to return the header data using the function, I get this fine. The question I have is since there is no consistency to the rows, I want to take each row of data, not a wrap of a long line, any idea beyond checking if it has a : in it???




View Complete Forum Thread with Replies

Related Forum Messages:
Converting Html Code To Real Line Breaks In A Textarea
I am having some trouble with converting html code to real line breaks in a textarea, I have the following code that I gets html code from a database and then puts it into a textarea but the str_replace I am using converts the text but puts the actual characters in the textarea, and doesn't actually turn it into a linebreak. (the br below is reality in triangular brackets!)

$paragraph=$row['paragraph'];
$paragraph=str_replace('br','
',$paragraph);
.....
<textarea name="ud_text" cols="50" rows="15" maxlength="300"><? echo $paragraph ?></textarea>

Perhaps someone can help me with this?

View Replies !
Page Wraps
How do page wraps work so that if the search results go beyond like 15 itll go to a second page ... is there a built in function or do i have to manually make each page =/ ?

View Replies !
A Real Challenge For Real PHP Programmers
<?php
/*
A challenge to every PHP programmer.The one who's gonna solve this
problem would be deemed as

PSP(PHP Supreme Programmer).The problem is this : You have to write a
script that displays a list of

categories and subcategorieslike this one:

<select name="category">
<option value="1">Main</option>
<option value="2">Main > Computers</option>
<option value="4">Main > Computers > Hardware </option>
<option value="8">Main > Computers > Hardware > PC</option>
<option value="7">Main > Computers > Hardware > Mac</option>
<option value="9">Main > Computers > Hardware > Atari</option>
<option value="11">Main > Computers > Hardware > PC > History of
Pc</option>
<option value="">etc...</option>
</select>

The categories and subcategories details are stored in these two
tables in a MySQL database.
-categories : the categories names and ids.
-cat_relations : the relations between categories.It shows which
subcategory belongs to which category.
The belongings between categories can go very deep and the number of
categories is unlimited. This script will create the two tables and
fill them with sample data. All you need to do is to change the four
variables below. You can send the script back to this email :
yasbergy@yahoo.com.
*/

//Here starts the script. Please change the values of these variables
to fit your settings
$user = "prospective_PSP";
$database = "db";
$server = "localhost" ;
$pwd = "" ;
//Connection to the database that you created
mysql_connect($server,$user,$pwd) ;
mysql_select_db($database);
//Creation of the two tables : categories and cat_relations
$categories = " CREATE TABLE `categories` (`id` INT not null
AUTO_INCREMENT, `name` VARCHAR(100) not null , PRIMARY KEY (`id`),
INDEX (`id`), UNIQUE (`id`)) comment = 'The categories details' ";
mysql_query($categories) ;
$cat_relations = "CREATE TABLE `cat_relations` (`id` INT not null
AUTO_INCREMENT, `daughter_id` INT not null, `mother_id` INT not null ,
PRIMARY KEY (`id`), INDEX (`id`), UNIQUE (`id`)) comment = 'Which
category is the daughter of which category'";
mysql_query($cat_relations) ;

//Filling the two tables with sample data
$cats = array('Main','Computers','Countries','Hardware','S oftware','Programming
languages','Mac','PC','Atari','Winamp','History of the
PC','IBM','Components','High
level','USA','NYC','LA','Manhattan','India','Winzi p');
for ($i=0;$i<count($cats);$i++){
$sql = mysql_query("insert into categories (name)
values('".$cats[$i]."')");
}
mysql_query("insert into cat_relations (daughter_id,mother_id) values
(2,1),(3,1),(4,2),(5,2),(6,2),(7,4),(8,4),(9,4),(1 1,8),(12,8),(13,8),(10,5),(20,5),(14,6),(15,3),(16

,15),(17,15),(18,16),(19,3)");
//Now you can have a look on them through phpMyAdmin
?>

View Replies !
Exploding
how would I go about going more/less this:

Load everything from a specified page (such as www.site.com/userlist.html) , and then get everything that has something after userid= (NUMBER) .. for example.. if this is on the userlist.html :

userid=111
userid=222
userid=333

it will grab it as 111 222 and 333 , and put it the things that it exploded from into an array like this. Code:

View Replies !
Exploding String
I have a script I use to explode a string and grab variables. It works great on one server, but when I use it on a separate web site it doesn't work at all. This may be a permissions issue, but other php scripts work fine.

View Replies !
Exploding An Array
I have a file with multiple lines, each line contains information broken into three parts that is separated with commas:

FILE:

l0p0,l0p1,l0p2
l1p0,l1p1,l1p2
l2p0,l2p1,l2p2...

I want to use this information in a script, so I call the file using the following command:

$file=file("myfile.txt");

This breaks up the file into an array, with each key representing a different line.

I want to further break down this array efficiently as possible so that each line is exploded by the comma.

I'm wanting to get an output like this:

Array
(
[0] => Array
(
[0] => l0p0
[1] => l0p1
[2] => l0p2
)
[1] => Array
(
[0] => l1p0
[1] => l1p1
[2] => l1p2
)
[2] => Array
(
[0] => l2p0
[1] => l2p1
[2] => l2p2
)
)

I tried using this line: $file=explode(","file("myfile.txt")); but what it seems to be doing is just exploding the word "Array"

print_r $file[0][0] => "A"
print_r $file[0][1] => "r"

However, explode(",",$file[0]) seems to work.

How can I explode my array without having to do an explode command each time I want to use a value?

View Replies !
Exploding A Word?
HAven't figured this. I have a word like 'ABC' How would I explode this? My difficulty is that there's no separator to which explode by.

View Replies !
Exploding A String
Is it possible to have the results of an exploded string into 4 different arrays?? I have many lines of $strPingCurrentLine each containing url, email size and command details.

I therefore hope for a way to push each exploded $strPingCurrentLine into

Quote$arUrl = array();
$arEmail = array();
$arSize = array();
$arCommand = array();

Instead of for instance

$arTemp = explode(" ", $strPingCurrentLine);

View Replies !
Exploding Array
I'm having a bit of trouble here with getting an array to explode. When I echo it, its is simply writing "Array" 49 times.

Basically I just need to seperate my arrays with a coma so I can select those ids from my table. Anyone got any ideas? I'm new to php so I'm stumped. Code:

View Replies !
Exploding Every Character
Is there a way to explode a string into an array without using a seperator so that every character becomes its own item within the array?

View Replies !
Exploding Problem
I need to explode the key value for each item of the $_POST array. Code:

View Replies !
HEAD EXPLODING
i know this isn't right because it kicks out with an error, but this is what i've got. Code:

$get_locations = mysql_query("SELECT locationid, date FROM empty_locations
INNER JOIN location ON empty_locations.name=location.location_name").

View Replies !
Need Exploding Array
Let me attempt to explain my problem. I have a crude php script that
takes a text list of songs that was generated by an mp3 list program and
translates each entry into the form where they can be inserted into my
mySQL database in the proper fields although it is currently being
written to another text file because of the problem I have below. The
lines from the mp3 text file will look like this:

Al Green - The Supreme Al Green - 01 - Tired Of Being Alone.mp3
5.04MB 244k
Al Green - The Supreme Al Green - 02 - I Can't Get Next To You.mp3
6.52MB 242k
Al Green - The Supreme Al Green - 03 - Let's Stay Together.mp3
5.74MB 242k

The script reads it into an array and keys on the "-" to explode it. The
script works just fine on those, doing what I want it to and putting
everything into it's proper field. But my problem comes into play when
there is more than the three dashes in any selection like: Code:


View Replies !
Exploding A TimeStamp
Is there a way to explode a date string php variable hhmmssyyyyddmm etc. without any dilimeters. Im assuming its something like javascript {4,2} etc if there is one.

Searched the site and couldnt find an article that exploded the string that didnt use dilimeters. Maybe a burried post or something i missed on php.net. Code:

View Replies !
Exploding An Array, Kind Of ...
I have an array as follows

$sounds = array();

$sounds['sound1'] = "fishes/1/sound.php";
$sounds['sound2'] = "fishes/2/sound.php";
$sounds['sound3'] = "fishes/3/sound.php";
$sounds['sound4] = "fishes/4/sound.php";
$sounds['sound5] = "fishes/5/sound.php";
$sounds['sound11] = "bears/1/sound.php";

etc etc......

What I want to be able to do have turn the above into this:

include ("sounds/fishes/1/sound.php");
include ("sounds/fishes/2/sound.php");
print ("<br>divider<br>");
include ("sounds/fishes/3/sound.php");
include ("sounds/fishes/4/sound.php");
print ("<br>divider<br>");
include ("sounds/fishes/5/sound.php");
include ("sounds/birds/1/sound.php");

etc etc

I'm totally clueless as to how I might acheive it, especially including the
"dividers" every two includes. Surely one of you clever folk gotta be able
to spoon feed it to me? ;)

View Replies !
Exploding Text File....
I want to put a text file into a form field, and then submit it to a page that will split up the text file on two criteria and then loop through each split result inserting new db records. A sample text file would be:

question 1;option1;option2l;option3

question 2;option1;option2l;option3

question 3;option1;option2l;option3

I need to split it on blank lines and then again on the options so that my insert would be insert questionname, option1, option 2....into questions. Can someone help please. I know I can use explode, but unless I am missing something then its just not working for me.

View Replies !
Exploding Tab Delimited Line
I'm trying to create an array from a tab delimited line of text. I've tried explode('/t',$line); but doesn't seem to work. What am I doing wrong?

View Replies !
Exploding Text From MySQL
Using a text field input lines of text are typed, using a carriage return to break the lines on input. The text is stored in a MySQL text field. When retrieved the goal is to make the lines of text format as a bulleted unordered list. This is the bit of code that I'm working with now:

<?php
if (!empty($row_rsHomePage['mt_list'])) {
$thelist = ($row_rsHomePage['mt_list']);
$newlist = explode('/n', $thelist);
echo "$newlist[0]<br />";
echo "$newlist[1]";
}?>

Right now I'm unable to explode the list because I'm don't know what the delimiter is that separates the lines (/n is not it). What delimiter should I use so explode will break the lines? From here the plan is to count the number of arrays, then echo each array with a dot and space preceding it. Is there a better way to do this?

View Replies !
Exploding Excel Documents?
Is it possible to make it so that PHP will explode the cells from an uploaded excel document?


View Replies !
Manipulating/exploding A String
$string ="<img src="" alt="" />Sunny, and 30 &deg; F. For more details?";

-need the img code to be in $img
-then before the comma i need to be in $forecast
-after the comma drop everything but the temp into $temp
-everything after that discard

i was thinking of: Code:

View Replies !
Exploding Items From Table
For each record in my table there is a varchar field called countryids which stores x amount of values in the format of &#391; 2 3 4' lets say.

These numbers actually represent the ID field of a different linked table called tblcountries. How these ID's get into this field is not a concern. Its getting them out which is!

On my php form I have a list of check boxes which in this example is a list of countries and I need to know how to extract the values mentioned above and dynamically tick the appropriate checkbox of the country on my form (obvously if the value exists in my record). My guess is this is done by the ID somehow but I simply cant visualise how its done.

View Replies !
Imploding/exploding 2 Dimensional Arrays
I am using this to explode an array that has been imploded and passed via an invisible field...

//REMAKE THE LIST ARRAY
$list = explode('|',$stringlist);

//COPY AND NAME THE FILE
$address = "../../projects/img".$count.".jpeg";
copy($file, $address) or die("Couldn't copy the file!");

//GET TITLE NAME OF IMAGE
$position = strpos($file_name, ".");
$file_name = substr($file_name, 0, $position);

//ADD THE FILES NAME AND ADDRESS TO LIST
$temp[$file_name]=$address;
$list[$count]=$temp;
$count++;

its for a file uploading system and i want to build a 2 dimensional array of the original names of the file and the url it will be stored at, what i cant figure out is how to correctly implode a 2 dimensional array so that it will pass correctly, here the first file gets submitted correctly but while doing the second file 'array' gets passed.

can someone show me how to implode and explode a 2 dimensional array or point me to where i can find info on this.

View Replies !
Exploding String, Then Putting It In Array
I have a script that reads the files in a dir, then explodes each file name. The files look like this:

Artist - Album

I want the explode the characters before the " - " (the artist) so I can collect a list of artists without the album info. I'm trying to explode the filename and then have it pushed into an array but it's not working. PHP Code:

View Replies !
Exploding Array Using A Space Delimiter?
Here's my problem. I am reading from a text file using this:

if (!file_exists($file))
{
echo "Don't exist
";
return false;
}

$fd = @fopen($file, 'r');
if (!is_resource($fd))
{
echo "Error reading
";
return false;
}

And it works fine. The data that will be read will always be in the text
file in the form of

one - two - three - alpha beta kappa delta epsilon 13.5pp 29.95eu

Now I want to explode that array that was read so I use this:

$arrayData = explode("-", fgets($fd, 4096));

print "first=$arrayData[0]
";
print "second=$arrayData[1]
";
print "third=$arrayData[2]
";
print "fourth=$arrayData[3]
";

which will give me

first=one second=two third=three fourth=alpha beta kappa delta epsilon
13.5pp 29.95eu

But I need to access the last two items (13.5pp and 29.95eu) of this
array to split them off as well so that the final output I need would be
like this:

first=one second=two third=three fourth=alpha beta kappa delta
epsilon.txt numpages=13.5pp cost=29.95eu

How can I do that? Do I need to further explode $arrayData[3] using a
space delimiter? Is there a way to grab the last two fields only because
the length of the 'alpha beta kappa delta epsilon' will not always be
the same but the numpages and cost will always be the last two elements
in the array.

View Replies !
Exploding Results Of Mysql Query
I have a table with times and dates listed like this:

0000-00-00 00:00:00
2003-09-20 20:26:22
etc
etc

What I want is to query the DB for the field (matchdate) and then get it to explode the ' ' to give jsut the date for me and then put it into a dropdown in a loop. this may sound easy but i too sleepy to work it out and searching aint good.

View Replies !
Exploding Comma Separated In Array
I'm looking to explode the comma separated values in an array like this:

Array ( => 10811 [1] => 7527,7556 )

and then add the exploded value as a new key in the array...like this:

Array ( => 10811 [1] => 7527 [2] => 7556 )

View Replies !
Arrays Exploding Echoing It From Within A Loop
i have information stored in a string in a MySQL database. the string gets returned something like "a,b,c,d|e,f,g,h|i,j,k,l." After retrieving this string i separate it into arrays, first by exploding it using the pipe (|), then the commas, and then echoing it from within a loop. Code:

View Replies !
Exploding An Integer String And Converting It To An Array
I am working on a travel specials management system. The 'specials' table in the db has a resort_id fk to the 'resorts' table to identify what resort the special applies to.

The resort entry in the 'resorts' table has fields for room categories - room_cat_1, room_cat_2, etc. I need to have a field in the 'specials' table that identifies what room categories that the special applies to at the particular resort. Code:

View Replies !
Real Ip Behind A Proxy
is there any way to know the real ip, for people behind a proxy?

View Replies !
Getting The REAL Directory?
Is there any way to get the directory/path of the file running the script, not the directory you're inside (Via dir())? I'm allowing the user to navigate through directories, and that part works great - but whenever I attempt to used getcwd(), it returns the directory the user is in - not the directory of the php file - is there any way to get the directory of the .php file the user is using?

View Replies !
Real Estate MLS/IDX
I am trying to program an MLS/IDX search feature to be integrated into a real estate website. This progrom will allow MLS/IDX searching/browsing (searching by MLS #, house variables, etc) and browsing by property location, etc.

I have come accross RETS and have tried to go about it, but wow, maybe MLS/IDX is just some mythical database that doesn't exist? If anyone can help me out here. show some code, point me to a resource, tutorial, something that would be some assistance, I would bow down to them, and mail them one, yes, one ice cold root beer.

View Replies !
Resolve Real IP
I can get the apparent IP from $_SERVER['REMOTE_ADDR']; . However, how can I find the real IP if the user is behind a proxy? I know it must be possible as some "whatismyip" sites do it.

View Replies !
Mysql Real
I found this which I think calls for an indepth brain storming. A very good reading

[edited by: eelixduppy at 1:06 pm (utc) on Sep. 12, 2007]
[edit reason] fixed typo as per request [/edit]

View Replies !
Real-time Output?
I'm a relative PHP newbie, so I apologize if this is a simple question.

Anyway, here's my problem. I'm using a PHP script to pre-render a bunchload of insert files for an HTML page. Right now there's about 1,600, but that number could get much, much higher when the site goes live.

I'll only need to re-render the whole batch once or twice a year (if that) but it's still something I'd like to be able to do in case I have to move the site to a different server, or there's a hard drive crash or etc.

Basically what the script does is grab a whole bunch of information from a database and write the insert file. It does this for every single one.

The problem of course, is that PHP by default does all this server-side, and then sends it to the browser. Because this process takes like ten or twenty minutes to do, the browser times out long before it's finished.

Is there a way to get progressive output with PHP? Or do I need to re-do this in another language like Perl?

View Replies !
Real Length Of Arrays
Sometimes, I want to know how many elements are really in an array (php3).

The count() and sizeof() functions apparently return the number of non-empty array elements, and if you do a while loop checking for empty will stop on the first empty element.

I have been using the following function:
function truecount($theArray) {
if (is_array($theArray)) {
end($theArray);
return key($theArray);
}
}
but if the key is non-numeric, won't that trip me up?
Anyone have a better solution?

View Replies !
Md5 / Sha1 - Any Real Difference?
I use md5 hash with some of my cookies and occassionally a hidden form
field - I know the physical data on my network is insecure (unless being
served via https) but I was wondering if there are any advantages to using
md5 over sha1 or versa vicea... I know md5 gives me a unique 32bit hash
while sha1 I've read is 'secure' (?) and gives a 40bit hash... Since The
technical webpage on sha1 is lengthy and for the most part over my head...
and other than today, I've never heard of it before... I was wondering if
anyone could offer any comments on it...

View Replies !
Real Time Chat
There's anyone out there that can give me a light on real time chat using sockets. I've seen some using push technics but they all hang up after an elapsed amount of time.

View Replies !
Htmlspecialchars/real Escape
I'm creating a BBCode parser, and everything's working but one thing; I need code tags, but I will need to real_escape/htmlspecialchars the post to make sure it isn't malicious. The only problem is if I real_escape with code tags that contain php, the php will be removed. If I specialchars the post with php, I can't have syntax highlighting (or, not easily). How do I get round this?

View Replies !
Real IP Address From Behind Proxy Or NAT
How to get the real IP address of a user, not that of their proxy server or the external NAT address. I was quite sure that this wasn't possible without some kind of process getting the address on the client machine.

I have suggested that these sites could be using Java to get the real IP address, however, I could be wrong and for me the script that I found always returns 127.0.0.1 . This suggests to me that any script attempting to obtain the hosts real IP address infarct rely s on the HTTP-X-FORWARDED-FOR header sent by the proxy server...

View Replies !
Real-time Clock
Where should I start to write a Real-time Clock? I want it be dynamic, not static. I know how to get the time and display it but how do I keep changing it ?

View Replies !
My Real Estate Scripts
I have been writing a real estate agency program and its coming on well but taking longer than I thought. Also I think I am just re-inventing the wheel as I guess like BB scripts there are probably good free ones already writen in php and using mysql ? Can anyone recommend one.? can then continue learning while adapting it to my purposes.

View Replies !
REAL E-mail Validation
if there is a way to actually send an e-mail to the server and see if it bounces or not? What I'm trying to do is require users to enter a valid e-mail address on the front page before entering the site. I don't want to do simple character validation (check for @ and no special chars, etc, etc) but actually see if the e-mail account truly exists before letting them into the site.

View Replies !
Real-time Chat
I wrote a PHP chat system similar to gChat which simply uses constant ajax calls to update the chat. This system is fine for a few users, but with potentially thousands of users, it is much too hard on the server. I've been considering taking the 'Comet' route, but have heard that PHP can't handle Comet very well. What would be the best language/API to perform real-time chat for a large user-base?

View Replies !
Date In Real Time
It is possible to create a program which get the date in real time using PHP.

View Replies !
Real Time Sql Query
I am making a web-based chat but to get the msg from the database i need to refresh the page and that will make load and extra bandwidth on the server so i want to make the query in real time ( only the new msg to be received without refresh the whole page ), Any one in here knows how to get data from sql database without having to refresh page.

View Replies !
Real Media Player Pop Up
Does anybody have any idea on how to make a pop up player for playing streaming real media files like Code:

View Replies !
Mysql Real Escape
Upon entry into the database, I first clean form input data with html special characters, strip tags, and mysql real escape string. When I retrieve this data from the db, single quotes aren't coming out right on the pages. Some browsers display a question mark, others a blank space, and another (FireFox) totally screws up the text formatting.

View Replies !
Real Escape String
How can i add a escape string to this php mysql query.

mysql_query('insert into times (code, date, time, duration) values ("'.$course_code.'","'.$date_inSQL.'","'.$time_inSQL.'","'.$duration.'" )');

View Replies !
Real Audio Download Limiter
i'm running a site with .ra and .ram files, when some visitor download or stream all these files at the same time it causes an huge bandwidth consumption.

so i'd like to limit the download per each IP to a certain number of .ra and .ram files at time.

i wonder if i can use some php script with cookies session but i'm new to this and i don't know where to start.

View Replies !
Real Time Echo'ing Of Var In A Loop
i have a big loop, and rather then waiting until its done for me too see what happened, every time it runs, how can i get the browser to echo the result, and proceed to keep running the loop.

basically this loop takes a long time to finish, and i had to set my max runtime past 30 seconds. i guess incorporating a refresh of some sort like this would eliminate the need for the time extension too?

View Replies !
PHP Template Redirecting To Real Video
I've developed a RealVideo content management system w/ PHP and MySQL. On the back end is a form that sends a Real Video file (.rm) and writes the filename to a database. On the front end is a PHP template that pulls the filename from the database and outputs a string that is read in by a Flash movie. The Flash movie reads in the file location and places HTML-encoded text inside a text field that says "Launch Video."

All works fine -- the Flash movie launches the Real Video file, and the file plays correctly. There's only one problem: the Real Video doesn't stream.

In order for a Real Server to stream a Real Video file, a "stub" file with the extension .ram needs to be placed in the root directory. The only content in these .ram files is a URL pointing to the actual .rm file, and it's written in this format: pnm://ra.domainName.com/realvideoFile.rm

My problem: The form is sending a Real Video file and the receiving page is copying it to the server as well as inserting a record into my database, but it can't write a .ram file to the root directory because to do so I'd have to adjust permissions accordingly (PHP is part of group Apache). That's unacceptable; I won't adjust permissions on the root directory. My solution was to create a redirector that acts as the stub file:
PHP Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved