[PHP] Query Reset?
I am having a problem with reseting my query results. I want to take $results and have it spit it out line by line - but twice. I have found that after the first time through, it just spits out 15 (in this case) more blank lines. Any help? (My code is below) This code is to create an HTML drop down list of the results. Here is the function to display the box - it works fine: class display { function form_dropdown ($list_array, $name) { // default name code if (!isset($name)) { $name = "default"; } $database = new database; $rows = $database->rows($list_array); $field_name = mysql_field_name($list_array, 0); ?> Select One ".$row[$field_name].""; } ?>query($query); $result_row = $database->rows($result); ?>form_dropdown($result, $name); echo ""; // Second drop down - ONLY BLANK LINES! echo "User2"; $name = "User2"; $display->form_dropdown($result, $name); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Variables
I have a quirky problem that should be a breeze for someone who is smarter than I. I have a script where I am registering a HTML form post variable as a session variable and then echo it. In the real script I use it in a MySQL query, but for the sake of this post, here is the "script": $user1 = $HTTP_POST_VARS["user1"]; session_register("user1"); echo $HTTP_SESSION_VARS["user1"]; This doesn't work, however, if I hit the refresh button the var miraculously appears! What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Page URL from a inc?
I am having a bit of a problem with pathinfo. I am looking for a way to generate a URL from within an included class that would return the URL for the script that called the class. Pathinfo returns the class file. Is there a way to get what I need? Thanks in advanced, Jed R. Brubaker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating Images
I have been trying to write some image creation scripts, and although I have a version of PHP that includes image support, I keep getting errors related to imagecreatefrompng(). Here is the latest error: Fatal error: Call to undefined function: imagecreatefrompng() in /web/html-docs/psych/jb4920/public_html/pic/picture.php on line 12 Isn't imagecreatfrompng() a built in function? Anyone run across something like this or a suggestion? Thanks for the help! Jed R. Brubaker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ImageColorAllocate() Problem
I am having a bizzare problem with the imagecolorallocate() function. Maybe all of you can help me! Here is the code: $hex1 = "0x".$color{0}.$color{1}; $hex2 = "0x".$color{2}.$color{3}; $hex3 = "0x".$color{4}.$color{5}; $color = ImageColorAllocate($im, $hex1, $hex2, $hex3); Simple enough! $color starts off as a hex color code minus the #, and then is pulled into each of the 3 alpha values by way for the hex variables. It is later outputted in text: ImageTTFText ($im, $cursive_size, 0, $text1_x, $text1_y, $color, $font1, $cursive_text); Problem: The text is always black. Something strange: If I just type in a randomly selected color, it works! Is there some reason that the values in my variables wouldn't be passing? Thanks in advance, Jed R. Brubaker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undefined function imagecreate()
You know, I am not sure if this will help, but I have a problem very similar to this in my debugger. When I run a script check through my WIN32 PHP module, I get errors related to imagecreate() functions. In a current project I use imagecreatefromjpeg() functions and get the same problems. Fortunately for me, once my scripts have gone up to the server they have worked fine. You might have the same luck! One other thing - you might want to check the image capabilities of your PHP's build. One server I worked on did not have the capabilities to work with GIFs or PNGs, so I had to do things with imagecreatefromjpeg() (as I mentioned above). Good luck! Jed "Marco Moonen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Just new at PHP and learning. > Trying to execute simple script to draw a line: > //draw2.php > Header("Content-type: image/jpeg"); > $image = ImageCreate(200,150); > $gray = ImageColorAllocate($image,204,204,204); > $blue = ImageColorAllocate($image,0,0,255); > ImageLine($image,10,10,150,30,$blue); > ImageArc($image,150,65,70,70,0,360,$blue); > ImageJPEG($image); > ImageDestroy($image); > ?> > > Browser returns: > > Fatal error: Call to undefined function: imagecreate() in > c:\inetpub\wwwroot\draw4.php on line 4 > Why is imagcreate() not understoodMarco > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Converting various DB's to MySQL using PHP
I think phpMyAdmin has a "Inset Data From Text File" function that can work with delimited text output. Check it out: http://www.phpmyadmin.net/ "J Morton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all -- > > Summary: Using PHP, need to go from ACCESS -> MySQL. (Millions of > records, hundreds of tables.) > > I am about to embark on a project over the next week which entails (in > part) developing a PHP platform that will convert an Access DB to MySQL, > as well as perform all needed error-checking and appropriate field-type > setup. In the future I will modify the same script to support other DB > types like Postgres, MS, Oracle, etc. Rather than having PHP access > these foreign DB types I will have it access a delimited text output of > the DB's. > > Before I got started, I thought I would check in here to see if anybody > knows of a similar tool that already exists and perhaps I can learn > something from it and benchmark against it as I proceed. Also, any tips > or advice would be muchly appreciated. I am sure this has been done > many times over in PHP but I do not see where. > > Thanks!! > Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ImageColorAllocate() Problem
Worked perfectly - thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Foreach Array Help
Okay, total newbie when it comes to arrays, and I could really use some help. I sure this will be an easy one for you veterans out there. Here is the array ($code): array(2) { ["total"]=> int(1) ["assign"]=> array(1) { [1]=> array(3) { ["type"]=> string(10) "Transcript" ["rows"]=> string(3) "603" ["codeapply"]=> array(1) { [1]=> array(3) { ["codeset"]=> string(23) "FFT 6 Level Code System" ["code_rows"]=> string(3) "302" ["code_complete"]=> string(1) "2" } } } } } Here is the output code: foreach ($this->code['assign'] as $assign => $details) { foreach ($assign['codeapply'] as $codeapply => $ca_details) { echo ""; echo""; echo$details['type']." ".$assign; echo""; echo""; echo""; echo$ca_details['codeset']; echo""; echo""; echo $ca_details['code_complete']."/".$ca_details['code_rows']." Items Coded"; echo""; echo""; printf (" %.0d%%", ($ca_details['code_complete']/$ca_details['code_rows'])*100); echo""; echo ""; } } Output error: Warning: Cannot use a scalar value as an array Warning: Invalid argument supplied for foreach() Conceptually and practically I have been struggling with how to navigate levels of the arrays which are defined by a variable (e.g. $code['assign'][$i] for the assign ID and $code['assign'][$i][$j] for the codeapply ID on the assign ID). Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Foreach Array Help
First of all, thanks for the response. Here is where I am getting lost: In $code['assign'][1] - "1" is the assignment ID, and I would like the array to be able to hold a billion of these different assignments all with conceivably a billion codeapply ID as in $code['assign'][1]['codeapply'][3], where "3" is the codeapply value. In other words, because each of these items directly under assign and codeapply are arrays because they hold sub-info, I have made the keys of these items the values. So - am I approaching this whole array thing wrong? Thanks. "Rob Adams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Okay, total newbie when it comes to arrays, and I could really use some > > help. I sure this will be an easy one for you veterans out there. > > > > Here is the array ($code): > > array(2) { > > ["total"]=> > > int(1) > > ["assign"]=> > > array(1) { > > [1]=> > > array(3) { > > ["type"]=> > > string(10) "Transcript" > > ["rows"]=> > > string(3) "603" > > ["codeapply"]=> > > array(1) { > > [1]=> > > array(3) { > > ["codeset"]=> > > string(23) "FFT 6 Level Code System" > > ["code_rows"]=> > > string(3) "302" > > ["code_complete"]=> > > string(1) "2" > > } > > } > > } > > } > > } > > > > Here is the output code: > > foreach ($this->code['assign'] as $assign => $details) > > { > > foreach ($assign['codeapply'] as $codeapply => $ca_details) > > { > > echo ""; > > echo""; > > echo$details['type']." ".$assign; > > echo""; > > echo""; > > echo""; > > echo$ca_details['codeset']; > > echo""; > > echo""; > > echo > > $ca_details['code_complete']."/".$ca_details['code_rows']." Items Coded"; > > echo""; > > echo""; > > printf (" %.0d%%", > > ($ca_details['code_complete']/$ca_details['code_rows'])*100); > > echo""; > > echo ""; > > } > > } > > > > Output error: > > Warning: Cannot use a scalar value as an array > > Warning: Invalid argument supplied for foreach() > > > > Conceptually and practically I have been struggling with how to navigate > > levels of the arrays which are defined by a variable (e.g. > > $code['assign'][$i] for the assign ID and $code['assign'][$i][$j] for the > > if $code['assign'][$i] has some integer value, then it is not an array. > if $code['assign'][$i][$j] has some integer value, then $code['assign'][$i] > is an array. > > You have two mutually exclusive possibilities there. > > Probably, what you want to do is something like: > > $code['assign'][$i]['aid'] = (assign ID); > $code['assign'][$i][$j] = (whatever you want here); > > (which, for simplicity, translates into something like:) > > $code['assign'][1]['aid'] = 1; > $code['assign'][1]['1'] = 11; > $code['assign'][1]['2'] = 12; > $code['assign'][1]['3'] = 13; > $code['assign'][1]['4'] = 14; > $code['assign'][1]['5'] = 15; > etc. > > -- Rob > > > > > > codeapply ID on the assign ID). > > > > Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Foreach Array Help
Never mind - I figured it out. While I was traversing like this: foreach ($this->code['assign'] as $assign => $details) { foreach ($assign['codeapply'] as $codeapply => $ca_details) { } } I had set up $assign to be the key value, and likewise not be an array. I changed it to: foreach ($this->code['assign'] as $assign => $details) { foreach ($details['codeapply'] as $codeapply => $ca_details) { } } and it worked beautifully. Thanks to all of you who got me going in the right direction. "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Okay, total newbie when it comes to arrays, and I could really use some > help. I sure this will be an easy one for you veterans out there. > > Here is the array ($code): > array(2) { > ["total"]=> > int(1) > ["assign"]=> > array(1) { > [1]=> > array(3) { > ["type"]=> > string(10) "Transcript" > ["rows"]=> > string(3) "603" > ["codeapply"]=> > array(1) { > [1]=> > array(3) { > ["codeset"]=> > string(23) "FFT 6 Level Code System" > ["code_rows"]=> > string(3) "302" > ["code_complete"]=> > string(1) "2" > } > } > } > } > } > > Here is the output code: > foreach ($this->code['assign'] as $assign => $details) > { > foreach ($assign['codeapply'] as $codeapply => $ca_details) > { > echo ""; > echo""; > echo$details['type']." ".$assign; > echo""; > echo""; > echo""; > echo$ca_details['codeset']; > echo""; > echo""; > echo > $ca_details['code_complete']."/".$ca_details['code_rows']." Items Coded"; > echo""; > echo""; > printf (" %.0d%%", > ($ca_details['code_complete']/$ca_details['code_rows'])*100); > echo""; > echo ""; > } > } > > Output error: > Warning: Cannot use a scalar value as an array > Warning: Invalid argument supplied for foreach() > > Conceptually and practically I have been struggling with how to navigate > levels of the arrays which are defined by a variable (e.g. > $code['assign'][$i] for the assign ID and $code['assign'][$i][$j] for the > codeapply ID on the assign ID). > > Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Loop Question
Hi! I am trying to loop through two different database calls with two for statements, one embedded in the other. for ($i; $i < $codeset_rows; $i++) { $codeset_row = $this->database->fetch_array($codeset_query); $codesys_query = $this->database->query("select codesys.codesys_index, codesys.code_name, codesys.code_value from codesys where codesys.codeset_ID = ".$codeset_row['codeset_ID']); $codesys_rows = $this->database->num_rows($codesys_query); for ($j; $j < $codesys_rows; $j++) { echo "Blah, blah, blah"; } } The current set up means that the first loop should cycle twice, and the second loop should cycle 6 times the first time and 2 times the second. So here is the question: $j doesn't unset when the loop ends. So when it comes around the second time, $j still = 6 and since $codesys_rows = 2, it skips the loop. I can fix this by putting an if ($j) {unset($j);} right before the second loop. However, it seems that there should be some more efficient way to do this. Ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Loop Question
Well duh. Thanks so much! "Robert Cummings" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > See changes below. > > Cheers, > Rob. > > On Sat, 2003-10-18 at 14:57, Jed R. Brubaker wrote: > > Hi! I am trying to loop through two different database calls with two for > > statements, one embedded in the other. > > > >for ($i; $i < $codeset_rows; $i++) > > for ($i = 0; $i < $codeset_rows; $i++) > > > { > > $codeset_row = $this->database->fetch_array($codeset_query); > > $codesys_query = $this->database->query("select > > codesys.codesys_index, > > > > codesys.code_name, > > > > codesys.code_value > > > > from codesys > > > > where codesys.codeset_ID = ".$codeset_row['codeset_ID']); > > > > $codesys_rows = $this->database->num_rows($codesys_query); > > > > for ($j; $j < $codesys_rows; $j++) > > for ($j = 0; $j < $codesys_rows; $j++) > > > { > > echo "Blah, blah, blah"; > > } > > > > } > > > > The current set up means that the first loop should cycle twice, and the > > second loop should cycle 6 times the first time and 2 times the second. > > > > So here is the question: $j doesn't unset when the loop ends. So when it > > comes around the second time, $j still = 6 and since $codesys_rows = 2, it > > skips the loop. I can fix this by putting an > > if ($j) > > {unset($j);} > > right before the second loop. However, it seems that there should be some > > more efficient way to do this. > > Ideas? > > > > Thanks! > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] URL Variables
Is there a way to preserve URL variables and have a link simply add a new variable to the end? I am tabulating data and I have URL variables defining which dataset to view and in what way to view it. I would now like to set the SQL statement up with a limit and add some "Previous", "Next" commands, and even paging numbers, but how should I go about setting up the link so that the existing URL variables are preserved? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] URL Variables
Thanks! "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote: > > Is there a way to preserve URL variables and have a link simply add > > a new variable to the end? > > Sure, just use $_SERVER['QUERY_STRING'], which is the current query string, and > append whatever new URL variables you want. > > Chris > > = > My Blog > http://shiflett.org/ > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_GET String Edit
Hey - this one should be simple. I am parsing some data and have $_GET variables in the URL stipulating on which record to start and how many records to display (these then get basses to the limit command in my database query). So here is the catch. I am trying to make a page navigation menu (we have all seen them, "Page: 1 2 3..."), and I would like to continue doing this via the URL variables. Right now, each of the page numbers is a hyper link is set like this: "page.php?".$_SERVER["QUERY_STRING"]."&more variables here." The problem, however, is that those variables are a string. If the variables that the menu defines are already in the string, it doesn't update them, it just adds more definitions to the URL. How have you people dealt with this? I am sure that there is some elegant solution and I would love to know what it is. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GET String Edit
Sorry for the confusing initial request. You were correct in assuming that I am generating URLs like: page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4 So I suppose the consise follow-up question is how can I get a hyperlink to change one of those varibles in the string. In the past I have just tacked a varible on to the end of the string, but I don't want to be redundant. Thanks again. "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > --- "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote: > > I am trying to make a page navigation menu (we have all seen them, > > "Page: 1 2 3..."), and I would like to continue doing this via the > > URL variables. Right now, each of the page numbers is a hyper link > > is set like this: > > > > "page.php?".$_SERVER["QUERY_STRING"]."&more variables here." > > > > The problem, however, is that those variables are a string. If the > > variables that the menu defines are already in the string, it > > doesn't update them, it just adds more definitions to the URL. > > I had a hard time interpreting your question, but I think you're saying > that you are generating URLs like this: > > /page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4 > > And, you're wanting to not duplicate variables in your URL, correct? > > You could always keep your query string in an array or something. This > would allow you to update values in the array prior to the end of your > script. You can start this array using $_GET: > > $query = $_GET; > > Of course, you might want to rather filter this data on each page, so that > you don't spread tainted data more than necessary. Regardless, this will > allow you to update values in your query string. If you want to update > foo1, you don't have to care whether it's already set: > > $query['foo1'] = 'newvalue'; > > Hope that helps. > > Chris > > = > Chris Shiflett - http://shiflett.org/ > > PHP Security Handbook > Coming mid-2004 > HTTP Developer's Handbook > http://httphandbook.org/ > RAMP Training Courses > http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Advice: GET vs. POST vs. SESSION
I was hoping that some of you would be able to give me some advice. I have started creating a web application that makes heavy use of URL GET variables in order to solve a problem that I have had with POST in the past - namely, having to refresh the document and repost the variables when you use the browser's back button. So I enthusiastically have embraced GET variables, but am now having a struggle editing the URL variable string. So this is my question: is using URL GET variables that best way to avoid that browser back button effect? I have thought about using session variable extensively, but that I am going to have to be unsetting them all over the place. So - anyone have any advice? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String Manip. - Chop Equivalent
Does PHP have an equivalent to PERL's chop - that is, a way to get rid of the last character in a string? "Hello World" to "Hello Worl" Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newb: stop file process
This one should be simple. I am wondering if there is a simple way in which to stop the processing of a file. The current example is a program that checks to see if the user is logged in. In the past I have done something like this: if ($loggedIn != true) { echo "You are not logged in."; } else { echo "Welcome"; } This, however, becomes a substantial problem (or at least annoyance) when the else is pages long. I would prefer to have something like: if ($loggedIn != true) { echo "You're not logged in."; // stop process of file here } // Page content (with no else) The ultimate objective is to have a simple function in the my class include file to verify that the user is always logged in. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stop file process
Found it! Just use exit(); "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This one should be simple. > > I am wondering if there is a simple way in which to stop the processing of a > file. > > The current example is a program that checks to see if the user is logged > in. In the past I have done something like this: > > if ($loggedIn != true) { > echo "You are not logged in."; > } > else { > echo "Welcome"; > } > > This, however, becomes a substantial problem (or at least annoyance) when > the else is pages long. I would prefer to have something like: > > if ($loggedIn != true) { > echo "You're not logged in."; > // stop process of file here > } > // Page content (with no else) > > The ultimate objective is to have a simple function in the my class include > file to verify that the user is always logged in. > > Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String formatting
Hey all! Glad you are here. I have a question that is confusing me a bit. I am trying to output a string that is pulled from a database that I don't have control over. Everything is great, except that the string needs to be all on one line with no line breaks (for Javascript's sake). Is there a function in PHP to make sure that output is on one line, regardless of the content of the line? Below are some examples of the data. Thanks in advance! MySQL (text) -- Here is some text, and here is the MySQL field is a line break. Here is more text that is still part of the text above. -- Needed output (w/ no whitespace) -- Here is some text, and here is the MySQL field is a line break. Here is more text that is still part of the text above. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Result Handling
Hi all! I have a quite a brain puzzler here that I would love to hear some people's feedback on. I have inherited a PHP system that is definately on the strange side. I am stuck with the situation of either adding to the beast, or simply reprogramming the entire site. The one technique that I have a bit of a question about is realted to the handling of MySQL results. It seems that when you query the database with their system, it takes all the results and outputs them into a string similar to: I have a question<:>I have an answer which is then interpreted: list($question, $answer) = explode("<:>",$result); back to normal variables. Does this soind familiar to anyone? I have never run across anything like this and was wondering if maybe someone could explain to me why this could be desirable. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO Question for PHP4
Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return "Bar"; } } $foo = new Foo; echo $foo; $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return "Bar"; } } $foo = new Foo; $bar = $foo->bar; Or is there a better design approach I should be reminded of or learn? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Page Referer question
Hello all. I am looking to create script will detect the page from which the user just came so that after they do something on the current page (login) it will send them back to the page they wanted. I was thinking about $_SERVER['HTTP_REFERER'], but php.net says: 'HTTP_REFERER' The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. Is this a big problem? Is there another technique I could use? Thank you all! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Page Referer question
Thank you all for the great feedback. "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all. I am looking to create script will detect the page from which the > user just came so that after they do something on the current page (login) > it will send them back to the page they wanted. I was thinking about > $_SERVER['HTTP_REFERER'], but php.net says: > > 'HTTP_REFERER' > > The address of the page (if any) which referred the user agent to the > current page. This is set by the user agent. Not all user agents will set > this, and some provide the ability to modify HTTP_REFERER as a feature. In > short, it cannot really be trusted. > > Is this a big problem? Is there another technique I could use? > > Thank you all! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO Theory Question
Hi all! I could use some perspective on a project that I am currently working on. I am trying to utilize OO to make my PHP easier, but I keep running into problems that revolve around the stateless nature of the web. Consider the following: I have a login class that is instantiated at the top of every page. It can log you in, check to see if you are logged in, etc. This class has an assortment of class variables such as userID, userType, etc. It would be great if I could make a reference to $login->userType on any given page, but I run into errors as the login class gets reinstantiated on every page. A solution is to set all of these variables into $_SESSION, but the appeal of classes is that I might be able to maintain all of my information in a related location, and not in the session. I am sure that this is a problem that many of you more experienced (than I) developers have run into. Is there a solution? And ideas? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Theory Question
The real reason for having the login class like this is to eliminate database calls. I thought I could have one session variable that said yo uwere logged in, but then the database calls would still have to be made on each page. Thanks for the idea - any others? "Jason Davidson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > put something in your script like > > if($_SESSION['authed'] == true) > $user = new User($_SESSION['userId']); > > > or something similar. > > Jason > > > "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote: > > > > Hi all! I could use some perspective on a project that I am currently > > working on. > > > > I am trying to utilize OO to make my PHP easier, but I keep running into > > problems that revolve around the stateless nature of the web. > > > > Consider the following: I have a login class that is instantiated at the top > > of every page. It can log you in, check to see if you are logged in, etc. > > This class has an assortment of class variables such as userID, userType, > > etc. > > > > It would be great if I could make a reference to $login->userType on any > > given page, but I run into errors as the login class gets reinstantiated on > > every page. > > > > A solution is to set all of these variables into $_SESSION, but the appeal > > of classes is that I might be able to maintain all of my information in a > > related location, and not in the session. > > > > I am sure that this is a problem that many of you more experienced (than I) > > developers have run into. Is there a solution? And ideas? > > > > Thanks in advance! > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OO Theory Question
Is there anything that says I can't instantiate the login class into the $_SESSION ? Pros, cons? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Theory Question
I don't know - is it? "Ed Lazor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > -Original Message- > > > The real reason for having the login class like this is to eliminate > > > database calls. I thought I could have one session variable that said yo > > > uwere logged in, but then the database calls would still have to be made > > on > > > each page. > > Playing Devil's Advocate here... > > Why would you want to avoid database calls? If you're using default > sessions management, all you're doing is trading this for accessing files on > the server. Isn't the database faster? > > -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image Width Error
Hi all! I am trying to do something really simple, but my error is outside of my expertise (hopefully not for long!). Code: - $this->lVertical = "images/box/".$template."_lVertical.gif"; $borderWidth = imagesx($this->lVertical); - Error: - Fatal error: Call to undefined function imagesx() in c:\web\www\php\classes\Box.class on line 65 --- Am I missing something in the PHP config? What should I be looking for. Oh! I am on PHP5.0 - that should help. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image Width Error
Apologies. I need to be using getimagesize(). I thought it was only for file sizes. "Torsten Roehr" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi all! > > > > I am trying to do something really simple, but my error is outside of my > > expertise (hopefully not for long!). > > > > Code: > > - > > $this->lVertical = "images/box/".$template."_lVertical.gif"; > > $borderWidth = imagesx($this->lVertical); > > - > > Error: > > - > > Fatal error: Call to undefined function imagesx() in > > c:\web\www\php\classes\Box.class on line 65 > > --- > > > > Am I missing something in the PHP config? What should I be looking for. > Oh! > > I am on PHP5.0 - that should help. > > > > Thanks in advance! > > Read the manual: > http://de.php.net/manual/en/function.imagesx.php > > You need an image resource to get the file size. > > Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] referencing a class
Quick question here. Has anyone run into trouble with a variable reference to a class object? Here is the code: $_SESSION['database'] = new Database; $this->db = &$_SESSION['database']; Everything goes screwy after a call like this. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] class packages
As far as I can tell there is not an easy way yet to create packages in PHP5. It seems the following is the best option: include('classes/help/Search.inc'); // Inside Search.inc and in the same "package" include('OtherClass.inc'); include('AnotherClass.inc'); Is there a better way? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: class packages
Oh - and naming conventions. Do you define the class?: class help.Search { } "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > As far as I can tell there is not an easy way yet to create packages in > PHP5. > > It seems the following is the best option: > include('classes/help/Search.inc'); > > // Inside Search.inc and in the same "package" > include('OtherClass.inc'); > include('AnotherClass.inc'); > > Is there a better way? > > Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class packages
Well, my OO experience comes from Java and ActionScript2.0, so there is compilation going on and classes get refered to as named that assume files (as you probably know). As I just added to my original post, I am also wondering about naming conventions: Quote: -- Do you define the class?: class help.Search { } -- "Jason Davidson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Out of curiosity, how would you prefer it? > > the way you mentioend is basically how i do though. > > Jason > > "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote: >> >> As far as I can tell there is not an easy way yet to create packages in >> PHP5. >> >> It seems the following is the best option: >> include('classes/help/Search.inc'); >> >> // Inside Search.inc and in the same "package" >> include('OtherClass.inc'); >> include('AnotherClass.inc'); >> >> Is there a better way? >> >> Thanks! >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class packages
Alex, You suggestion about the config file is interesting, but while I go and re-read your post, I am wondering how you would avoid class name conflicts. Point and case, the only reason I am going after packages is because I have a search class that is used for something else, and I want to not have to name my other class "SearchHelp". I am going to run into conflicts if I include two class definitions for search, am I not? Thanks again for all of the insight! "Alex Hogan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Do you define the class?: >> >> class help.Search { >> } > > No.., > > In your example you are defining the search class in the Help > namespace, just like you would in ActionScript. > > I don't think you can do that in php. > You would just use; > class Search{ > // do stuff here > } > > You can extend the class using; > > class subSearch extends Search{ > // do stuff here > } > > > > alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remove punctuation
Hi all! I am creating a function that will remove punctuation from a string, however, I am wondering if PHP has a function somewhere that will do the same. Right now my approach is to cycle through an array of punctuation and remove the items. Anything already exist? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] database content searching
Hi all. I was wondering if any of you have experience with searching through a database for user provided search terms. I was hoping that maybe I could get some insight into how to better approach what I am doing. Are there any great articles or example classes that I could look at? Please let me know! As of right now, my architecture is to have a primary class, Search, which connects to the database, takes search terms, removes "junk words"and suffixes ("s", "ing", etc.) (both defined by an array). The class runs a query on each word for each field that the class is told to search, and based on the "relevance" of that field (as supplied to the class), points are awarded to returned items. If they come up again on searches for other words, they get more points. Using that base architecture, I then extend the class (e.g. class Faq extends Search) and define "word groups" in the subclass. Word groups act to broaden the search words in a thesarus like fashion (when the search term "dvd" comes up, "movie", "title", "video", etc. are added to the SQL query via OR). This way each subclass can define it's own set of word groups applicable for that usage. The problem I am having is that far too many irrelevant items are coming up. "When is my package coming?" for example returns all kinds of junk because "when" is everywhere in a Faq. I am hoping that there is some internet resource that has a variety of tricks and rules to throw into a search architecture, but I am also interested to see if anyone can give me some of their personal experience and expertise. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] applying search terms
Hi all. I was wondering if any of you have experience with searching through a database for user provided search terms. I was hoping that maybe I could get some insight into how to better approach what I am doing. Are there any great articles or example classes that I could look at? Please let me know! As of right now, my architecture is to have a primary class, Search, which connects to the database, takes search terms, removes "junk words"and suffixes ("s", "ing", etc.) (both defined by an array). The class runs a query on each word for each field that the class is told to search, and based on the "relevance" of that field (as supplied to the class), points are awarded to returned items. If they come up again on searches for other words, they get more points. Using that base architecture, I then extend the class (e.g. class Faq extends Search) and define "word groups" in the subclass. Word groups act to broaden the search words in a thesarus like fashion (when the search term "dvd" comes up, "movie", "title", "video", etc. are added to the SQL query via OR). This way each subclass can define it's own set of word groups applicable for that usage. The problem I am having is that far too many irrelevant items are coming up. "When is my package coming?" for example returns all kinds of junk because "when" is everywhere in a Faq. I am hoping that there is some internet resource that has a variety of tricks and rules to throw into a search architecture, but I am also interested to see if anyone can give me some of their personal experience and expertise. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] matching search terms
Hi all. I was wondering if any of you have experience with searching through a database for user provided search terms. I was hoping that maybe I could get some insight into how to better approach what I am doing. Are there any great articles or example classes that I could look at? Please let me know! As of right now, my architecture is to have a primary class, Search, which connects to the database, takes search terms, removes "junk words"and suffixes ("s", "ing", etc.) (both defined by an array). The class runs a query on each word for each field that the class is told to search, and based on the "relevance" of that field (as supplied to the class), points are awarded to returned items. If they come up again on searches for other words, they get more points. Using that base architecture, I then extend the class (e.g. class Faq extends Search) and define "word groups" in the subclass. Word groups act to broaden the search words in a thesarus like fashion (when the search term "dvd" comes up, "movie", "title", "video", etc. are added to the SQL query via OR). This way each subclass can define it's own set of word groups applicable for that usage. The problem I am having is that far too many irrelevant items are coming up. "When is my package coming?" for example returns all kinds of junk because "when" is everywhere in a Faq. I am hoping that there is some internet resource that has a variety of tricks and rules to throw into a search architecture, but I am also interested to see if anyone can give me some of their personal experience and expertise. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Are server classes possible?
I am thinking like JavaBeans. Here is what I have going on: I have a series of rather database intensive queries that I would like some class to cache and provide access for page loads. I don't care how the information is stored, but I am trying to minimize the database call down to only once an hour at the most. The trick is that I just want the data - like a quazi-db table in memory... Is there something like that I should look at? Somewhere in PEAR? Thank you in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail problems - phpinfo information
I have been having all kinds of problems with the mail() function in PHP. I realize that there are problems inheritly, but I think I am still trying to track down the problem. My latest theory is that PHP isn't set up to work with the right mailing program. I know that our system is supposed to be using qmail that actually sits on a different server, but I found interesting information in phpinfo that is making me wonder if a local sendmail is handling the requests instead. Here are the things I am finding in phpinfo: sendmail_from no value no value sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i SMTP localhost localhost smtp_port 25 25 Path to sendmail /usr/sbin/sendmail -t -i Enviornment MAIL /var/mail/kpratt (what does this one do?) With all of the above refering to sendmail, is there anyway that my mail() can actually be using qmail? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail problems - phpinfo information
So as I am not an administrator, and all I have to go on is phpinfo (unless anyone has some suggestions), should I be seeing some trace of qmail in the phpinfo? That is why I posted. I apologize if I didn't make it clear. I have read all about mail, and even used the fantastic Lemos MIME problem correcting email class to try to tackle my problems from a different angle. Given the paths phpinfo is reporting, is there anyway that the system could somehow still be using qmail? Or is that outside the scope of what this phpinfo can tell me? Thanks again! "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [snip] ... making me wonder if a local sendmail is handling the requests instead. With all of the above refering to sendmail, is there anyway that my mail() can actually be using qmail? [/snip] >From http://www.php.net/mail, something you have not read apparently "For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. [LOOKIE HERE-->If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them.<--END LOOKIE] PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary. " -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rename() on NT
Can this be done when the file already exists? cleong at organic dot com says 29-Mar-2000 04:36 rename() doesn't seem to overwrite files on NT. The behavior is an OS-dependent side-effect I guess. on the PHP site @ http://us2.php.net/manual/en/function.rename.php So this this true, or is there some work around that doesn't involve unlinking the file first? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dbm choices - advice?
Hi all - I am looking at using a dbm-style cache system and was wondering if anyone has any recommendations from the plethora of systems listed here: http://us2.php.net/manual/en/ref.dba.php Is there a favorite? I know if probably depends on what I want to do, so in short, I am looking to create a temporary table that will be a composite of a ton of MySQL queries (hence the reason I am not just querying). I have thought about just creating a new database table to push my query results into, but I would love to make it faster if possible. Am I hopelessly misguided? I would love any feedback! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: blank emails
But wouldn't that mean that the email that is being sent to my client would be blank as well? "Manuel Lemos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > On 09/27/2004 12:27 PM, Jed R. Brubaker wrote: >> I have run into a problem with my email class. A bunch of reciepients are >> claiming that they are recieving blank emails. The problem is that I >> can't replicate the problem. Yet I know there is one, they keep >> forwarding the blank emails. I am hoping one of you email masters might >> be able to tell me what I am doing wrong: > > This looks like one of the mail() function bugs but it is hard to tell > what is the problem without more details on which OS and local mailer do > you use. > > Alternatively, you may want to try this message composing and sending > class that provides workaround solutions for deliverying message without > the problems you are facing: > > http://www.phpclasses.org/mimemessage > > > -- > > Regards, > Manuel Lemos > > PHP Classes - Free ready to use OOP components written in PHP > http://www.phpclasses.org/ > > PHP Reviews - Reviews of PHP books and other products > http://www.phpclasses.org/reviews/ > > Metastorage - Data object relational mapping layer generator > http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql problems
Hi all - I could use a lead on a problem. I just don't know where to start. I have a PHP script that populates a database table. No big deal. It creates mailing labels. However, a weird things keeps happening - every once in a while, a query is run twice. It is the same query, same information, even the same time (there is a now() in the query - and it is identical). So the question is a simple one - is this a PHP problem or a MySQL problem? Or somewhere in the MySQL extension? And how would I know? There is one clue to this otherwise vague problem. I believe that this predominantly happens when the database is under an above average load. I would appreciate any help that I might be able to get. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql problems
Thank you both for your responces. Unfotuantely there is no form that instantiates this action. So the double submit (while a good idea), is not possible. As for some sample code, it is part of a rather complicated system that makes a number of changes but essentailly what is going on is this: 1. Grab all items that we need to do some shipping stuff to. 2. Foreach through the items, giving each item number to a function to assign it to a customer and create a mailling label. That simple! The interesting this is this - the duplicate record is inserted into the mailing labels queue. I can see it long before I grab the data for output to labels. Moreover, I can tell that the problem isn't in the original item select statement because the function (executed for each item) would have created different insert times in the database based on the now( ). More ideas? Thanks! "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all - > > I could use a lead on a problem. I just don't know where to start. > > I have a PHP script that populates a database table. No big deal. It > creates mailing labels. However, a weird things keeps happening - every > once in a while, a query is run twice. It is the same query, same > information, even the same time (there is a now() in the query - and it is > identical). > > So the question is a simple one - is this a PHP problem or a MySQL > problem? Or somewhere in the MySQL extension? And how would I know? > > There is one clue to this otherwise vague problem. I believe that this > predominantly happens when the database is under an above average load. > > I would appreciate any help that I might be able to get. > > Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Content Management Systems
Hey all - I was hoping that I could get some advice! I am setting up a site that will be quazi-portal-ish in nature. As such, a lot of different people in a lot of different departments will be making contributions and editing parts of the site. I have never done something like this before, but I think what I am looking for is a content management system (CMS). Is this correct? I have been looking at a bunch of the packages from the list on HotScripts, and I have to admit I am overwhelmed and confused. It seems that packages such as Midgard, Typo3, etc. would need to be set up by the server admin.. This will not work for my situation. I am looking for a system that: 1. Allows multiple users. 2. Gives me complete design control. 3. Has a non-HTML editor interface (my clients are not so savvy), and 4. Can run just off of a PHP/MySQL interface that I can setup without access to anything but my server space and database. Does anyone have any suggestions? Thanks a bunch - you guys are the best! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bizzare duplicate mail() call
Hello all - this problem is so wierd that I don't even know where to start. Hopefully you all can give me a couple leads. I have some reporting systems going on in various places on the server - mail() is called when a user does this or that. These scripts are farily simple, so I am next to certain is isn't the code - but every once in a while, more than one duplicate email will be sent. What is so strange is that it only occurs for these odd periods of time. For example, yesterday from 4pm to this morning at 7am, 2 copies would be sent. Last week for several days, 5 copies would be sent. The emails are frequent enough (every couple of minutes) that it is very easy to track, but I don't have a clue as to what would be the cause. Does anyone have any suggestions as to where to start looking? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DAO/VO Pattern Help
Hello all, As I am trying to take my PHP code in a more enterprise direction with strict model/logic/view layers, I have been working with DAOs and the matching VOs. So I am running into a problem that I could really use some direction on: DAO/VO works great with single tables, but I tend to make my database work for its existance, and joins ar eeverywhere. What I don't understand is how to approach DAO/VO when table joins are involved. Can anyone think of some good resources? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php