[PHP] Dynamic Multi Dimensional Arrays
Hello Everyone, I want to emulate session objects (as opposed to variables). I stumbled upon creating multi-dimensional arrays, so I can do this: $name = 'Bob'; $year = '2003'; $HTTP_SESSION_VARS[$user][$year] = 'registered'; which gives $HTTP_SESSION_VARS['Bob']['2003'] = 'registered'; but I want to append an options array in this so what I want is: $options = array ( 'income' = 1, 'age' = 25 ); $HTTP_SESSION_VARS[$user][$options] = 'registered'; which gives: $HTTP_SESSION_VARS['Bob'][ [income]=1, [age]=25 ] = 'registered'; but this doesn't work. Is there any way I can have objects saved in sessions? Bobby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic Multi Dimensional Arrays
Hello Everyone, I want to emulate session objects (as opposed to variables). I stumbled upon creating multi-dimensional arrays, so I can do this: $name = 'Bob'; $year = '2003'; $HTTP_SESSION_VARS[$user][$year] = 'registered'; which gives $HTTP_SESSION_VARS['Bob']['2003'] = 'registered'; but I want to append an options array in this so what I want is: $options = array ( 'income' = 1, 'age' = 25 ); (Where the $options array is created dynamically from passed POST data). $HTTP_SESSION_VARS[$user][$options] = 'registered'; which gives: $HTTP_SESSION_VARS['Bob'][ [income]=1, [age]=25 ] = 'registered'; but this doesn't work. Is there any way I can have objects saved in sessions? Bobby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Multi Dimensional Arrays
Brad Pauly wrote: $HTTP_SESSION_VARS[$user]['options'] = $options; yes this is what I wanted. You could then add elements to this array like this: $HTTP_SESSION_VARS[$user]['options']['registered'] = 1; Is that what you are trying to do? - Brad I will try this out and see what happens. Thank you Tom and Brad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: on specific time in the month do script!!
look into executing your php script through cron. (Cron is a Unix schedular and nothing to do with PHP). Or you can use Tash Schedular (on windows servers, I guess). Also, check the archives but I think this issue was answered as above. Nabil [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] HI all; how can i run somthing or a function that only run on every month from the first untill the second on a specific time: in other word : the first two day of every month but it end on like 2pm of the second.. if ( today is 1/of any month untill 2/ of the same month at XX hour ) { return true} else {return false} thanks Nabil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to auto create a new page on the fly
also look into output buffering. so you would then do these steps 1. start buffer 2. redirect all output to varaible $output 3. echo Static HTML code (from opening to closing html tags) 4. when completly done all output, the variable $output should have all the html code 5. then using filesystem functions (fopen, etc...) dump variable into that newly created file and then you are done. If you have questions just post onto the list, but check the filesystem methods and the output buffering methods (ob_start, ob_flush, etc...). Bobby Dougd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would like to create a new page on the fly - basically having the PHP file to export content into a new static HTML file and save it as content.php. Make sense? Appreciate your help and insights. -Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mail funtion question
I haven't worked with PHP mail for a while, but since no one has responded I'll give you something to consider: 1. Why don't you try error suppression , @ ? or you can set error_reporting down or you can capture all output by using output buffering. 2. You can trap the invalid email, but it may be *more* complex and result in a slower script. You will have to evaluate this for yourself, $emails = array (); #array of email info # In the form # $emails[0] = array (email = mailto:'[EMAIL PROTECTED]' , name = 'Reciever Name'); # $emails[1] = array (email = mailto:'[EMAIL PROTECTED]' , name = 'Reciever Name 2'); $invalid_emails = array(); foreach ($emails as $index = $info){ $result = @mail ($info['email'], 'Bulk Newsletter Subject', 'email messafge') ; if (!$result) { $invalid_emails [] = $info['email']; // capture invalid email } } Please note, that the code above will call mail once for each email, so if you have 100 emails this will run 100 times, where as if you stacked all the emails into one mail call. But then you may not be able to find the invalid emails. Irvin Amoraal [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am using the PHP mail() function to send subscribed-to bulk email. It successfully sends emails to the valid email addresses, but I get a series of error messages at the top of the PHP page like: /home/[my folder]/dead.letter... Saved message in /home/[my folder]/dead.letter 123... User unknown I'm almost positive the error msgs are caused by invalid email addresses that are stored in the database. I have two questions: 1. How can I suppress the error msg's? @mail? 2. Can the error be trapped and the invalid email address captured to be spit out in code? Thanks for your help. Irvin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP should know my data!
Robert Cummings [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Unfortunately I don't think some people got the joke. Next thing you know their going to complain that PHP should have told them the punchline ;) I guess I got burned on that. I honselty though I could save one soul after not helping out that beuford guy with the longest thread that I have seen I'm really getting annoyed with PHP. I guess this shows that I'm not over 35 though, since I am not that familiar with COBOL, and took what John said with a grain of salt. Anyways, it's good to see some light humour after see that extremely long eye sore of a thread. Have a good one. Bobby Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hiding URL's...
If you want to restrict the download to once per user, the best is to use a database (or a I guess a file) which keeps tracks of who can download it and downloaded status, etc.. I haven't worked directly with this issue, but I would start by having a table Permissions with columns username, articleID, downloaded, authKey (and whatever else you may want). Then present the link to the user as getFile.php?auth=$authKey. where getFile.php is ?php $query = select downloaded, articleID from Permissions Where authKey = $_POST['auth']; $result = mysql_query ($query); if ($result) { $row = mysql_fetch_array ($result, MYSQL_ASSOC); if ($row ['downloaded'] == 'N') { # Update table and set downloaded = 'Y' # Select the text of article from Articles table or from disk and store in variable $contents header (content/type pdf); # or text/plain, or whatever type you need echo $contents; exit(); } } ? OK, I got tired of coding near the end (since I know you can do that), but I think that this may be better. If you just pass the file name to the script then you have to do checks that the user has access but how? Unless the user already logged in to a members area I guess. Anyways, there are problems to this script, for example if the download was terminated half way through, it's already set that it has been downloaded (maybe you can do the update query after the echo $contents, but I don't think that will help). That's my $0.02 Bobby Tristan Pretty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] com... I read this article, and thought it was perfect for me... Just the same prob I'm having... http://forums.devshed.com/archive/5/2002/06/2/37330 However, I don't understand how to get the file into an A tag where it can still find the file, AND make the URL useless if copied and pasted.. Am I missing the point, or is it staring me in the face? * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Webpage like MySql- need to be able to see all fields and edit
You could look at a nice GUI package that does all the database modifications , its called phpMyAdmin (www.phpmyadmin.net). But maybe this is too extrememe to what you want. Matt Hedges wrote in message news:[EMAIL PROTECTED] Hello. I am building a webpage for a sorority- http://www.olemissaoii.com . I built a basic php script where they add the sisters and their names, grad. date, and email. Is there anyway to build a page that shows all the fields where someone could go in and edit/add what they need? What I basically want is a webpage that works like MyCC SQL Database. The only thing I've been able to figure out is a basic update page, but using that they have to type in everything again- so for example if they want to change the email address, they'd have to retype the names and grad. date. So I'd like a script that shows all the rows and columns and allows someone to go in and change whatever field they want. Any help greatly appreciated, Hedges -- ___ | Matt Hedges | http://hedgesinnovations.com | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP webpage like MySQL, PART 2
Are you talking about editing mutiple rows at the same time? if so there is no efficient way to check what row has been edited and which haven't. What I would is use HTML variable arrays for the names of the fields. example you have input type='text' name='FirstName' size='20' maxlength='20' value='Allison' change the name attribute to name = [data][$id][FirstName], so now you have all variables grouped (note the use if a fixed index 'data', explination in foreach loop ). Then your script will loop through the POST variables and do sequential UPDATES example foreach ($_POST[data] as $ID = $Field) { $query = Update tablename Set First = '$Field[FirstName'], Last = '$Field[LastName'], Where id = $ID; #List all fields in the set clause mysql_query($query); } The reason for the initial 'data' index is so you can safely loop through a cetrain part of the post array. If you left that out you would deal with extra variables like submit, and other hidden fields. It's a little hard to work with multi-dimensional arrays, so what I usually do to help me is use the var_dump() on the passed POST array. So take a look at var_dimp(), HTML with array indexes, the foreach loop construct. HOWEVER, if you need to just let the user edit 1 row, what you have is fine all you have to do is pass the id number thourgh a HTML hidden field. So when you pull the rest of the fields and spitting out HTML spit this out somewhere in between the form tags :: input type='hidden' name='id' value='$id' Bobby Matt Hedges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Many hanks for ya'lls help earlier. I've figured out how to pull the data and edit it: http://www.hedges.org/aoii/olemiss/updatesister.php However, for some reason I can't get it to edit whatever row. In the code (pasted below) I have to specificy $id=row to edit... I can't figure out how to make it to where the user can select the field (which is the id/row) and edit it. I've tried putting a ?id=# at the end of the url, but that doesn't work... Any thoughts? So what I want is where it says $id=1 to have it someway where that is a variable that the user can define... Thank you. Matt -- ___ | Matt Hedges | http://hedgesinnovations.com | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP should know my data!
auto-populate data, as in putting in mock data depending on column type? or transferring data from another data source. If the former, you can look at 3rd party sources (I think I saw one from winSQL), if the latter you can convert any data source to a (tab, comma, etc.) delimeted file which you can load into MySQL through your own PHP script or I'm sure there is some php script out there that loads in CVS files. John Manko [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I just wrote a web app, but I'm completely disgusted with PHP. The application works great, but PHP is not smart enough to know what data belongs in my database. Really, I have to enter the stuff in myself. I spent 2 long days writing this (sweating and crying), and you mean to tell me that it doesn't auto-populate my database information? Come on, people! Data entry is the thing of the past! Maybe I'll convert my codebase to COBOL or something. At least, it has proven experience with user data! Sometimes I wonder how long this innovative technology will last when there are incompetent languages like PHP, Perl, and Java. Color me disappointed. John Manko IT Professional -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Input Submi Help
I thought you could, but actually I dont think you can ... however there is this little hack I just came up with. FORM Example form action = 'redirect.php input type = 'submit' name = 'Page1' value = goto Page 1 input type = 'submit' name = 'Page2' value = goto Page 2 /form Code for redirect.php ?php # Has button 1 been pushed/sent? if (isset ($HTTP_POST_VARS['Page1'])) { include ('page1.php'); exit(); #optional depending on programming style } # Has button 2 been pushed/sent? elseif (isset ($HTTP_POST_VARS['Page2'])) { include ('page2.php'); exit(); #optional depending on programming style } # Both buttons NOT been pushed/sent else { die ('no page selected'); } ? I hope you are familiar enough with PHP to understand the above. Basically depending on what Page variable was passed from the submit button, then you pull that script (either page1.php or page2.php). Note: The name attribute of the submit button must match in the POST array and also are case sensitive. Bobby Matt Palermo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a script that contains a form which goes to page1.php on the click of a submit button. Inside the form are lots of checkboxes and things to fill out that get passed to page1.php. I want to put another button in there that send all the same names and values of the checkboxes to page2.php. Is this possible to have 2 buttons going to 2 different places, but using the same data for all other form elements? I would really appreciate any help I can get. Thanks. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Value for entire file
it should be in the $_GET or $HTTP_GET_VARS array in the index.php script. put this at the top of your index.php script var_dump ($_GET); # or $HTTP_GET_VARS depending on PHP version and see if the value is there. Also, if you are using the value in a function and you have PHP 4.1.0 (I think), GET array is not global so to get this value you have to declare the array global example function some_function () { global $_GET; echo $_GET['year']; } NOT function some_function () { echo $_GET['year']; } Bobby Uma Shankari T. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am facing one problem..i am getting one variable value from another file by using href..I need to use that value in the entire file..how can i do that..?? for example i am using the href like this.. a href=$next/index.php?year=Apr1998 target=right i am passing the Apr1998 to the index file..i need to use the Apr1998 value fully in any places in index.php..how can i use that ?? please advice me.. Regards, Uma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session handling works on local server, but not when uploaded to ISP
It could be a warning in your script. On your local server, maybe you have error reporting set to minimal (ie. don't report warnings), whereas the ISP server might have it turned up higher by default. near the top of your script reporter_view.php put in the line error_reporting(E_ALL); ie. ?php error_reporting(E_ALL); PHP code ? Maybe line 5 is causing a warning? After you have error_reporting on full you may be able to solve the problem on your local server. For more info checkout error_reporting() on php.net Bobby Anders Thoresson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I've a login script that works fine on my local server, but when I runs it from my ISP I get the following error: Warning: Cannot send session cookie - headers already sent by (output started at /export/home/thore/public_html/phptest/reporter_view.php:5) in /include/accesscontrol.php on line 9 Warning: Cannot send session cache limiter - headers already sent (output started at /export/home/thore/public_html/phptest/reporter_view.php:5) in /include/accesscontrol.php on line 9 If I had made any mistake in my handling with the session functions, shouldn't that be the case also at my local server? -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie and learning
I wanted to attach one more point (esp. since this is an ecomm solution), you should also check your POST variables (in addition to the GET varaibles) to make sure they are clean and what are expected. It's not that hard to change posted values. Bobby Daniel J. Rychlik [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] PHP is, arguably, the better way to go when developing an ecomm solution. This list is full of very intelligent programmers that will help or direct you to the proper documentation. If you use $_GET you will be able to pass value pairs in the url. Make sure that in your data check script that you specifically assign variables to your $_GET in order to prevent malicious use. $HTTP_POST_VARS is probably a better way to go here. Its cross platform and will almost guarantee that you will be able to use on any server. $HTTP_POST_VARS['name']; $HTTP_POST_VARS['email']; Good Luck! -Dan - Original Message - From: Larry R. Sieting [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 27, 2003 5:22 PM Subject: [PHP] Newbie and learning Hello All, I have been reading and digesting information from this list for about two weeks now. I am doing some work and testing (both) and learning php on the way. Now I have seen several replies about using $_GET[] and $_POST[] and that if you ARE sending variables using the URL you _should_ use $_GET[] whereas if you are _not_ passing variables in the URL you should use $_POST[]. Is this correct? I just want to make sure I have it in my mind so that when I start passing info via url I use the right method. I ask this because I have a friend that wants to have me setup an e-commerce site for him. I am trying to decide if I should use ASP (gasp) or PHP (yeah). It will be a db driven site which will have images in the db and probably multiple tables with inner and outer joins and search systems. Yes, I have the 4000+ (pdf) page manual on my system and refer to it and read sections of it at a time (chunk). And I hope that I will be able to answer most of my own questions there or in other resources before I have to submit to the list. Thanks. Larry R. Sieting -- 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: Weird comparison error.
In PHP there are two operators for comparisons, the double and triple equivalance. Double equivalance just check's the boolean type so if (0 == 'n') is translated to if (False == False), where as triple equivalance checks the data types as well so if (0==='n') becomes if (Int(False)==String(False)) but since the data types don't match that would be False. to get a better reference check PHP.net for 'Bolean Types' , because I think I dodn't explain the double equivalance right, and also it will clarify situations of the Null type. Bobby Rob Adams [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I don't need anything fixed, I'm just curious about something I noticed. I'm doing a comparison between a variable and a hard coded char. Like this: if ($k1 == n) The variable is usually the first key in an array (0) so it should usually evaluate false, but it was true every time until I changed it to: if ($k1 === n) So I'm assuming that it decided that since $k1 was an int to convert n to an int (which would be 0) and conclude that 0 does indeed equal n. So I decided for fun to try: if (n == $k1) And it still was true everytime. So why does it always try convert my literal to an int instead of use the variable as a string? Just curious. Thanks. -- Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: differences in session handling between 4.1.1 and 4.3.1
maybe compare the php settings for both servers (using phpinfo()). Also check the register globals setting. I know this might not be a big help, but it's a start. good luck Bobby Anders Thoresson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Are there any big differences in session handling between 4.1.1 and 4.3.1 of PHP. Almost nothing works like it should since I have moved my site from my local server (4.3.1 on Win2000) to my ISP (4.1.1 on SunOS 5.7). I just started to dump my four $_SESSION-variables on top of every page, and to my big suprise they changes all the time. At login is store the users userid in $_SESSION['u_id']. At later times, I'm working with $_POST['u_id'] when for example changing administrators for different parts of the site. When I'm doing this, also $_SESSION['u_id'] changes. And at my localhost, $_SESSION's stays put. I'm going crazy here. -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: nl2br and br /
Since I haven't had any problems with br / I really don't care. However, if you are concerned why don't you write a function like this: my_nl2br($targetStr, XML = true) { $buffer = ''; if (XML) { return nl2br($targetStr); } else { $buffer = nl2br($targetStr); $buffer = str_replace ('br /', 'br', $buffer ); return $buffer } } You might be able to call the function nl2br but I am sure you will get a function name class or function re-declartion error, but if you are doing some OOP then you may be able to overide that. Maybe this is not the post you were looking for, anyways my 2 cents. Bobby Raymond C. Rodgers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm sure that this has probably been discussed before, but I couldn't seem to find any direct references to such a discussion. The line break tags that nl2br() produces have the forward slash embedded in them, which is not in the HTML 4.x standard. While this isn't a big deal really, the fact of the matter is that web browsers built to the specifications of the W3C HTML 4.x standards may not like this. In fact the W3C HTML validator reports this as an error. I read on the function description page that this is apparently an XHTML curiosity. Would it be possible for someone to add an optional flag to nl2br() to specify HTML rather than XHTML compliance? For instance, a call to nl2br() without XHTML compliance might look like this: $mystring=nl2br($myotherstring,false); For compatibility's sake, maybe default the flag to true and make the flag optional. If unspecified, the call to nl2br() would continue to function as it always has. However if specified, and set to false, the function would return the HTML compliant break tag br. Thoughts? Comments? -- Raymond C. Rodgers http://bbnk.dhs.org/~rrodgers/ http://www.j-a-n.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Array Dump
look at strlen() at php.net Daniel J. Rychlik [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hmm, I just noticed that array dump counts the number of charaters and white space and lables that number string... What function name is that ? The string counter I mean ? -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Query mysql highest id number
you can you the Mysql MAX function, I believe Select Max(ID) from Table; Also, you may want to look at PHP's mysql_insert_id(), (if you are trying to find the id number after an insert (if that's what you want)). Chris Schoeman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to make a query in a mysql database with as result the row with the highest id number. How can I do that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Processing Form Data /w $_POST
What kind of 'logical' order do you need for the Post array? To clarify: Do you need to write to a file the POST variables passed to the script? Kyle Babich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a form (setup.php) that passes values to processSetup.php when they are written into setup.txt. I'm trying to instead of writing every idividual value into setup.txt from setup.php, write a loop that will take as many values as there are in the $_POST array and write them all into a single array in logical order in setup.txt. I'm new to php and can't figure out how to do this. I'm thinking of something like... for ($_POST) { fwrite($setup, /*something to add current $_POST value to the end of an array within $setup*/); } How should I go about this? Thank you, -- Kyle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Processing Form Data /w $_POST
$setup_filename = /path/to/file/on/the/server/; $fd = fopen($setup_filename , 'a'); #a for appending to file, w to write from the beginning checkout php.net for more details on fopen $report = ; # #Apply any re-ordering of the Post array here to you 'logical' order # look at the manual for asort, ksort, etc foreach ($HTTP_POST_VARS as $index = $value) { $report = key:.$index. = .$value.\n; } fwrite($fd, $report ); fclose($fd); Kyle Babich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a form (setup.php) that passes values to processSetup.php when they are written into setup.txt. I'm trying to instead of writing every idividual value into setup.txt from setup.php, write a loop that will take as many values as there are in the $_POST array and write them all into a single array in logical order in setup.txt. I'm new to php and can't figure out how to do this. I'm thinking of something like... for ($_POST) { fwrite($setup, /*something to add current $_POST value to the end of an array within $setup*/); } How should I go about this? Thank you, -- Kyle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Processing Form Data /w $_POST
Yes that's right. this was just from the top of my head and it's early for me. it should be $report .= key:.$index. = .$value.\n; as Dan has pointed out. Dan Joseph [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, $report = key:.$index. = .$value.\n; actually, shouldn't it be: $report .= key:.$index. = .$value.\n; If you don't have the . there, its going to keep overwriting the report, and thus writing only the last $report item that was built. .= would concat 'em all together. Am I misunderstanding? -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call-time pass-by-reference feature really deprecated?
Isn't Call-time pass-by-reference the following $variable = myFunction1($x); Where myFunction1() is defined as function myFunction1($x) Where as pass-be-reference is called as $variable = myFunction2($x); Where is defined as function myFunction2 ($Obj); I think the latter is better anyways, because the caller shouldn't know the internals of the function, so you don't know if the function will copy the argument and use that instead. Dorgon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Maybe, there's a setting for this in php.ini. yes. there is: declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. pass-by-reference has not been dropped, it is Call-time pass-by-reference which is being deprecated. so call-time pass-by-reference is giving parameters as reference to functions, e.g. function returnObjectToAccumulator($obj) {...} If this feature is really dropped, how would you implement ConnectionPools for DB-connections for instance, or any classes managing a set of object and providing them by returning references? many OOP design patterns (primarily adopted from java) would not be possible anymore. I think this would be worth talking about. Is there any plausible reason for that decision? /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file downloading
create a script getFile.php when this is called first update the database, then using header you can stipulate what type of document it is and it will prompt for download for example for a Word document ?php #Query here to update the database #then after successful output the headers that will prompt for download # $data is the raw data of the document either from an fopen or from the database Header( Content-type: application/msword); Header('Content-Length: ' . strlen($data)); Header('Content-Disposition: attachment; filename=document.doc'); echo $data; ? Notes: make sure you don't echo anything before the headers even suppress any errors that may come from query you can call the script through the web page as follows a href ='getFile.php' Click here to download the document /a Mark Roberts [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I need to provide a way for users to download data files from a web site. I know that I could have then right click and save-as, however, I need to record this action in a database. If they just right click, I don't have any way to trigger the script to record the transaction. Does some one have a good way to do this, or at least give me some ideas? Thanks. Mark Roberts Sr. Systems Analyst -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pipe $var to a shell command
maybe try exec? $instruction = $myOutput command ; # for piping (as I recall) I used to do the input from the right, but I don't think that will make a difference exec ($instruction); Bobby exec (command Tim T [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a mem var $myoutput I would like to pipe it to the input of a shell_exec command. I tried shell_exec(command $myoutput) however this is not quite right. Anybody have any ideas?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: General question...
You can try using the cURL package with PHP. I use it with a system call. $curl_path = /usr/bin/curl; # or full path of curl $post = 'amount=3.40merchant_id=2351235'; #POST key value pairs with , these variables will be POSTed to site $command = $curl_path -d \$post\ $gateway_url; exec($command, $responce); the $responce variable holds any out put from the site. Then you will have to parse the HTML (which I hate). The above technique is best for when the site you call post back variables (thus no parsing). Now, this is with PHP with no cURL package, if you have it installed than maybe you can use the cURL Library to do the above. Valentin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hi all, is it possible with php: first to pass request to another URL and after that to get the html responce as a string and put it into php $variable? best, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: REDIRECT
not with php directly, but you can do that with HTML meta tags, check google for Meta refresh Dale [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does anybody know of a way to redirect to another page once you have already outputted html to the screen. In other words, I want to output some text to the screen for 10 secs and then re-direct to another page. Thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I display new lines in a textearea?
this is discussed in the posted comments under the function section of nl2br on php.net. But from what I remember there is no br2nl() (unfortunately). just goto php.net/nl2br and search the posted comments for br2nl Bobby Petre Agenbag [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I want to have a textarea that contains details read from a mysql table, but I want to echo each row so that it is on a new line. What is the new-line character for a textarea? ( in effect the reverse of nl2br() ) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using register_globals
If it's a preference it's a bad one. Have register globals set to ON is one way of leaving your script open to being exploitable. I would suggest that if you really need to use that code then either modify it or write something from scratch and use that code as a guide line. search php.net for register globals and the warnings associated with it. Bobby Todd Cary [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have noticed that quite a few applications are designed with the assumption that register_globals = Yes; in other words, the application does not use $HTTP_xxx_VARS. In contrast, I always retrieve my vars. Is there a preference? Todd -- I have noticed that quite a few applications are designed with the assumption that register_globals = Yes; in other words, the application does not use $HTTP_xxx_VARS. In contrast, I always retrieve my vars. Is there a preference? Todd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using register_globals
I agree that you can write secure scripts with register_globals set to ON. I usually think that alot of rookie PHP programmers (I just started PHP a year ago, myself) read the list, and the way I figure is that it is good to make readers of the list aware of the issues of register globals. Plus, after coding in both states of register globals, I personally like explictly referring to the assoc array $HTTP_xxx_VARS to retrieve the variable. Coders are familiar with magic numbers and we should stay away from that, but to me register_globals seems like magic variables I look at this variable and I think to myself Where did this variable come from? (but that's just me). Rasmus Lerdorf [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 4 Jun 2003, Jay Blanchard wrote: [snip] On Wed, 4 Jun 2003, Jay Blanchard wrote: [snip] Have register globals set to ON is one way of leaving your script open to being exploitable. [/snip] Please explain this, how does it make it more exploitable? I think that this is only true if the code is sloppy. Correct, if you properly initialize your internal variables there is nothing insecure about leaving register_globals on. [/snip] Then why has there been such a big deal about register_globals security? Is it because so much code is sloppy? From a robustness perspective, it is not a bad idea to be more explicit about where your user data is coming from and being able to easily distinguish user-oriented data from internal data. What has been blown a bit out of proportion is the idea that you cannot possibly write secure code with register_globals on. That is of course completely false, but you do have to be a little bit more careful which why the default was changed to error on the side of safety. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (no) file creation by convert (ImageMagik)
I am working on creating a thumbnail script but the obsticle is that 'convert ' doesn't create a file from the script. I am doing a system call with the following ?php exec('convert -size 400x293 /home/original.gif -resize 8x8 /home/thumb.gif'); exec('cp /home/test1 /home/test2'); # Copying an existant file does work, but calling convert to create a file doesn't ? Where thumb.gif is the name of the new file to be created. After I run this script, no file is created, however if I run it from the command line (as httpd or any user) it works. Bobby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Text file breaking!
try this $string = ereg_replace ('\r\n|\n|\r', 'br', $string); OR $string = nl2br($string); NOTE: for me the first case will remove the newline, whereas the second will keep them (It might be becuase of my old php version [4.06]?) Zavaboy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ok, I don't get it... I put a string to one line ( $string = str_replace(\n, br, $string); ) but when I put it in a text file I see breaks right before br. For example: I have a text area and type: 1 22 333 then, I take that string and replace \n with br. $string = str_replace(\n, br, $string); then, I put the string in a txt file... and here's what I see in the text file: 1 br22 br333 instead of: 1br22br333 How can I make it that way? Thanks in advance! -- - Zavaboy [EMAIL PROTECTED] www.zavaboy.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Create Links on the fly?
###HTML snippet form action = redirect.php Enter Number : input type=text name=number /form ###PHP ?php $number = $HTTP_POST_VARS['number']; # or $_POST['number']; depnding on PHP version header (Location: http://www.mypage.com/.$number); exit(); ? ### NOTE: I just wrote this on the fly so there is no error checking or sytnax checking Hopefully this makes sense and doesn;t need explanations, but if so just post the list and me and I'll get back to you. Bobby Chase [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Salutations! I am trying to do something fairly simple, but I can't seem to make it work... I want to have a form field on a page that the user will put in a 3 to 5 digit number and when they click on Submit that number will become part of an URL that they are forwarded to. For example, if the user put in the number 123, then when they click on Submit they would be pushed to http://www.mypage.com/123. Can anyone offer help?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Missing session vars when doing var_dump()
I would think that they are 16 key/value pairs when the MySQL (TEXT) fields are null thus the session variables are NOT set thus NOT present. Hypothsis: I believe that your are using mysql_fetch_array($query_resource), try using the second parameter as well ie. mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net for details of mysql_fetch_array). By using the second parameter, even NULL values will has a variable set. Example say you had a field called FirstName in the MySQL database. If it was NULL, then without the additional parameter you would have NO key named 'FirstName' exisiting (ie it is not set). But if you used the second parameter a key would be created with no value (ie it is set but empty). So remember, the second parameter is OPTIONAL, but it has different behaviors when you do (and do not) use it. Hopefully I cleared it up (or at least shed some light). checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php Gavin Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I have come across a strange problem. I have an application that a user logs into and when I find the user in the database I load all the custom info for that use which I store. By the time I'm done, the session array has 18 key's. When I do a var_dump($_SESSION) I sometimes get 18 variables and sometimes I only get 16. The two fields that are missing are TEXT fields from a MySQL database and they also appear to be the last two keys when var_dump() returns all 18 keys. Does anyone know what is causing this, it's driving me crazy at the moment with many late nights. The PHP version running is 4.2.3 Regards Gavin Auckland, New Zealand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Missing session vars when doing var_dump()
Are the queries the exact same every time you refresh them? This seems just to be programming logic (I guess). Post some code and maybe someone (or I) will be able to help you out. Gavin Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your input Bobby I was using mysql_fetch_array() but changed to mysql_fetch_assoc() The funny thing is, I have a page that does the var_dump() and all I'm doing is refreshing the page and sometimes I get 18 other times 16 variables Gavin Auckland, New Zealand -Original Message- From: Bobby Patel [SMTP:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Missing session vars when doing var_dump() I would think that they are 16 key/value pairs when the MySQL (TEXT) fields are null thus the session variables are NOT set thus NOT present. Hypothsis: I believe that your are using mysql_fetch_array($query_resource), try using the second parameter as well ie. mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net for details of mysql_fetch_array). By using the second parameter, even NULL values will has a variable set. Example say you had a field called FirstName in the MySQL database. If it was NULL, then without the additional parameter you would have NO key named 'FirstName' exisiting (ie it is not set). But if you used the second parameter a key would be created with no value (ie it is set but empty). So remember, the second parameter is OPTIONAL, but it has different behaviors when you do (and do not) use it. Hopefully I cleared it up (or at least shed some light). checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php Gavin Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I have come across a strange problem. I have an application that a user logs into and when I find the user in the database I load all the custom info for that use which I store. By the time I'm done, the session array has 18 key's. When I do a var_dump($_SESSION) I sometimes get 18 variables and sometimes I only get 16. The two fields that are missing are TEXT fields from a MySQL database and they also appear to be the last two keys when var_dump() returns all 18 keys. Does anyone know what is causing this, it's driving me crazy at the moment with many late nights. The PHP version running is 4.2.3 Regards Gavin Auckland, New Zealand -- 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] Re: Missing session vars when doing var_dump()
If you it's either ALL or Nothing then I would think it has something to do with retrieving sessions from the client (in the form of the cookie) or on the server (in the form of the session file, default is /tmp on *nix systems). I ran your script on my server where I have session varaibles and I never had a problem. I'm out of ideas now. Gavin Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Bobby The following is a copy and paste of the page I'm using to generate the problem. I have 18 keys in the $_SESSION variable and just by simply refreshing the page with the following code, it returns either array(0){} or session info and array(18){ will all the correct variables }. I must be doing something fundamentally wrong somewhere. Thanks very much for your willingness to help me. ?php session_start(); ? html head /head body ?php foreach( $_SESSION as $key = $value ) { echo font color=\FF9900\SESSION[$key] = $valuebr; } echo brbr; var_dump( $_SESSION ); ? /body /html Gavin Jackson, RD Software Engineer, Tru-Test Ltd. Phone: +64-9-9788757, Fax: +64-9-979, [EMAIL PROTECTED] Tru-Test Ltd, P.O. Box 51-078, Pakuranga, Auckland, New Zealand -Original Message- From: Bobby Patel [SMTP:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 3:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Missing session vars when doing var_dump() Are the queries the exact same every time you refresh them? This seems just to be programming logic (I guess). Post some code and maybe someone (or I) will be able to help you out. Gavin Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for your input Bobby I was using mysql_fetch_array() but changed to mysql_fetch_assoc() The funny thing is, I have a page that does the var_dump() and all I'm doing is refreshing the page and sometimes I get 18 other times 16 variables Gavin Auckland, New Zealand -Original Message- From: Bobby Patel [SMTP:[EMAIL PROTECTED] Sent: Friday, March 21, 2003 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Missing session vars when doing var_dump() I would think that they are 16 key/value pairs when the MySQL (TEXT) fields are null thus the session variables are NOT set thus NOT present. Hypothsis: I believe that your are using mysql_fetch_array($query_resource), try using the second parameter as well ie. mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net for details of mysql_fetch_array). By using the second parameter, even NULL values will has a variable set. Example say you had a field called FirstName in the MySQL database. If it was NULL, then without the additional parameter you would have NO key named 'FirstName' exisiting (ie it is not set). But if you used the second parameter a key would be created with no value (ie it is set but empty). So remember, the second parameter is OPTIONAL, but it has different behaviors when you do (and do not) use it. Hopefully I cleared it up (or at least shed some light). checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php Gavin Jackson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi I have come across a strange problem. I have an application that a user logs into and when I find the user in the database I load all the custom info for that use which I store. By the time I'm done, the session array has 18 key's. When I do a var_dump($_SESSION) I sometimes get 18 variables and sometimes I only get 16. The two fields that are missing are TEXT fields from a MySQL database and they also appear to be the last two keys when var_dump() returns all 18 keys. Does anyone know what is causing this, it's driving me crazy at the moment with many late nights. The PHP version running is 4.2.3 Regards Gavin Auckland, New Zealand -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing variable from webpage to php (newbie?)
You have register_globals set to off (read up on register globals in php.net). your code should read $HTTP_POST_VARS['action'] or $_POST['action'] (depending on PHP version) INSTEAD of just $action. so to test an if:: if ($HTTP_POST_VARS['action']==1) { /* Code for if action is equal to 1 */ } Of course checkingif the variable is set or empty might be a good idea as well, is set example: if (isset($HTTP_POST_VARS['action'])) { /* Code if the variable POSTed is set */ } Joe Kupiszewski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I think I already tried to post once, so sorry if this is a duplicate, but I don't see my first attempt. I am trying to do what should be a relatively simple and basic task. I've got a php script/page that has a switch/case selection statement in it. Obviously, depending on what value a particular variable takes when passed to the script, the script SHOULD :) do different things. However, when I invoke the script using www.somedomain.com/somephpscript.php?action=1 (substitute one with, 2, 3, 4 or whatever) and then do a check whether any value is passed to my script, it always tells me the value is empty ( if (empty ($action)) - it just always thinks its empty. I'm copying this script from a book, so I do not have any reason to believe there is an error in the code, but obviously something is not happening properly. My thought is that perhaps something needs to be turned on in the php.ini or in the apache httpd.conf file to allow this variable passing to work. Is there some other way to do this? Sorry for the long paragraph sentence. I'll be happy to post the code if needed or provide any additional information or give the actual URL so you can see what is happening. Thanks for any thoughts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SMTP Authenticate
There is another php mailer class which is really good (and includes authentication among alot of other things). http://phpmailer.sourceforge.net Aitor Cabrera [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm trying to use the mail() funtion but I can only use this funtion the email myself (the same email that I put in the php.ini file). I f I try to email someone else I get an error 530 delivery not allowed to non-local recipient, try authenticating -7 How can I authenticate myselft? Which is the SMTP comand to do it and how do I use it? Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Page Rederection Problems
header(location: http://www.website.com http://www.website.com/ ); I usually use header() like this : header(location: http://www.website.com;); you can try that, maybe it might work. Kelly Protsko [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Basically what I am doing is having a post call a page with the following code to email the form contents. I want the page to redirect back to the page it was sent from after the mail has been sent. The top mailing part works fine but when I put the header redirect in at the bottom I get an error on my post saying the page doesn't exist anymore. Any idea what would be causing this? $formcontent = $_POST[content]; $toaddress = [EMAIL PROTECTED]; $subjectline = $_POST[subject]; $headers = From: $_POST[email]; mail( $toaddress, $subjectline, $formcontent, $headers); header(location: http://www.website.com http://www.website.com/ ); Thanks Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Setting session variables from value in database
are you sure that $row['user_type'] has a (non-null) value? Mike Tuller [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a login page and have sessions working so that if a user is in the database, they can login. I want to also add a user_type to the session so that I can have regular staff see certain things, and admin's see other things, but I can't seem to pull the information out of the database. Here is part of what I have. $query = select * from users where username='$username' and password='$password' ; $result = mysql_query($query); $num = mysql_num_rows($result); $row = mysql_fetch_array($result); $_SESSION['user_type'] = $row['user_type']; $user_type = $_SESSION['user_type']; if ($num 0 ) { $_SESSION['valid_user'] = $username; $valid_user = $_SESSION['valid_user']; } Now if I tell it to print $valid_user, it shows the user logged in, but if I try to print $user_type I don't get anything in return. Any ideas as to what I am doing wrong? I have tried a separate query for the mysql_fetch_array, and that didn't seem to work either. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help with parsing form input ...
eregi_replace([^[:alnum:].], , $string_val); notice the period after the first closing brace. Kenn Murrah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks ... one more thing: is there a way to modify this to allow a period (dot) to included, as well as the alha and num characters? once again, thanks. function make_alphanum($string_val) { return eregi_replace([^[:alnum:]], , $string_val); } strips everything except ALPHA and NUM Chars Joel Kenn Murrah [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Greetings. I'm out of my league here, not knowing enough about regular expressions yet to do this, so I desperately need someone's help ... I need to parse form input to eliminate unwanted characters (punctuation, mostly) ... for instance, if the web site visitor types smith,susan--33 into the field, i want to parse that line to eliminate the initial space, the comma, and the dashes so that $myvariable=smithsusan33 any help in doing this would be GREATLY appreciate. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Checking for Null Variables
you can look at isset() and empty(). If you retrieve the query result with Mysql association (ie. $field=mysql_fetch_array($resource, MYSQL_ASSOC), then even the field has a blank value, there will be a blank variable created ($field[Name] is created but with no value)), however if you grab the resource values as such $field=mysql_fetch_array($resource), then a blank field will not create a $field[Name]. So, if using : $field=mysql_fetch_array($resource, MYSQL_ASSOC) if(empty($field[Name])) { do this } else { do this } OR $field=mysql_fetch_array($resource) if(!isset($field[Name])) { do this } else { do this } Christopher J. Crane [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How do I check if a variable is blank or not. I am returning data from a MySQL database and if a field is empty I would like to do something different. I tried if($field[Name] == ) { do this } else { do this } It does not work right. Actually, at one point, it was working in the exact opposite manner. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scroll through values sent from a form
$fields=''; $values=''; foreach ($_POST as $field - $value) { $fields .= $field., ; $values .=$value., ; } $fields = substr ($fields, -2); // strip off last comma and space $values = substr ($values , -2); // strip off last comma and space $query = INSERT INTO $_GET[table_name] (.$fields.) Values (.$values.); St [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to scroll through values posted from a form using PHP? Here is my problem: I have a form on a page which is created dynamically from the number of fields in a particular table, so when I POST the data how do I create the INSERT statement? I feel this will be awkward due to the construction of the INSERT statement and I would be very grateful for anyone's input. The form names are the same as the field alues in the table... It will need to be something like $query = while (more Form Fields){ $query = $query + 'form fieldname'; } $query = $query + ) VALUES (; while (more POST Values){ $query = $query + POST Value; } $query = $query + ); I hope this makes sense to the reader! Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: All Code Executing Even After header() Redirect
Add an exit statement after the header call. But I thought the same thing that after header nothing would be executed. if (!LoggedIn()) { // If not logged in, take to Login page. header(Location: /login.php); exit(); } I just gave you this soultion to solve your problem, maybe someone else can shed some light why LogAccess() is executed. Monty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] At the top of every page in my site I have a snippet of code that authenticates the user by checking for valid SESSION vars and their contents. If they don't, they are redirected with a header() statement to a log-in page like this: include_once(function_library.php); session_start(); if (!LoggedIn()) { // If not logged in, take to Login page. header(Location: /login.php); } LogAccess($_SESSION['user']); // This function logs user's access. I noticed that the LogAccess() function I have after the header() redirect is executing, even if the user is not logged in and is redirected to the Log-In page. I did confirm that the LoggedIn() custom function is working properly and returning the right value. I thought the code below the header() redirect would not actually be executed unless the user was logged in and allowed to proceed. Is this how PHP is supposed to work? Is there any way to prevent the script from executing below a certain point if the user is not logged in? Thanks, Monty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date range assistance needed
I believe PHP and MySQL use two different definitions of the start of a time stamp. One uses 1974 the other 1900 (I don't know exactly). If you echo strtotime($attributes[startdate]) , UNIX_TIMESTAMP (datestamp) Also, in your query you are looking for all headlines that have strtotime($attributes[startdate]) == UNIX_TIMESTAMP (datestamp). you have two strtotime($attributes[startdate]) but not an 'end date ' Charles Kline [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here is my current query: $qAnnouncement = 'SELECT id,headline FROM tbl_funding WHERE 1 AND ((UNIX_TIMESTAMP (datestamp) = ' . strtotime($attributes[startdate]) . ') AND (UNIX_TIMESTAMP (datestamp) = ' . strtotime($attributes[startdate]) . ')) LIMIT 0, 30'; Where datestamp is set in MySQL with a timestamp(14) and $attributes[startdate] and $attributes[enddate] are in the format mm/dd/ My query does not return any results. I know there must be something wrong, can anyone point it out? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Creating MySQL Entry Forms
What I would recommend is PHPmyAdmin. I believe it's open source and written in PHP specifically as a utility for mySQL. I'm sure you can find it at sourceforge.net (or a similar site) . Jeremy N.E. Proffitt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I need to create some simple web forms for entering, changing, deleteing information from a fairly simple MySQL database. This is to be for internal use, so doesn't have to be really fancy or have alot of error checking. I could make a form for each table myself, but I would think their is an easier way... Cheers Jeremy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Value of $var as a variable?
function getID($variable){ return $HTTP_GET_VARS[$variable]; } Patrick Teague [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I know I've seen something about this (I can't remember whether yea or nay), but I can't remember where I found it as at the time I was looking for something else... and now that I'm looking for it I can't find it again. Anyways, what I've done is store variable names that end up being passed as part of various query strings in some variables similar to - $var_id = id; $var_name = name; In the file that receives the information I'd like to know if there's a faster way of finding out the value of the passed variables in the query string than a function that explodes the query string returns the value of the requested variable. i.e. - function getID($variable) { // explode 'var=x' from query string $id = explode( , $_SERVER[QUERY_STRING] ); // search to find correct 'var=x' from query string for( $i=0; $icount($id); $i++ ) { // if $tag is found, extract value assign to $value[] if( $r = eregi( $variable.=([0-9])*, $id[$i], $regs ) ) { $value[] = $regs[1]; } } return $value; } Patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Efficient db connect function?
As the previous post of using die would be better. Also try using mysql_pconnect (for persistant connections) and also, if you are running more than one query per script execution, then DON'T keeping trying to connect/select database. I suggest you do the first two things at the start of ALL the scripts that will need to connect to the database, so make an include file with 2 things (connecting and selecting a database). Then make another function just for queries, this way on the second and onward queries will save overhead some from connecting and selecting a database. bobby Cf High [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey all. I'm currently using the following db connection function, but I'm not sure if it's as efficient as it could be. function dbConnect($SQL) { global $result; // Connect to DB if (!$link = mysql_connect($db_host, $db_user, $db_pass)) { $result = 0; echo mysql_errno() . : . mysql_error() . \n; } else // Select DB if ([EMAIL PROTECTED]($db_name, $link)) { $result = 0; echo mysql_errno() . : . mysql_error() . \n; } else { // Execute query if (!$result = mysql_query($SQL, $link)) { $result = 0; echo mysql_errno() . : . mysql_error() . \n; } } } return $result; } *** Is there a faster way to establish a connection run a query, or am I wasting my time over nothing? * --Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing emails to database
I have an idea that might work in theory. Provided that you have php running on a Unix based OS. You could forward all emails to an email that sits on a Unix server. There they are stored as plain text files, then just parse what you need on a daily basis and truncate that file to 0 bytes. BUT it sounds that you have the whole setup on a Windows based machine/server. If you can get access to PHP and Mysql on a unix server then you will have a chance. I just did a quick check on the PC and it seems that Outlook express creates files with a DBX extension to hold email folders. I found mine at C:\WINDOWS\Application Data\Identities\{JIBBERISH HEX}\Microsoft\Outlook Express. Try anyalsing these dbx files (open them up in a text editor). But there HUGE even just if they have one message in them. good luck Alberto Brea wrote in message 00e501c2d81f$e66d3e20$[EMAIL PROTECTED]">news:00e501c2d81f$e66d3e20$[EMAIL PROTECTED]... Hi, list Is there any way in PHP to pass the emails received automatically into a local MySQL database on the same machine (i.e. the fields datetime, from, to, message, subject, etc), without copying and pasting each message? Maybe by retrieving and parsing the Outlook Express files that keep the emails? (the e-mail is received by Outlook Express, and via browser from a Yahoo account). Thanks for any help Alberto -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File not rewritable - why? Help needed.
Are you on a Windows platform, or *nix. I would assume *nix since you mentioned chmod. what did you chmod the file to? who owns the file? and what user does PHP run as (maybe nobody, or httpd)? Just to get it to work chmod the file to 777, BUT this is a security risk. MAKE SURE this file is NOT in the web folder (or any of it's subfolders). Remember to write to a file PHP (the user nobody or httpd) also needs Read and eXecute permisions on all the directories from the root all the way to the directory contaning the file. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Newbie question: I try to modify a txt-file but get not writable error. (just like in http://www.php.net/manual/en/function.fwrite.php ) I've tried to change the chmode but now I need some help. All info welcome! Thanks in advance! Paul Dunkel -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Time
What you could do, is get the current time stamp using time() or date() and create a sesion variable with this value, when they login (and the session is created. Then when they logout, and the sesion is destoyed get the current time stamp again and minus it from the start time. Note: This requires the user to login and logout, if they just close the browser then they will never get to your logour script, thus you can't calculate their money owed. Stephen Craton [EMAIL PROTECTED] wrote in message 004e01c2d11a$0e3a4590$0200a8c0@melchior">news:004e01c2d11a$0e3a4590$0200a8c0@melchior... Got a quick and easy question that I'm not sure about. What I need to do is calculate how long someone has been in a chatroom, then update a members table to add some money to their account. Something like this: For every hour they're in the chatroom: 5 cents Thanks, Stephen Craton http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Read file and get what i want
Check out explode() $file // say this variable has your file contents $lines = explode (\n, $file); // lines contains each line of the file foreach ($lines as $line - $content) { if (strrpos($line, ':')) { $values = explode (':', $content); echo The first value is : .$values[0]; } else { echo This line doesn't contain a : moving to next line; } } NOTE: if \n doesn't work try \r\n , I think. Also this is mostly from the top of my head so there might be some syntax problems. Miguel BráS [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello gents, I made a script to open a file on a server and write his content to a temp file on my server. A part of the temp file is below: ***temp file** !GENERAL VERSION = 1 RELOAD = 1 UPDATE = 20030206181916 CONNECTED CLIENTS = 178 CONNECTED SERVERS = 12 !CLIENTS AHS5577:134723:RUBÉN FALCÓN LEBG:PILOT::42.226630:-1.795440:35248:423:T/B763/F:410:LEBL:35000:LEST:IVANB E:1:1:4001:0:40:0:I:1715:1715:1:30:4:30:NONE:NONE :LEBL - LOBAR 1C - UN725 - LOMDA 1G - LEST:::20030206181830 OBS::FRANCIS BALLION:ATC:199.999:44.791670:0.541670:0:0::IVANDE:9:1:0:0:100:: 20030206181821 I-JEST:127128:ROBERTO PIETRAFESA LIBG:PILOT::41.791590:12.244720:17:0:T/B737/T:300:LIRF:15000:LICD:IVANBE:1:1 :0:0:40:0:I:1930:1930:1:0:4:30:NONE:CHARTS ON BOARD :LIRF-ROTUN-CORAD-GIANO-PAL-PAL14-LONDI-MABOX-RATOK-MADIR-ASDAX-DEDUK-LPD-LI CD:::20030206181816 ELY0001:127632:OMRI ATAR LLBG:PILOT::31.996330:34.892110:153:0:T/B772/F:486:LLBG:FL380:KJFK:IVANGR2:1 :1:1200:0:40:0:I:1000:1100:1:30:4:30:NONE:NONE :DENA1E - SUVAS KAROL APLON MAROS DASNI TOMBI AYT KUMRU ELMAS EKSEN KFK HANKO GAYEM WRN BALIK ARGES BUKEL PELUR DEMUN REBLA KARIL PITOK SLC BABUS BNO BODAL VLM ILNEK DONAD VARIK PEROX SODRO TABAT TAMEB ROBEL KEMAD HMM RELBI RKN TENLI FLEVO:::20030206181756 DLH001:138912:MANUEL KAUFMANN EDDT:PILOT::52.556900:13.294230:133:28::IVANDE2:1:1:1200:0:40::: :::20030206181755 *End of temp file*** Now the tricky part... Each part is separated by a : Example AHS5577:134723:RUBÉN FALCÓN LEBG:PILOT:: first part is callsign, then is the id, then the name, type and so on and on (some parts has no data ::) Now, how do I get the first part (callsign) of each line so i can make something like: if ($first_part ==TAP){ echo TAP is online; } else { echo TAP isn't online; } Was I clear enough? Anyone has an ideia for this? Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php pages broken after moving to a newer version
try looking at the status of register_globals on both versions. Chip Wiegand [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jason Wong [EMAIL PROTECTED] wrote on 02/05/2003 12:49:16 PM: On Thursday 06 February 2003 04:41, [EMAIL PROTECTED] wrote: After copying the web site to the new server some pages no longer include the 'include' pages. I am using php frames. I load the index page, it's just blank, white. I can load the included pages manually through the url and they load okay. I am wondering if there is something in the php config file I need to set for the include path, but when I was in that file I didn't see any such setting, like in the earlie versions of php. 1) Read the changelog/history/release notes of all versions of php between the 4.0.3 and up to 4.2.3 2) Check the php log (turn on full error reporting). I checked the change log for all instances of 'include' but found nothing relevant. The log is 23 pages long and doesn't to all the way back to 4.0.3. Could you perhaps give me a hint as to something else to look for in the log? -- Chip -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Woodward's Law: A theory is better than its explanation. */ -- 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: Array find a element
look at array_key_exists Narciso Miguel Rodrigues [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is possible to do something like if ($username in $users) ... or i need to do a foreach($user){...} Thks [MsR] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Variables
This variable is registered in the Session, and the variable isn't active until the page refreshes. It's hard to explain. I thought I would try. There are some things you can do. If you need the variable right away, you can do this: if (isset($HTTP_SESSION_VARS[user1])) { $user1 = $HTTP_SESSION_VARS[user1]; } else { $user1 = $HTTP_POST_VARS[user1]; } echo $user1; Hope that helps. This is natural for sessions, but I have been in the situation where I needed the session variable right away, instead of the script's next activation. Jed R. Brubaker [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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] Re: File upload problem
Since you have 'safe-mode' on, Register globals will be turned off, so you should test $HTTP_POST_VARS['Submit'], instead. John M [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I have the code below. It's a simple file upload. But it doesn't work. Before the line if(isset( $Submit )) is an echo which can I read. But after choosing a file and press a submit nothing happens. Why is if(isset( $Submit )) always false? Maybe my apache or php config is wrong? I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir is c:\tmp\ and upload_max_filesize is 2M in PHP config file. Thanks! html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body form name=form1 method=post action= enctype=multipart/form-data input type=file name=imagefile input type=submit name=Submit value=Submit ? echo Before submit br\n; if(isset( $Submit )) { echo After submit br\n; if ($_FILES['imagefile']['type'] == image/gif){ copy ($_FILES['imagefile']['tmp_name'], files/.$_FILES['imagefile']['name']) or die (Could not copy); echo Name: .$_FILES['imagefile']['name'].; } else { echo ; echo Could Not Copy, Wrong Filetype (.$_FILES['imagefile']['name'].); } } ? /form /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Multiplication of double
It seems you have register globals set to off, thus when you have variables $price and $qty they are just fresh variables, you might try $HTTP_POST_VARS['price'] and $HTTP_POST_VARS['qty'] (don't forget the single quote). Cesar Aracena [EMAIL PROTECTED] wrote in message 01c2bfeb$cecbd5c0$7a00a8c0@NOTEBOOK">news:01c2bfeb$cecbd5c0$7a00a8c0@NOTEBOOK... Hi all, I guess this problem might sound childish for most of you, but I'm having it right now. I get two numbers from a FORM, one price and one quantity and I need to make a multiplication with them in order to store the total amount also as a double expression... I'm trying with: $totalprice = $price * $qty; but when I echo the, it gives me just plain old 0 (zero). Any suggestions? Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: hyperlink and mySQL
I have done something similar: write a script that takes an Article ID, and displays the text. So to displat article #3, you would call it like getArticle.php?id=3. Skelton for getArticle.php - take id and store in $id - Select FullBody from Articles where ID = $id - $body = query['FullBody'] - then echo $body That's the basic idea, if you have any problems email me and post to the list. M.E. Suliman [EMAIL PROTECTED] wrote in message 000f01c2bf1b$e95fff40$4abe1fc4@b1s0n2">news:000f01c2bf1b$e95fff40$4abe1fc4@b1s0n2... Hi I have created a simple script that pulls the three latest news entries from a mySQL database and displays it on a webpage. At the end of the preview paragraph of the news story there is a hyperlink to access the full text specific to that preview. How would I do this? Any ideas would be appreciated. Mohamed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Auto Incrementing in PHP
One quick note, if you DO NOT have access to a database, you could store that incremented number to a file. And open and retrieve, and increment every time you need. If you need to take this approach checkout php.net and search for fopen. Don Mc Nair [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi Is there a way for a php page to automatically increment a number and store it every time the page is loaded. I want to generate an invoice number that goes up 1 everytime the HTML form is sent to it. Thanks --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.435 / Virus Database: 244 - Release Date: 01/01/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing variables to a sql statement
It seems that error is from an ill-formed MySql statement. Try this, $descripQuery = SELECT descrip from project_descrip where rowid=$foo; echo $descripQuery ; // put in this echo after the query. $descripResult = mysql_query($descripQuery); echo mysql_error(); file://put this echo after query execution Now, run it and see on screen what query is actually executed. Jennifer [EMAIL PROTECTED] wrote in message 003401c2bf2b$0a042d20$8101a8c0@fvcrx01">news:003401c2bf2b$0a042d20$8101a8c0@fvcrx01... hi, i'm hoping someone can help me out here - im trying to pass a variable from a string in the href tag, however my sql breaks when i put a var in the statment. when i replace $foo with a number, the page works fine. can someone please tell me what im doing wrong? here is the error i get: Warning: Supplied argument is not a valid MySQL result resource in /home/villany2k1/www.villany2k1.com/htdocs/projects/projects_descrip.php on line 11 here is my code: ?php $hostName=localhost; $userName=; $password=; $database= projects; $tableName=project_descrip; $descripQuery = SELECT descrip from project_descrip where rowid=$foo; mysql_connect($hostName, $userName, $password); $descripResult = mysql_db_query($database,$descripQuery); while($row = mysql_fetch_object($descripResult)){ $foo = $row-descrip; echo(font face=verdana size=1); echo(a href='projects_descrip.php?rowid=$foobar' . $foo/a . | ); echo(/font); } ? thanks in advance, jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Images : Store in dB or disk?
That makes sense. When Marek explained it I didn't realise that IMG tags can't use the raw data, and needs to make a seperate HTTP request for the Headers. Now, I understand. Unfortunately the desicion has been made to go with the database. Oh well, I can always code the scripts to store and grab from the filesystem, after if need be. Thank you everyone, who has responded. John W. Holmes [EMAIL PROTECTED] wrote in message 004d01c2be5c$631f4ea0$7c02a8c0@coconut">news:004d01c2be5c$631f4ea0$7c02a8c0@coconut... With regards to Marek, I don't see how there would be two queries, because there row conisists of image properties and image data. So when i select the required row(s), I will have properties and images. So it will be 1 query, of course it is a big (size-wise) query. Hopefully you've gotten the point that this isn't true. If you store your images in the database, it's going to make your main script execute one query to output something like img src=file.php?id=xxx ...properties... for each image. Each one of those img tags will be a separate request where file.php would pull the data for _one_ image, send the headers and then send the data. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about using session and logging out
I believe there something (a meta tag?) called meta-refresh or just refresh. But I believe you have to set the refresh interval. and if you set the interval to small it might eat your server's resources. OR I just thought of this, sometimes when you get to a page (usually with forms?) it says that the page is expired and must be refreshed. Maybe you can get that behaviour, so that when someone hits back, they have to refresh. Bobby Don [EMAIL PROTECTED] wrote in message 020401c2be4f$c5420fd0$c889cdcd@enterprise">news:020401c2be4f$c5420fd0$c889cdcd@enterprise... Hi, I have an application that uses sessions to allow customers to access a restricted area. That is, they are prompted for a user login and password. I then use sessions to track each customer. At the top of each page, I have placed the following PHP code: session_cache_limiter('Cache-control: private'); session_start(); Everything works fine. However, I have a logout link that when clicked, runs the following PHP code (where userid is the login name): session_cache_limiter('nocache'); if (isset($HTTP_SESSION_VARS['userid'])) { $HTTP_SESSION_VARS['userid'] = ''; session_unregister($HTTP_SESSION_VARS['userid']); } session_unset(); session_destroy(); Header('Location: ' . 'http://www.lclnav.com' . $globals-relative_path . 'customerlogin_standard.html'); I think the above is all that is needed to end the session. I use the Header() function to take the user back to the login page. Here is my question: Once I click on the logout link and am taken back to the main login page, I can click on the browser BACK button and still get my previous page 'as if I was still logged in'. Please note that clicking on REFRESH tells me that I am not really logged in. I know that browsers cache pages and there may not be anything I can do, however, I have seen sites that seem to work around this; i.e.., clicking on the back button loads a pages telling the user that they are no longer logged in. This is what I want to emulate. Is there a PHP method to always force a reload the first time a page is called? Thanks, Don --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Images : Store in dB or disk?
With regards to Marek, I don't see how there would be two queries, because there row conisists of image properties and image data. So when i select the required row(s), I will have properties and images. So it will be 1 query, of course it is a big (size-wise) query. With regards to Jason, Your approach is reasonable. I guess I will have to judge for myself! Bobby Patel [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I have the Images table setup with columns (width, height, size, type, etc...) the question is should I have the image data stored in this table or disk? I know, alot of people have said it is faster in disk, which is 1 page I/O. But I need these images for displaying product pages, and I believe that it would be faster to just pluck the properties from the dB (including the image file) . Usually I will need to pull 6 or 10 images per page, this is my rational for this situation: If all stored on db: One query - will take about 4-5 page I/O (assumiing index on filename) If just properties stored on dB and image on disk: One query to grab the rows of properties - 2-3 page I/O to grab 6 or 10 images - 6 or 10 page I/O Total - 8 - 13 Page I/O's If all images stored on disk, no dB whatso ever: to grab 6 or 10 images - 6 or 10 page I/O cpu time to run getimagesize() for each image - CPU time unknown? I assume that page I/O is that same as disk access. I AGREE that storing images strored on disk is a valid approach PROVIDED that you only need 1 image per page, but if you need to grab a bunch at a time, I do beleieve that storing the actual file on the dB is faster. I would like to hear from the list, of people that have worked with images and PHP. I just started with images, so I just want to take the right path. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Images : Store in dB or disk?
Hello, I have the Images table setup with columns (width, height, size, type, etc...) the question is should I have the image data stored in this table or disk? I know, alot of people have said it is faster in disk, which is 1 page I/O. But I need these images for displaying product pages, and I believe that it would be faster to just pluck the properties from the dB (including the image file) . Usually I will need to pull 6 or 10 images per page, this is my rational for this situation: If all stored on db: One query - will take about 4-5 page I/O (assumiing index on filename) If just properties stored on dB and image on disk: One query to grab the rows of properties - 2-3 page I/O to grab 6 or 10 images - 6 or 10 page I/O Total - 8 - 13 Page I/O's If all images stored on disk, no dB whatso ever: to grab 6 or 10 images - 6 or 10 page I/O cpu time to run getimagesize() for each image - CPU time unknown? I assume that page I/O is that same as disk access. I AGREE that storing images strored on disk is a valid approach PROVIDED that you only need 1 image per page, but if you need to grab a bunch at a time, I do beleieve that storing the actual file on the dB is faster. I would like to hear from the list, of people that have worked with images and PHP. I just started with images, so I just want to take the right path. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Images : Store in dB or disk?
It looks nice. It does take a couple of seconds, (but I guess that is to be expected with dealing with images). I guess seeing your example, it seems that I can go with the filesystem. But do you use the getimagezise function? do you set the width and height for the IMG tag dynamically, or you don't use the image function and just have the IMG tags already set in stone? [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Have a look at: http://vrscenes.com/2003/gallery.php?mls=230944 and tell me what you think - all images are stored in the filesystem Don't worry about what it looks like - I extracted this from the frameset it goes in Cheers! RW Quoting Bobby Patel [EMAIL PROTECTED]: ### Hello, ### I have the Images table setup with columns (width, height, size, type, ### etc...) the question is should I have the image data stored in this table ### or ### disk? ### ### I know, alot of people have said it is faster in disk, which is 1 page ### I/O. ### But I need these images for displaying product pages, and I believe that ### it ### would be faster to just pluck the properties from the dB (including the ### image file) . ### ### Usually I will need to pull 6 or 10 images per page, this is my rational ### for ### this situation: ### ### If all stored on db: ### One query - will take about 4-5 page I/O (assumiing index on filename) ### ### If just properties stored on dB and image on disk: ### One query to grab the rows of properties - 2-3 page I/O ### to grab 6 or 10 images - 6 or 10 page I/O ### Total - 8 - 13 Page I/O's ### ### If all images stored on disk, no dB whatso ever: ### to grab 6 or 10 images - 6 or 10 page I/O ### cpu time to run getimagesize() for each image - CPU time unknown? ### ### I assume that page I/O is that same as disk access. ### ### I AGREE that storing images strored on disk is a valid approach PROVIDED ### that you only need 1 image per page, but if you need to grab a bunch at a ### time, I do beleieve that storing the actual file on the dB is faster. ### ### I would like to hear from the list, of people that have worked with ### images ### and PHP. I just started with images, so I just want to take the right ### path. ### ### ### ### -- ### 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: Template tutorials?
Hey, I have been using HTMLTMPL http://htmltmpl.sourceforge.net/ So far it works well, and emulates the more powerfull Perl Templating system. It seems alot of code, but whips up these templates in good response time (of course, it might be becuase I work on a unstressed server). Chad Day [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm googling around for template tutorials and such after seeing a link to the Smarty template engine .. can anyone point me to any particularly good ones? I've always been going with the 'one-file' approach .. which I think it's time I changed. Thanks, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] emulate Post with redirect
I was trying to do it without cURL, since it's not on our server. I guess I'll just install it, and just use that. I checked out snoopy but when it gets down to it, it just uses cURL, so I rather just use cURL directly and cut the fat (of code that is). Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Monday 06 January 2003 14:01, Bobby Patel wrote: Hello, I want to emulate a POST request to Paypal. Originally a POST request is sent from the user (through a form) and the user is redirected to paypal's site. Now, what I want to do is to emulate a POST request (so that the surfer can't see some of the hidden fields of the form) and to deter tampering. (If they could see all the fields, they could just create their own form , and just change the amount). Possible solution: fsockopen to emulate POST, but that doesn;t redirect the user, using header will direct the user to the paypal site, but then I have to use a GET request and then once again variables are visible and modifiable. Desired solution: a PHP script (toPaypal.php, say) that is called when a surfer wants to buy something for a product for $5 , say. The Product form will direct to the toPaypal.php script that creates a POST request and sends the request and the surefer to Paypal. Any ideas? or did I just make this confusing? One solution I guess is to just double check the total amount credited to the merchant account matches the product. But then I ask this question out of curosity. Have a look at curl and snoopy. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Remember, drive defensively! And of course, the best defense is a good offense! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Combine sockets and Header()
Hello, I want to emulate a POST request to Paypal. Originally a POST request is sent from the user (through a form) and the user is redirected to paypal's site. Now, what I want to do is to emulate a POST request (so that the surfer can't see some of the hidden fields of the form) and to deter tampering. (If they could see all the fields, they could just create their own form , and just change the amount). Possible solution: fsockopen to emulate POST, but that doesn;t redirect the user, using header will direct the user to the paypal site, but then I have to use a GET request and then once again variables are visible and modifiable. Desired solution: a PHP script (toPaypal.php, say) that is called when a surfer wants to buy something for a product for $5 , say. The Product form will direct to the toPaypal.php script that creates a POST request and sends the request and the surefer to Paypal. Any ideas? or did I just make this confusing? One solution I guess is to just double check the total amount credited to the merchant account matches the product. But then I ask this question out of curosity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] emulate full post wth redirect
Hello, I want to emulate a POST request to Paypal. Originally a POST request is sent from the user (through a form) and the user is redirected to paypal's site. Now, what I want to do is to emulate a POST request (so that the surfer can't see some of the hidden fields of the form) and to deter tampering. (If they could see all the fields, they could just create their own form , and just change the amount). Possible solution: fsockopen to emulate POST, but that doesn;t redirect the user, using header will direct the user to the paypal site, but then I have to use a GET request and then once again variables are visible and modifiable. Desired solution: a PHP script (toPaypal.php, say) that is called when a surfer wants to buy something for a product for $5 , say. The Product form will direct to the toPaypal.php script that creates a POST request and sends the request and the surefer to Paypal. Any ideas? or did I just make this confusing? One solution I guess is to just double check the total amount credited to the merchant account matches the product. But then I ask this question out of curosity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] emulate Post with redirect
Hello, I want to emulate a POST request to Paypal. Originally a POST request is sent from the user (through a form) and the user is redirected to paypal's site. Now, what I want to do is to emulate a POST request (so that the surfer can't see some of the hidden fields of the form) and to deter tampering. (If they could see all the fields, they could just create their own form , and just change the amount). Possible solution: fsockopen to emulate POST, but that doesn;t redirect the user, using header will direct the user to the paypal site, but then I have to use a GET request and then once again variables are visible and modifiable. Desired solution: a PHP script (toPaypal.php, say) that is called when a surfer wants to buy something for a product for $5 , say. The Product form will direct to the toPaypal.php script that creates a POST request and sends the request and the surefer to Paypal. Any ideas? or did I just make this confusing? One solution I guess is to just double check the total amount credited to the merchant account matches the product. But then I ask this question out of curosity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password Script
If you have access to a database on your server then you can do the following: - user logs in to site (user enters unique username and password) - once in they will be displayed with the 3-6 Questions - after they answer the questions they hit submit which sends it to a PHP script - the PHP script will check a table in the database for the username and increment a counter - then if the counter is less than 10 then validate questions for right answer, .then you understand the rest Vicky [EMAIL PROTECTED] wrote in message 006401c296d0$e287a6a0$0200a8c0@omnibook">news:006401c296d0$e287a6a0$0200a8c0@omnibook... A 'guessing'/knowledge game ^_^ Basically I put a picture of a dog or cat up and they try to guess the breeds. If they get it right then they go to a page where they can download their prize! Vicky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: dynamic variable headache
try this: $mmdd = $foo.$bar.$bleh.$doh; /*note double-quotes and the concat operator (the period) */ $$mmdd = a_date_value; To test; echo $mmdd ; echo $$mmdd; /*provided that a_date_value is a string literal*/ Robert McPeak [EMAIL PROTECTED] wrote in message news:sdcbab6c.044;ccp2.jhuccp.org... My newbie brain is maxed out on this, and I'm sure one of you more experience guys can quickly straighten me out. I've got a variable: $_mmdd = a_date_value; Later, I've got four variables; $foo= _; $bar=; $bleh=mm; $doh=dd; I want to stick these variables together on the fly to get _mmdd and use that value as a variable name to return a_date_value. It would be the equivalent of, echo $foo$bar$bleh$doh; That would give me a_date_value I've read the docs on dynamic variables but still can't seem to break through mentally on this one. Can you clear this up for me? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php