Re: [PHP] php teleprogramming -- How to avoid being ripped off ?
Sorry to hear things went down that way, but it 's been discussed many times before on the list... the key ingredients seem to be: 1. get a contract in writing to begin with 2. provide estimates of the time required, and UPDATE THESE ESTIMATES as the brief changes, so that they know that every "little thing" they change will cost them time 3. get a deposit on the estimated development costs OR 4. get part-payments, broken up perhaps into weeks or months... this again gives them a feeling for how much everything is costing, and ensures you get paid along the way... as long as they keep up payments, you keep working... the risk is then only that the LAST month's work is unpaid... clearly a much smaller risk. There are some other ideas as well: 1. keep the code on your server ONLY until payment is made... they should be willing to pay based on completion of the work... when you buy a car, the give you the keys AFTER you sign the cheque, so why should programming be any different? 2. encoding... include little bombs in your encoded scripts which will "break" the code after x months unless payment is made... although encoding is an expensive option. Your only chance is to find yourself legally secure, which comes in the form of signed contracts. If this guy isn't paying, and you have a signed contract, then your only chance of getting the money back would be through lawyers. If you don't have anything signed, I don't like your chances of seeing that money again, or the code. Good luck, Justin on 23/11/02 12:54 PM, Axis Computers ([EMAIL PROTECTED]) wrote: > Hi to all fellow collegues, > > Here is the story, a while ago I've signed an NDA with a company from Los > Angeles, the agreement was for programming (PHP, Perl, Java, Javascript), > designing and other tasks, and payment was established on a fixed hourly > rate, the guy in charge, > was very impatient and I had to answer his queries almost instantaneously, > besides he just throw in scripts, and pieces of code, > that were very badly documented and required intense study, and reverse > engineer, one of the tasks was to generate a template from an html code, and > the proper scripts, well I had to get acquainted with everything in the > server, and to study and understand many scripts, and the database and so > forth, the thing is I had to work an average of thirteen hours per day, > for a very low hourly rate, but I accepted that conditions, the thing > happened when I finished the template and also developed a frontend for a > java applet , and delivered it, > and he asked me how much I was charging for the job, I calculated the hours > and told him because I had to spend too many hours studying everything, I > took of f 24 hs. from the fee, well after he received the estimate he > didn't answer anything, he didn't pay me, he refused to answer all the > emails I send him, trying to explain things out, and telling him if he > thinks there were so many hours they can be somewhat balanced with faster > future development, and I we can renegotiate, I was really open,offering > even to just charge development hours and not study hours, the answer was a > complete silence, he just revoked > my privileges to the server and that's it, not even a single word. > So, I'm asking you fellow programmers, for guidance in a situation like > this, I just have to say goodbye and forget it or is there something I can > do to get at least something for my efforts ? > > Thank you all in advance for any assistance. > > Ricardo Fitzgerald > AXIS Computers > > P.S. Needless to say I'm workless and because of my country economic > situation I really don't know when I'm going to work again ... > > __________ Omni > ICQ#: 37031810 Current ICQ status: + More ways to contact me > __ > Justin French http://Indent.com.au Web Developent & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] FAQ a good idea?
Ahhh -- now i get ya!! Many thanks! Justin French http://Indent.com.au Web Development & Graphic Design it's right now :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions and trans-sid problem/question
on 24/11/02 11:10 PM, Jean-Christian Imbeault ([EMAIL PROTECTED]) wrote: > This now hands me a dilemma ... I was building my site conservatively, > i.e. assuming the user would have cookies turned off. And so I am making > heavy use of session variables. *But* I had thought that if the user had > cookies enabled then the variables would be saved as cookie information, > hence saving my server a lot of disk reads and writes. Now you have > shown me the err of my ways ... > > I have to consider rewriting my scripts so that if cookies *are* enabled > the session information is sent has cookie data. Hum ... I hate > re-writes I'd leave it as is... this ensures that ALL users can use the site, because the session id can be passed around in either the URL or cookies... and enabling trans sid means you don't even have to worry about it... PHP will use cookies if possible, or else append it to the URLs. What sort of stuff are you storing in the session that your are worried about with too many writes? Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse URLs
Before asking, you should have done a search at google.com... I searched for 'emoticons replace php', and it returned HEAPS of results, including this one, which seems close to what you're asking... http://www.devarticles.com/art/1/161/2 Search the archives and google before posting please! Justin on 25/11/02 5:00 AM, Stephen ([EMAIL PROTECTED]) wrote: > Thanks! Just one more question. I also want to replace emoticons, such as > :-), :), or ;-), that are stored in a table. The structure is this: id, > emote, replace. How could I check to see if the text the user typed in > contains any of the emotes in the table then replace them with the correct > replacement? Also, how could I then limit how many are in the post? Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] quick sanity check on user management / sessions
Hi all, I just need a quick sanity check. I was going through some old scripts, cleaning them up, optimising them, etc etc... and then I opened my OLD user/sessions management library... For some reason (inexperience probably, or a bad article), it was set-up so that both the uid and pwd were set as session variables, and EACH PAGE on the site checked the uid & pwd against the database... this seems like a lot of overhead to me. Here's what I'd like to do: login page validates user, and registers $_SESSION['uid'] (and any others I need, like admin = true) then, all other pages on the site will just need session_start(); rather than the current call to the database to validate the user on every page. I know the above should be fine, but I'm just checking if there's any reason why I choose to call the DB on every page... it was about 2 years ago, so my guess is "inexperience" :) TIA Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick sanity check on user management / sessions
Thanks all :) > That's what all my apps do - they just check if the user is already logged in. > > When there's no "user record" in session space, the login box gets > displayed, and as a response of user login the script checks the database. > It then reads all necessary data, including last login, user rights, etc > etc, from the DB, sometimes updates a user cookie, depending on the app. DB > is checked only once. > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Setting values of php.ini file at runtime
a .htaccess file in the directory you want RG OFF (ie /wiki/) should do the trick: php_flag register_globals on This seems to work for me... on 25/11/02 10:37 PM, DL Neil ([EMAIL PROTECTED]) wrote: > Excuse me breaking in...somewhat similar problem: > > Have set up a client recently, preaching security persuaded them into > updating so that could run Register_Globals=Off. Now they want to install a > 'wiki' which requires (to my horror) Register_Globals=On. > > Short of two Apache/PHP servers, what is a logical way to structure things > so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more > securely? > > Please advise, > =dn > > >> You cannot do it inside a script as the register_globals magic happens >> before the script starts executing, so toggling the setting at runtime is >> too late. >> >> -Rasmus >> >> On Mon, 25 Nov 2002, Tariq Murtaza wrote: >> >>> Dear All, >>> >>> I am wondering if anyone shed some light. >>> i am thinking of setting value for php.ini variables like >>> register_globals = ON/OFF at runtime (within our php script). >>> Is there any function built-in in php?, or can we do it ourselves. >>> >>> Looking forward, >>> Thanks >>> >>> Tariq >>> >>> >>> >>> -- >>> 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 >> >> > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions/Browser back button
on 26/11/02 12:03 AM, Craig ([EMAIL PROTECTED]) wrote: > I remember seeing threads debating this before, but is there anyway to > disable/prevent a user from heading back in the browser and getting the > "WARNING: Page has Expired" notice? This is more like a diversion around the problem... It will either be relevant to your problem, or not :) In particular, I use this to prevent people from refreshing their page (and hence adding something to the DB twice for example). Lets say you have form.php, which submits to process.php... the aim is to have process.php as a server-only script (ie, nothing is sent to the browser), with a header() redirect to a thankyou.php page once I've added stuff to the DB, or whatever The point is, they'll never see a page expired message in this case, because the script receiving the POST information never gets to the browser. This may or may not help, depending on your problem :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux Question
on 26/11/02 2:41 AM, Brian V Bonini ([EMAIL PROTECTED]) wrote: > Also, try to use relative sizes, if you use fixed sized like 10pt. you > will have size discrepancies on different platforms. If you use a > relative scheme like 12px it will render more consistently 12px is NOT a relative size, and will mean that users with vision impairment, etc etc will have trouble resizing the text to suit their preferences... The relative sizes are things like "small". http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size > BTW: I bet you'd find the same issues if you looked at your pages on a > MAC as well... You'd have the same problems on any computer where the user has fiddled with the default font settings. If you want total useability, you could just use , and let your user's browser settings take care of it, otherwise, the safest bets are things like font-size: larger font-size: 150% font-size: 1.5em rather than 12px or 12pt But we're getting OT rapidly. Try the CSS newsgroups -- I like this one: comp.infosystems.www.authoring.stylesheets Cheers, Justin Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
on 26/11/02 7:42 AM, Kyle Gibson ([EMAIL PROTECTED]) wrote: >> Thanks, but that doesn't allow nested tags (a [b] tag inside of an [i] >> tag, for example). > > Nested tags? Do you mean [ib] ? Or [i[b]]? I would have thought nested tags would have meant: [i]something something [b]bolder[/b] something[/i], since and > aren't valid HTML, can't see why they'd have been adopted by BBcode. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux Question
on 26/11/02 11:04 AM, Brian V Bonini ([EMAIL PROTECTED]) wrote: > On Mon, 2002-11-25 at 18:26, Justin French wrote: >> on 26/11/02 2:41 AM, Brian V Bonini ([EMAIL PROTECTED]) wrote: >> >>> Also, try to use relative sizes, if you use fixed sized like 10pt. you >>> will have size discrepancies on different platforms. If you use a >>> relative scheme like 12px it will render more consistently >> >> 12px is NOT a relative size, and will mean that users with vision >> impairment, etc etc will have trouble resizing the text to suit their >> preferences... The relative sizes are things like "small". >> >> http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size > > px is obviously a relative unit (relative to the users screen) unless > your going to try to say everyone views stuff at the same dpi. It's late > so perhaps I'm missing it but I do not see anywhere in the spec that you > cited where it says px is absolute. However I will quote loosely from > the spec: "values with relative units (em, ex, px) must be made absolute > by multiplying with the appropriate font or pixel size," > > So, go ahead and try what I suggested THEN tell me it's not right. Using > px WILL make it more consistent across win, linux, mac, etc.. and will > not inhibit the browsers ability to enlarge the text size at all... I don't think I was being clear enough at all :) 12px is 12pixels... there is no way for it to *reliably* be reset to 14px, or 10px by the user on all browser. In the current versions of IE for Win, using the text size larger smaller or % options in the menus has no effect whatsoever if values like 12px or 12pt are given. If you specify 12px, and I decide I need it bigger, I don't have many options, other than totally overwriting your style sheet with my own (no thanks!, and beyond most web users). The good news is that because 12pt and 12px are so prolific on the web (and so evil in terms of accessability), browser manufacturers are now beginning to make px and pt variable sizes as well. That is to say, in IE5 Mac, NN7 (and maybe 6), and some other browsers DO LET YOU CHANGE THE FONT SIZE FRONT THE MENUS, selecting smaller, larger, 120%, or whatever. The bad news is that the latest versions of IE6 (at least 3 months back when I did some major CSS testing) did not let users do this. It's well documented, and people like Zeldman and A List Apart have spent months campaigning for IE Win to match IE Mac and NN on this. Here's a snippet from http://www.zeldman.com/daily/0702b.html > To satisfy the demands of accessibility within the context of normative > practices in commercial web design, IE/Win needs to do what IE/Mac did in > March, 2000: implement Text Zoom, so visitors can resize any web text. Will > Microsoft ever make this change to IE/Win? We can only hope. And this one from http://www.zeldman.com/daily/0502c.html > Pixels solve these problems by delivering a guaranteed base size. But what if > that base size is too small for some readers? > Opera has always offered its users the ability to easily scale any web > page via Page Zoom. In January 2000, WaSPs Todd Fahrner and yours truly > persuaded the appropriate engineers to add a similar feature (³Text Zoom²) to > IE5/Mac and Mozilla/Netscape 6. Thus nearly all current browsers allow users > to resize text set in pixels. If text is too small, hit a button, a command > key combination, or a drop-down menu, and voila! Instant legibility. > Alas, MSIE for Windows does not allow web users to resize text set in > pixels. We will keep pestering Microsoft to add that feature to its Windows > browser. Until they do, alternate style sheet widgets enable designers to work > around this thorny accessibility problem. So, I stand partially corrected, the user CAN override ALL font size by digging into the accessibility menus, but I seriously doubt many do. If the latest versions of IE *DO* allow text zooming via the menus, again I stand corrected, but there are millions of web users out there on IE5 and IE6 without text zoom. IMO, specifying a px or pt font size is taking away the users right to choose what font size they prefer to read with, IF they are using IE4/5/6. > No, the problem he stated was the inconsistency of sizes on different > platforms. A totally addressable issues regardless of what the user has > done with the default font settings. A totally addressable issue *IF* you're prepared to laugh at accessibility guidelines. FWIW, I *have* and *do* specify px and pt font sizes on some of my sites, mostly to meet client desires, but I do so only after pointing out the issues and letting them make an informed descision. Coincidently, that's all I was trying to do here... point out that specifying fixed
Re: [PHP] Do i need triggers for this?
on 26/11/02 3:46 PM, Faisal Abdullah ([EMAIL PROTECTED]) wrote: > Lets say I have a table called 'employees', and another table called > 'training_history'. > > Lets say I need to delete an employee, I would also have to delete his > record in the 'training_history' table. The employee would (I assume) have a unique id/key... presumably this key relates his/her information in the training table. employee: id/first/last/email training employeeid/something/something So, when you delete the employee with id '15', also delete any training records with the employeeID of '15'. So, yes, I'd do this at an application level... although I have no idea what triggers are :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] store images in mysql tables
Please do a quick google search first: http://www.google.com/search?hl=en&ie=ISO-8859-1&q=storing+images+in+mysql&b tnG=Google+Search Or at least TRY to find the answer by yourself. on 26/11/02 11:42 PM, Vivek Kedia ([EMAIL PROTECTED]) wrote: > can i store images in mysql table using php , is it > possible if yes then pl show me where i can read more > about it Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux Question
Yes, we are way off topic. You offered a solution, and it rang warning bells for me from an accessibility P.O.V... yes, I miss-quoted the spec, but yes, i'm right about IE, and almost every developer using px should be very worried for quite some time, until it gets addressed. Cheers, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do i provide Download facility ??
Hi, > I am a newbie in this PHP world. I was just looking around for > information on Download of files using PHP. > I need to provide link/button, by clicking which a user can download a file > (Say a CSV file..). Does PHP provide any class or methods to achieve the > same...? Looking forward for your suggestions ... Why do you need it to be anything to do with PHP? You need to tell us more information, because plain HTML like this works fine: Click here to download the CSV file ...but I assume you want to restrict file downloads to only logged in users, or you wish to count the number of downloads, or something else?? Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Invalid Charactors in a string.
Hi, if(!preg_match("/^[a-z0-9_]*$/", $username)) { // the string contained a char other than a-z, 0-9 and _ (underscore) } Season to taste :) Justin on 27/11/02 6:18 PM, Philip J. Newman ([EMAIL PROTECTED]) wrote: > Where should i start, tips wanted. > > I would like to check a username string for valid charactors before the name > is processed. > > Someone point me in the right direction please > > --- > Philip J. Newman. > Head Developer. > PhilipNZ.com New Zealand Ltd. > http://www.philipnz.com/ > [EMAIL PROTECTED] > > Mob: +64 (25) 6144012. > Tele: +64 (9) 5769491. > > VitalKiwi Site: > Philip J. Newman > Internet Developer > http://www.newman.net.nz/ > [EMAIL PROTECTED] > > * > Friends are like Stars, > You can't always see them, > But you know they are there. > > * > > ICQ#: 20482482 > MSN ID: [EMAIL PROTECTED] > Yahoo: [EMAIL PROTECTED] > AIM: newmanpjkiwi > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting files in directory
on 28/11/02 12:01 AM, Nick Wilson ([EMAIL PROTECTED]) wrote: > I have several directories filled with files written like this: > > * 02-09-19-filename.etc > * 02-10-02-anotherfile.whatever > > How does php order these files if read from the directory and printed to > the screen? -- I need them in date order, do I need to sort them > somehow? I think PHP reads them in date created order, or something else... anyhoo, what you need to do is read the filenames into an array, then sort the array, either top-to-bottom or bottom-to-top: \n"; } ?> There's an optional second parameter for asort() and rsort(), so check it out in the manual... it *may* be needed to get what you want. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ignoring client supplied session data
on 28/11/02 9:22 AM, Evan Nemerson ([EMAIL PROTECTED]) wrote: > I'm not worried about them using the query string for malicious purposes- I > have register_globals off... I'm worried about someone messing with their > cookie and sedding authorized to true- that _will_ change my $_SESSION > variable, unless I can find some way to ignore cookies, which brings us back > to my original question- how do i ignore all client input, _especially_ > cookies??? Turn register globals off (as you have). Then NEVER pull any data out of the $_COOKIES array, and you're now "ignoring" cookies :) Perhaps a further step is to call something like unset($_COOKIES) at the top of every script... but I'm not sure how unset() works with the super global arrays. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password Script
Is this a password reminder script? Or a 'guessing'/knowledge game to get access to a certain page? Justin on 28/11/02 4:52 AM, Vicky ([EMAIL PROTECTED]) wrote: > I'm looking to code a script that does the following. Please bear with me as > I'm a total novice at this ^^! > > It's sort of like a multiple password thing. Users need to type in between 3 > and 6 (I will be changing the use of this script and sometimes there will > only be 3 answers sometimes as many as 6) things. If they get it right > they'll be redirected to a page, if they get it wrong either a javascript > prompt will popup saying "Incorrect" or they'll be redirected to a different > page. > > I'm not sure if I'll put a limit on how many times they can guess, so if you > could tell me how I would put a limit (say 10 guesses a day) I'd be > greatful. > > Thank you! Please try and make your replies detailed so I can understand > them ^_~ Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing screen without the print dialog
Hi, 1. did you search the archives, because this gets asked often 2. did you do a google search? >From memory, it's POSSIBLE to print directly to the printer IF IT IS CONNECTED TO THE SERVER, but it's more difficult (if not impossible) to print to a client side (user's) printer... and impossible without the print dialogue. PHP is server-side, not client-side. Justin on 28/11/02 9:29 AM, Duky Yuen ([EMAIL PROTECTED]) wrote: > I am having this problem, I want to print something directly to my printer > without having that print dialog. What to do know? Is this possible? > > Duky > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File handling
> Quick one, how do i read a file for a key word, say "TEXt", and the delete > the rest of the remaining file? Do you mean: a) how do i make sure a word (eg "foo") is in a file, and if it is, delete all contents of the file except the word "foo" OR b) how do i search a file for the word "foo", and delete everything in the file AFTER the word "foo" ?? Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File handling
on 29/11/02 7:06 PM, Jeff RingRose ([EMAIL PROTECTED]) wrote: > Justin, > Option b. delete all AFTER "foo", I.E. truncate the file directly after > "foo". Leaving "foo" and all the data before "foo" untouched. And what happens if there are more than one occurrence of "foo"? I assume you mean the first occurrence. And what happens if "foo" is found within another word, like "aafooaa"... this example assumes this doesn't matter... it's looking for 'foo', not ' foo '. One of way is to read the file into a variable, split the var on "foo", and rewrite the file out. 1. Totally untested code, but most of it was lifted out of the manual in some way or another. 2. Permissions of the file to be read/written will need to be correct 3. I've included no error reporting or correct checking... you'll need to add this yourself Season to taste... Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array with session
Are you on PHP >= 4.1 ? Try this: This should test if a) $_POST['Image'] is being populated b) $_SESSION['Image'] is being populated Then, to do what you were trying to achieve: $val) { echo $val; } // OR // $i = 0; while($i < count($_SESSION['Image'])) { echo $Image[$i]; $i++; } ?> Justin on 29/11/02 11:58 PM, Laurence ([EMAIL PROTECTED]) wrote: > > hello everyone, > > I'm trying to get some images value from a checkbox putting them in a session > to preserve the data. The array works perfectly without the session_start() > and session_register. > > can anyone help? > > html script > > > > > > > > > > > > > > > > > > > > > > > > > > php script: submit_information.php > > session_start(); > session_register("Image"); > > $count = count($Image); > for ($i=0; $i<$count; $i++) > { > echo $Image[$i]; > } > > //I also tried that > /*foreach ($Image as $i=> $Img) > { > $Img == $Image[$i]; > echo $Img; > }*/ > > ?> > > > > > - > With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your > needs > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page break
This is totally not PHP related. There is a page-break: before; (or similar) in CSS, so I suggest you go look around some CSS sites... like the W3.org. Justin on 01/12/02 5:26 AM, Lars Espelid ([EMAIL PROTECTED]) wrote: > Hello, > > Is there some way to insert page breaks in a php document so that it becomes > more printer friendly. > > thanks > lars > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date problem
on 02/12/02 9:59 AM, Rosen ([EMAIL PROTECTED]) wrote: > I want to get date from database, to increment ot decrement it with some > days, to show the date and after thath > if user confirm it to save it to database. And in what format is the date currently stored? -MM-DD? MySQL timestamp? Unix Timestamp? Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cache caches anyway, regardless
on 02/12/02 10:49 PM, Elmota Abdul Ayyash ([EMAIL PROTECTED]) wrote: > i had this problem when my pages were cached when I wanted them to be > refreshed, so I went deep in it and included all the recomended headers > by the manual, and it worked fine.. I also tried on a clean version, by > emptying up the browser cache and temp files on my client machine... > > until one page came from nowhere, an old old version! now my question > is, where did that page come from? are these pages cached anywhere on > the SERVER? I have an account on an APACHE server, and I dont know > where to look for temporary files, if any get cached... It could be any proxy server between the client and the server, plus any proxies ON the server... this would include the user's local machine, their local network, their ISP, and any ISP/server in between the client and the server (do a traceroute), althoguh in this case it sounds like you're talking about a LAN. I don't *think* Apache caches anything by itself. Of course changing the filename will ensure you aren't using a cached copy :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Decrypting mcrypted strings on Windows desktop
I've done something similar (encrypt a message, send it to a client, let them decrypt locally), and so far, the easiest solution was to simply install PHP and Apache on their PC. You could also check out PGP-GTK, which is a cross-platform, client-side extension to PHP for making GUI's... haven't worked with it yet, but I plan to soon. on 03/12/02 9:32 AM, Geoff Caplan ([EMAIL PROTECTED]) wrote: > I need to encrypt short strings in PHP, using mcrypt by preference, > email it to the customer, and have him decrypt the string on the > Windoze desktop. > > But all the Windows encryption utilities I can find use proprietary > file formats - none can decrypt the string output by mcrypt. Can > anyone help me out here - I am running out of time. Either an open > source or a commercial solution would be fine. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] easiest way to get 1st and last dates of the month?
Hi, I'm looking to get a unix timestamp for the first and last day of a month, given a timestamp. But so far everything i've come up with has been wy too many lines of trickery -- especially for the last day of the month (which isn't always 31) Any ideas or snippets of code floating around? Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] hiding php
Why not just make up an extension, like your initials (.lsb) or your business name (.dim or .dni), and set-up apache to pipe all those files through PHP...?? That way they'll have no clue at all (if used in conjunction with the "hide PHP" stuff, etc etc). Justin on 03/12/02 4:13 PM, Larry Brown ([EMAIL PROTECTED]) wrote: > This should bump up my popularity here...can you run asp on apache? The > reason I ask is that I understand you can use a php option to hide the fact > that you are running php. This sounds like a good idea to keep people > guessing, but I also want to use .asp extensions and have them parsed for > the php tags. I thought this would be nice if someone wanted to screw with > a site they wouldn't even be trying tools that would apply. However, if you > can't run asp on apache nobody would be fooled. Any thoughts? > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] easiest way to get 1st and last dates of the month?
Thanks for pointing out the obvious !!! -- it's been a long day! Justin on 03/12/02 4:52 PM, rija ([EMAIL PROTECTED]) wrote: > How about date("t") ? > It's supposed return the last day of a month (28 - 31). > > - Original Message - > From: "Justin French" <[EMAIL PROTECTED]> > To: "php" <[EMAIL PROTECTED]> > Sent: Tuesday, December 03, 2002 4:31 PM > Subject: [PHP] easiest way to get 1st and last dates of the month? > > >> Hi, >> >> I'm looking to get a unix timestamp for the first and last day of a month, >> given a timestamp. >> >> But so far everything i've come up with has been wy too many lines of >> trickery -- especially for the last day of the month (which isn't always > 31) >> >> Any ideas or snippets of code floating around? >> >> >> Justin French >> >> http://Indent.com.au >> Web Development & >> Graphic Design >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need advice on template engine
http://smarty.php.net seems polular J on 04/12/02 12:40 AM, Alexander A. Savenkov ([EMAIL PROTECTED]) wrote: > Hi PHP. > > Suggest me which template engine is more popular? > I try select engine for me but I alredy become involved in that > number different version > > > Alexander A. Savenkov > System Administrator > mailto:[EMAIL PROTECTED] > JSC "Terminal GMB" > http://www.terminalgmb.ru > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prevent storing data when reload
> When I reload the page the data gets stored once more. I'm sure this is a > well known problem. Are there any smart tricks to prevent this from > happening? Yes, and they get discussed on this list almost daily... a quick search would have helped. 1. the "script" that does all the validating and inserting SHOULD NOT send any output to the browser... after insert, put in a header("Location: script.php?action=thanks") style redirect. This means that if the user hits refresh, they will only be refreshing the "thanks" page, NOT the insert page, because it never gets to the browser. Yes, this can all be done in one script, it may need some re-organisation though. 2. when generating the HTML form, include a hidden field with a unique string in it. Insert this string with the rest of the form data, and make sure that this string is only inserted once... so, if they hit "refresh", you'll know that the form has already been submitted, and the data already inserted, so don't insert it again :) Cheers Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cold Fusion conversion issues: app vars and cachedqueries
on 04/12/02 6:23 AM, Steve W ([EMAIL PROTECTED]) wrote: > These issues above as well as things like not being able to centrally > configure a database connection by using an alias for the name are > areas PHP lacks in comparision to Cold Fusion. Our CF application gets > installed at client sites. Using PHP, it would require a code change > in a db connect file to change the DB connection information where it > really should be configurable in a central PHP conf file. If you're installing the App on various servers, clearly there needs to be SOME form of configuration upon installation... the document root could be in a different place, the database username and password stuff could be different, permissions could be different, etc etc. Generally this is achieved with an include()'d file, which keep all your config vars in one spot. Since a heap of my sites run on shared servers, I don't like the idea of central shared configs -- well, at least not above the config settings in php.ini and at .htaccess level. Speaking of which, PHP can be configured to automatically include a certain file at the top and bottom of every script that gets run. I think the php.ini directive is auto-prepend, or something like that... Perhaps this also address' your application variables question too? > Even with this being said, I'd like to use PHP for our application if > the 2 issues above can be resolved. I'm not up-to-speed with CF, so I can't address your exact issues, but I know that there are thousands of large enterprise sites running PHP (yahoo for example), so there MUST be a way to achieve everything you need. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Sessions
As long as session_start() is called BEFORE the included files, I can't see why not. Justin on 05/12/02 12:11 AM, Andy Kirk ([EMAIL PROTECTED]) wrote: > Can anyone tell me if session variables should be available to scripts that > are included into the main script? > > It appears to me that they are not unless I am really missing the point. > > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Sessions
Good point -- are the included files functions, or other stuff?? function myfunc() { return $_SESSION['something']; } will not work, but: function myfunc() { global $_SESSION; return $_SESSION['something']; } will... J on 05/12/02 1:14 AM, Ryan Gibson ([EMAIL PROTECTED]) wrote: > May be a silly question but are u using a global statement in the include > files, just a thought > > > on 4/12/02 1:11 pm, Andy Kirk at [EMAIL PROTECTED] wrote: > >> Can anyone tell me if session variables should be available to scripts that >> are included into the main script? >> >> It appears to me that they are not unless I am really missing the point. >> >> >> > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating dynamic names for images
well, a) use a table in the DB with the primary key (id) as an auto-increment column. 1, 2, 3 etc. Use this ID as the name of the file 1.jpg, 2.gif, and perhaps store the filetype / extension as well, so that you know what filename to look for in the folder. b) something as simple as file_exists() may be enough... if a file with that name already exists, you could append something to it, like a random number, and try again. Ypu certainly don't have to ask the user to rename the file... YOU should be in charge of naming it. Justin on 05/12/02 3:48 AM, Davíð Örn Jóhannsson ([EMAIL PROTECTED]) wrote: > I have a situation where I allow users to upload images, and I store the > names of the images in a database and the images I store in a some > folder on the server, but what I would like to do is to dynamically > create names for the images and dont ever have to worry about if this > name exists and with out having to got to the trouble of asking the user > to change tha name of the file. > > So dose some one have a nice litle solution for this problem. > > Thanks, David > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Sessions
Oops I screwed up :) Justin on 05/12/02 1:28 AM, Marco Tabini ([EMAIL PROTECTED]) wrote: > Are you sure? I thought $_SESSION was a superglobal. > > > Marco > > On Wed, 2002-12-04 at 09:15, Justin French wrote: >> Good point -- are the included files functions, or other stuff?? >> >> function myfunc() >> { >> return $_SESSION['something']; >> } >> >> will not work, but: >> >> >> function myfunc() >> { >> global $_SESSION; >> return $_SESSION['something']; >> } >> >> will... >> >> J >> >> >> >> on 05/12/02 1:14 AM, Ryan Gibson ([EMAIL PROTECTED]) wrote: >> >>> May be a silly question but are u using a global statement in the include >>> files, just a thought >>> >>> >>> on 4/12/02 1:11 pm, Andy Kirk at [EMAIL PROTECTED] wrote: >>> >>>> Can anyone tell me if session variables should be available to scripts that >>>> are included into the main script? >>>> >>>> It appears to me that they are not unless I am really missing the point. >>>> >>>> >>>> >>> >> >> Justin French >> >> http://Indent.com.au >> Web Development & >> Graphic Design >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] request for help/advice (xml/php content management)
Haven't you already posted this? J on 05/12/02 10:20 AM, Robert Samuel White ([EMAIL PROTECTED]) wrote: > > Hello, I am the creator of eNetwizard Content Management Server, an open > source content management system using the LAMP suite. I am getting > ready for its first major release and have come across some problems > that I need to address first... I'm not really sure where to start this > is such a *huge* project... > > Some preliminary information about the project can be found here: > > http://projects.enetwizard.net/cmserver.ehtml > http://sourceforge.net/docman/display_doc.php?docid=12504&group_id=59790 > > Content is stored as XML in files within a matrix folder. eNetwizard > defines several scopes allowing templates and content to be generated on > the fly in a scopeable manner. For example, any website at > enetwizard.net has the same look and feel because of the domain scope > matrix file; I have made this file publicly accessible if you go here: > > http://www.enetwizard.net/matrix1.php > > Another scope is the page scope which is where the main content for a > page is located, so for the default page at enetwizard.net, it looks > like this file: > > http://www.enetwizard.net/matrix2.php > > This allows the server to automatically assemble and render content in a > variety of formats as you can see here: > > http://www.enetwizard.net/default.exml (as XML) > http://www.enetwizard.net/default.ehtml (as HTML) > > This is the main idea behind "general content" stored by the server -- > there are other ways of doing things that are even more advanced but > they will not be discussed here. In order for this to work, I created > an xmldoc class that can assemble all of the files together and create > the file accordingly. It is then outputted via the server class. > Examples of these files are here: > > http://www.enetwizard.net/xmldoc.php > http://www.enetwizard.net/server.php > > > Worth noting, the matrix files can contain PHP code, which is evaluated > in the xmldoc class to create an actual XML document. These two classes > are in their elementary forms. And they already have more issues than > can be tolerated for such an advanced content management system. First > of all, I cannot use the & character anywhere because of the fact it is > an XML file. This creates a serious problem and must be addressed. > Secondly, any errors that exist in a matrix file will effectively break > the page. This too is a major issue that muse be addressed, especially > since it conflicts with the website wizard (which is responsible for > managing existing and new content). > > I believe there must be a smarter way to do this and I would like any > feedback one might have in this arena. I believe using regex's might be > a better solution, especially since some unique tags, such as a > tag must replace be replaced by the xmldoc class with the actual content > of the wizard it is referencing, same scenario for the tag > (which are customizable web applications), etc. At present this cannot > work the way I have it set up. > > I cannot make a public release until this is fixed stably and fully > productive. I am looking for someone who can help me with this XML > stuff, and other competent programmers who would like to volunteer for > this project. And I'm always interested in those who can translate both > the localization files (eNetwizard supports any language) and the main > network (enetwizard.net) into other languages. Please contact me if you > can help. Thanks! > > If you have any questions, please feel free to ask them. > > Robert Samuel White > eNetwizard Technical Services > 284 Walnut > Highland, Michigan 48357 > +1 (248) 889-6363 > www.rswfire.com > www.enetwizard.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating numbers & date
Hi, Should do the trick -- although I haven't stripped out the leading 0 in either the day or month, hence it will echo 12/04/2002, not 12/4/2002. Season to taste, Justin on 05/12/02 10:58 AM, Jeff Bluemel ([EMAIL PROTECTED]) wrote: > I'm displaying a date that I get from a informix database query - the date > format is as follows; > > 2002-12-04 23:21:49 > > I want it to display as 12/4/2002 11:21:49 PM > > Jeff > > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> On Wednesday 04 December 2002 08:29, Jeff Bluemel wrote: >> >>> ... but the date format doesn't seem to >>> allow me to pass it a date. >> >> Your code? >> >> -- >> Jason Wong -> Gremlins Associates -> www.gremlins.biz >> Open Source Software Systems Integrators >> * Web Design & Hosting * Internet & Intranet Applications Development * >> >> /* >> Information Processing: >> What you call data processing when people are so disgusted with >> it they won't let it be discussed in their presence. >> */ >> > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] querystring and PHP 4
1. use $_GET['id'] rather than $id OR 2. turn off register globals in php.ini, or at a per-directory level with a .htaccess file 3. you should have searched the archives first 4. this question gets asked almost daily Justin on 05/12/02 11:01 AM, Dan Wade ([EMAIL PROTECTED]) wrote: > Hello, > > i'm grabbing querystring data like: > www.myserver.com/foo.php?id=bar > > echo $id; > ?> > > It works like a champ on dev server using php 3 but the sys admin > use PHP 4 on the production box and the querystring is no longer being > passed. > I can't imagine this changed from version to version. > > Is he missing something in his install? > > thanks, > > -Dan > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: querystring and PHP 4
on 05/12/02 11:10 AM, Dave ([EMAIL PROTECTED]) wrote: > php.ini file, find a line called... > > register_globals = On > > > ... and make > > register_globals = Off > > that's it. It's worth pointing out that you'll be forced to write smarter, more secure scripts with register_globals = Off, so it's worth considering leaving it as-is, and updating your code (and production server). Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating numbers & date
on 05/12/02 11:15 AM, Justin French ([EMAIL PROTECTED]) wrote: > Hi, > > $date = '2002-12-04 23:21:49'; > $newdate = date('m/d/Y', strtotime($date)); > echo $newdate; > ?> Whooops, forgot the time bit! Should be echo's 12/4/2002 11:21:49 pm also fixed the leading zero's problem :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating numbers & date
on 05/12/02 11:37 AM, Rick Widmer ([EMAIL PROTECTED]) wrote: > $Hour = substr( $Date, 11, 2 ); > if( $Hour ) > 12 { > $Hour = $Hour - 12; > $AMPM = 'PM'; > } > > else { > $AMPM = 'AM'; > } > > echo substr( $Date, 5, 2 ), '/', substr( $Date, 8, 2 ), '/', > substr( $Date, 0, 4 ), ' ', $Hour, substr( $Date, 13, 6 ), $AMPM; Isn't this a little simpler? There's always more than one way to do something I guess :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating numbers & date
on 05/12/02 12:47 PM, Rick Widmer ([EMAIL PROTECTED]) wrote: > Yes, it is simpler to code, but it also takes almost twice as long to run. > > 1000 iterations with strtotime: 0.2296 seconds > 1000 iterations with substr:0.1308 seconds > > Doesn't matter much if you only do it once, but it can add up in a loop. very good point :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL ?
1. there is a MySQL mailing list, details can be found on mysql.com 2. i just did a really simple search on php net for "mysql table", and got the following amongst a few results: mysql_field_table() mysql_list_tables() mysql_tablename() it would be good if you could search the php (and mysql) sites before posting. Justin on 06/12/02 3:08 AM, hacook ([EMAIL PROTECTED]) wrote: > I am really sorry but i can't find any good mySQL good mailing list... > > How can i make a little php function to check if a table exists ? > > Thanks a lot, > Hacook > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String to an Array
I *think* either: OR Works -- you'll have to experiment, but I believe the second way is correct, and will echo the first (0th) character in the string. If you want to get more than 1 character from a string (example, characters 2-5), then use substr() -- check out the manual. So far, I don't think you've shown a need for the string to be converted to to an array... Justin on 06/12/02 5:50 AM, Rodrigo de Oliveira Costa ([EMAIL PROTECTED]) wrote: > Hi guys, I got a string that I need to be transformed into na array of > characters, something like: > > > $str ="im the one trying to do this"; > > //this is the string > > I'd like to get an array that I can access something like $array[0] and > get the value " i ". And this foward. Anyone have any clues on this? > > Thanks, > Rodrigo > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about displaying directories and files
Is your question about dynamically listing the contents of all directories and/or files below the /members/ dir, or is your question about unzipping zipped files? I *think* it's the former, in which case, you should play around with some of the code examples on zend.com (http://www.zend.com/codex.php?CID=283). Cheers, Justin on 07/12/02 4:58 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > Hi. I have studied the manual, and have scripts that indivudually display a > directory (or list of them) and a script that displays scripts in a folder > However, I am curious as to how to take all folders in /members directory (It > will grow over time, now I have 3) and no matter how many folders are there > (each with a zip and gzip file)I want it to display all folders and files > inside it on one page Such as, a dynamic way to do this:Directory Azip | gzip > Directory Bzip | gzip ... So if there are 10 directories, you see 10 listings > like that. If 4, 4 listings and so on. I go to the manual, but can't figure > out how to do this *dynamically* what would I physically have to do to make > sure a list of directories in my 'list director' script includes the spitout > of files and then link to them? > > ___ > Join Excite! - http://www.excite.com > The most personalized portal on the Web! > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just Curious
I use the e-mailing list, not the newsgroup... but I think there is an *experimental* web based interface to the newsgroup at http://news.php.net, and most mail readers (outlook, outlook express and netscape I know for sure) can all read news. on 08/12/02 3:31 PM, conbud ([EMAIL PROTECTED]) wrote: > I was just curious, but what program or website do you all use to view and > reply to the newsgroups with ? > > Lee > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about Trim
To convert \n's to \n's on any string, use nl2br(). To trim excess white space (\n, \r, [space] \t, etc) from both the beginning and end of a string, use trim(). Eg: This should echo: --- this is a string with an enter in the middle --- What do you actually want to do, and what's the problem? Justin on 08/12/02 5:28 PM, Dade Register ([EMAIL PROTECTED]) wrote: > Hey... I have a question about trim. I don't know if > trim() is the right funtion to use, but here is my > problem. > > I am recieving a textarea input from a form and > writing it to a data file. I need to change any line > breaks or (enter) if you will into a or something > else. When it's in my text file, it screws it up. > Please, someone give me an idea of how to oversome > this. I can't seem to make trim() work at all. It does > remove a \n if you type that in, but won't actually > remove an (enter). Thanx for your help in advance. > > -Dade > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dumb session cookie question?
if you are allowing cookies on your browser, and the sessions are working (as they appear to be), then there WILL be a cookie somewhere on your browsing computer. However, I think you're a little confused about what you'll find... you'll just find a cookie named PHPSESSID, with a value of XX. A common misconception about sessions is that the session vars get stored on the user's computer... WRONG. ONLY the session id is stored on the user's computer (either in a cookie, or via the URL). Session vars and values are ASSOCIATED with that session id ON THE SERVER. WHERE exactly the cookie is stored on your CLIENT (viewing) hard drive will depend on the OS, Browser, and a heap of settings. WHERE exactly the session vars and values are stored on your SERVER will depend on a few PHP settings. What are you trying to achieve? To test if a cookie exists on the user's computer, you use the $_COOKIE array. To assign values to a session, you use the $_SESSION array (which associates a php session id (stored/carried by the user) with a bunch of session vars/values stored on the server). Justin on 08/12/02 10:17 PM, Douglas Douglas ([EMAIL PROTECTED]) wrote: > Hi all. > I'm sorry about the dumb question, but I've just > expend two hours trying to find the damn cookie and I > couldn't :( > I've read that when you use sessions and configure the > php.ini with session.use_cookies = 1, your sessions > will always send cookies to the client (if the client > accept the cookies)... > Is that right? > I ask because I'm reading my first tutorial about > sessions and it worked fine... but I can't find where > IE6 (Windows XP, Apache 1.3.27) stores those cookies I > used... I want to see the cookie's contents... > So I was wondering if PHP really sends the cookies, > but I also printed the $_SESSION and $_COOKIE arrays > and it displayed the correct information... in > $_COOKIE displayed PHPSESSID == , so I > think there is some cookie somewhere, my question is > where is it? > I'm so confused right now... > Thanks for any help. Sorry again. > > __________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date() on two diff. servers
Hi, I'm running the following code on two servers: On my local development box (Free BSD, PHP 4.1.1, on AUSTRALIAN time), the above echo's "Wed, 11 Dec 2002" (I consider this to be the "correct date". However on the live server (Red Hat, PHP 4.2.3, hosted in CANADA) the above code echo's "Tue, 10 Dec 2002". Now, what could be causing this problem? IMHO, no matter where you are in the world (or more to the point, what timezone you are in), 1039525200 seconds after a certain date (in this case the unix epoch) should be another certain date, yes? What could be causing this difference? What should I talk to my host about, or look for? Thanks, Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() on two diff. servers
on 09/12/02 1:30 PM, @ Edwin ([EMAIL PROTECTED]) wrote: >> Daylight Savings Time? > > John, I think "Daylight Saving Time" creates a difference of 1 hour and not > 1 day :) True... but I checked it anyway -- by adding just one and two hours to the stamp... which made no difference... but when I added 86400 to the stamp, it all worked. > Justin, it depends how you got your "timestamp" in the first place, I > think... > > I could be wrong again here but aren't these different? > > mktime() > gmmktime() Actually, they were created with strtotime(). Note, I don't believe there's anything wrong with the stamp itself. The point is, the stamp is displaying as two different dates using date() on two different servers, and I believe this is not what date() is supposed to do. Shouldn't the stamp for 12-09-2002 22:13:09 be the same on every server? My rationale for this is that no matter where you are in the world, it is always a certain number of seconds since 01-01-1970 00:00:00. Perhaps strtotime() is NOT running off GMT, and perhaps date() is... there has to be SOME confusion there -- either on my side, or in my choice of functions, or SOMETHING :) Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() on two diff. servers
on 09/12/02 3:06 PM, @ Edwin ([EMAIL PROTECTED]) wrote: > [snip] >> Perhaps strtotime() is NOT running off GMT, > [/snip] > > Bingo! *GULP*... so, what we're saying is, that if I intend to pass data around on multiple servers (in different timezones) using a unix timestamp for dates (which i prefer to do), I should be using gmdate() and gmmktime() rather than date() and strtotime()? That will sure as hell be a few lines of code to dig through I'll also need an accurate (and daylight savings compliant!) way of determining the how far ahead of the GMT the server currently is, or for a specific timezone for a specific project (eg this current one, which is basing it's dates on Sydney, Australia. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date() on two diff. servers
Indian Standard Time, and add a Daylight Saving/Summer-Time > adjustment into the mix, just for 'fun'!?) > > =In conclusion, (based upon my, cough, cough, many years of wrestling with > this sort of thing) make all stored times UTC (gm*()) - the RDBMS should not > 'filter' timestamps - MySQL does not (for example), and then if you want > 'local' times you can 'do the math' for either the server's TZ or (if you're > really masochistic (?is that the word?)) the browser-client's local time. > The 'silver lining' is that you can now easily accommodate temporal > input/presentations to/from anyone, anywhere in the world - it is also easy > to produce code to calculate the server's local time (for example), so that > the same routine works regardless of where the server is located - where > next year's new 'mirror' is to be located, anywhere in the world! > > =Yes, you may have a chunk of work in front of you right now, but it will > save time (and your sanity) in the long-run and as you expand more > internationally... > > =Yell if you need more, > =dn > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How know from wich page you came from
*SOME* browsers set a referrer script name/url, and some don't, so you can't rely on it. The solution can be as simple as including the referring script as a GET variable in the URL: click Or, by keeping track of that sorta stuff with sessions... Whenever I *have to* know the URL of the preceding script, I take the directory, script name and query string eg dir/dir/page.php?var1=foo&var2=bah and base64 encode it (so that the get vars don't register with / affect the receiving script), and pass it to the next page: click On page.php, I decode it all with base64_decode(), and I know exactly where the user "came from". Similar (or even smarter) stuff can be done with sessions. Justin on 11/12/02 1:20 AM, Rodrigo ([EMAIL PROTECTED]) wrote: > Hi guys I need a way to know how to know from wich page the visitor > came, something like: > > I wanna put in a php file a switch to do a certain action if the visitor > came from a certain page, and something else if he came from a diferent > one, this way I could write, update, insert, delete or anything I need > from a single file. > > Thanks for any kind of input, > Rodrigo > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How know from wich page you came from
on 11/12/02 12:32 AM, Jon Haworth ([EMAIL PROTECTED]) wrote: > echo $_SERVER["HTTP_REFERER"]; not all browsers / useragents set this, so you can't *rely* on it. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Report Viruses
The postmaster@ or abuse@ address of his provider/ISP? Justin on 11/12/02 9:22 AM, Stephen ([EMAIL PROTECTED]) wrote: > This is off topic but, where can you go to report viruses? I've been spammed > with them a lot lately from this person and I'd like to stop him. > > Thanks, > Stephen Craton > http://www.melchior.us > > "What is a dreamer that cannot persevere?" -- http://www.melchior.us Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables from script to script
1. the only other ways to pass things around would be in sessions, or by setting a cookie on the user's computer... i hate the latter, and would prefer the former, but would NEVER carry things like a MySQL uname and password around in cookies or sessions. cookies, sessions, and even post & get (url) should be used for user-specific things (who are they, what are they asking the server to do), not program-related things (like the database password, or the global font size, or the site admin's email address... this is generally done with a config file or other included file: 2. you could define your vars (like the MySQL uname and pword) in a config file, and include it at the top of all your PHP scripts: ... 3. you can extend this further, by setting a value php.ini (auto-prepend I think) so that PHP will ALLWAYS includes the config file at the top of every script. Justin on 11/12/02 10:56 AM, Stefan Hoelzner ([EMAIL PROTECTED]) wrote: > Hi folks, > > surely this question has already been answered many times before in this ng, > but nevertheless: I want to pass variables from > one .php to another .php script. But I do not want to use either the > http://localhost/target.php?var1=test&var2=test2 nor > the > POST method. I would like to pass over general variables like usernames and > passwords for several MySQL-connects; obviously > it is not a good way to pass these vars via the mentioned ways. > > What else does PHP offer? Are there any other methods? Can I define these vars > as some kind of "global variables" in any > ini-file? > > THX for your support! > > Stefan. > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fgetcsv Help
How is the CSV being generated? Seems to me like your problem isn't ggetcsv(), but rather the file itself. Commonly, a CSV file is a series of values, separated by a comma (duh!!). The separated values are generally enclosed in double quotes ("), as it would appear yours are. Any double quotes within each value (eg: she said "hello") are escaped with a slash (eg: she said \"hello\"). If you are generating the CSV, then you can addslashes() to each value to escape the quotes, and then later on, stripslashes() to get rid of them. Sample line from your CSV should look like this: --- "1","foo","harry said \"what is it?\"","foo" "1","bah","\"don't know\" said sally","something" --- When echoing these values to the browser, you would strip the slashes. Cheers, Justin on 11/12/02 7:13 PM, Richard Baskett ([EMAIL PROTECTED]) wrote: > I am parsing a csv file with fgetcsv and the fields are surrounding by > double quotes, now I am running into a problem periodically that when there > are quotes within the value it is treating it like another value instead of > the same value. > > Any ideas on how to get around that? > > I am thinking I might have to convert all quotes to " and then turn all > "," back into quotes and then the first " in the file and > then last one since obviously they will not have a comma in between them. > This seems like a while lot of work.. > > Ideas? > > Rick > > A wise women once said: " No one can help everybody, but everybody can help > somebody." - Unknown > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading pre-extension file
Does it HAVE to be done with a regexp? You'd have to do a test to see which is quicker (regexp or this method), but I *think* this would be quicker. Better still, it's "future proof" by working for a.file.with.more.than.two.dots :) Cheers, Justin on 12/12/02 4:40 AM, Luca ([EMAIL PROTECTED]) wrote: > How to read "pre-extension" of file with regular expression? > Example: name.preextension.doc > > I need to read "preextension" > > Tanks! > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] take text before '-' and after it
Hi, Then you can do whatever you want with them... but I can't see why you'd write them to a disk file AND write them to a mysql database -- wouldn't it be one or the other? on 13/12/02 2:49 AM, Antti ([EMAIL PROTECTED]) wrote: > How can I take some text before the mark - and after it and put them for > example in array. The purpose of this is to read trough mp3 files which > are in the form of artist - song.mp3 and put them into a text file so I > can put them into mysql db. > > antti > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with text files from a Mac
1. they can export the CSV as DOS/Windows from Excel on the Mac with ease 2. they can pipe the CSV thru any text editor that lets them choose between mac/win/unix line endings (BBEdit/Lite for example) 3. $filecontents = str_replace('\r', '\n', $filecontents); //should work on 13/12/02 1:22 PM, Sterling Anderson ([EMAIL PROTECTED]) wrote: > I am working on an application for a school district and am having some > problems with the files they are supplying for import. > They are supplying data files and I am writing routines to populate the > database using these files. Its a simple file upload then I just need to > parse through the tab separated value file. I am using the most recent > PHP build on Windows with IIS ISAPI and a MSSQL database. They are > sending text files from a Macintosh application. > I noticed on the documentation for fgetcsv() that it cannot read the end > of line character on Mac files. I have not been able to find a good work > around for this issue. When I grab the entire contents of the file then > try doing a string replacement on the "\r" or even "\t" for that matter > it does not work. > Has anyone found a good solution for dealing with Mac files? > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A little regex help
Not sure if it will be quicker or not, but I don't think you NEED a regex: - get rid of 'for more information' - split on 'See' into $pre and $code - trim the bits down - wrap $code in a URL - glue it all back together UNTESTED CODE: http://support.microsoft.com/default.aspx?scid=kb;en-us;";; $suffix = 'for more information'; $splitter = 'See'; // do it list($pre,$code) = explode($splitter,$str = str_replace($suffix,'',$str)); $pre = trim($pre); $code = trim($code); $str = "{$pre} See {$code} {$suffix}"; echo $str; ?> If this gets heavy traffic, u may want to test which is faster -- or you may not care!! Justin on 14/12/02 5:21 AM, Gareth Hastings ([EMAIL PROTECTED]) wrote: > Hi, > > I'm trying to work out the regex needed to split either one of the > following lines > > Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information > Windows XP Hotfix (SP2) See Q327696 for more information > > Into one of these > > Windows 2000 Hotfix (Pre-SP4) See href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q > 322842 for more information > Windows XP Hotfix (SP2) See href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3 > 27696 for more information > > I can work out half of the expression but not the other half lol, I've > used a combination of ereg and split but I'm sure this can be done with > 1 ereg statement. Here is my code > > $ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";; > > > if (ereg("(\[See )([Q|q][0-9]+)( for more information\])", $name)) > { > $sp = split("\[See ", $name); > ereg("([Q|q][0-9]+)( for more information\])", $sp[1], $qb); > > $url = $sp[0] . "See target='_blank'>" . $qb[1] . " for more information"; > > } > > Any ideas? > > Gareth > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] migrating from register_globals on to off
Why not: 1. place a .htaccess file in each existing client/developer directory switching the value to ON -- being careful to ensure you don't wipe over an existing .htaccess file!! 2. switch the value to OFF in php.ini This means all current clients will have continued support for ON, and all new ones will default to OFF. If existing clients which to go with OFF, they just delete the .htaccess file. OR the vice-versa can be done... advise clients that you are moving to OFF in a month, explain the benefits, and make a .htaccess file available to those who don't want to migrate... so that their stuff doesn't break. Most developers will know which way they're writing code. You ultimately need to: - change the default to OFF - allow existing clients to "patch" to ON Justin on 15/12/02 12:43 AM, Willem ([EMAIL PROTECTED]) wrote: > Hello, > > Lately we discovered that, by mistake, we've run PHP with register_globals > on for a few months for all our customers. > > Since we want to turn it off, we need to figure out which customers use the > 'register_globals' functionality so we can ask them to modify their scripts. > > However, checking all php code by hand is a non-trivial task, because there > are 20,000+ php scripts. Is there a way to: > > a) parse all .php scripts once and detect whether they depend on register > globals on? > > or probably easier: > > b) add something to our current setup so that when a scripts is executed and > uses the register globals functionality, we get a notification > automatically? > > Any suggestions? > Thanks! > > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question
I assume you know that running PHP on Apache 2 is NOT RECOMMENDED YET, or at the very least, listed as "experimental"?? Justin on 15/12/02 11:13 AM, r.vellinga ([EMAIL PROTECTED]) wrote: > Hello, > > still trying to get PHP 4 support on Apache 2. (Windows ME) > Mysql is working Fine, Apache also. > > but when i insert the 2 or 3 lines " Load module etc." the server will shut > down > > can somebody help me please ? > > ricardo > > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session: I RTFM
John, PHP looks for "$vars or {$vars} to parse in the string" when double quotes are used... whereas when single quotes are used, it won't parse/substitute the vars. So, when you're not using $vars, using single quotes will be marginally faster... perhaps not important on small sites, but very important on big ones, and a decent habbit to get into :) Justin on 15/12/02 12:30 PM, John Taylor-Johnston ([EMAIL PROTECTED]) wrote: > Marco (or anyone) > > What is the difference between: > $familyname = getvar("familyname"); > and > $familyname = getvar('familyname'); > > What do single quotes do, as a general rule, that double cannot (he asks > remembering something, but not sure what)? > > > > > Marco Tabini wrote: > >> I haven't followed the rest of the thread, but how about using a >> function? >> >> function getvar ($varname) >> { >> if (isset ($_POST[$varname]) >> { >> $_SESSION[$varname] = $_POST[$varname]; >> return $_POST[$varname]; >> } >> elseif (isset ($_SESSION[$varname])) >> return $_SESSION[$varname]; >> } >> >> session_start(); >> >> // You don't need session_register anymore >> >> $familyname = getvar('familyname'); >> >> and so on--just one line per variable. >> >> Hope this helps. >> >> Cheers, >> >> Marco >> -- >> >> php|architect - The Magazine for PHP Professionals >> The monthly magazine dedicated to the world of PHP programming >> >> Check us out on the web at http://www.phparch.com! >> >> - >> - >> - >> - >> - >> - >> - >> - >> - >> - >> - >> >> >> Subject: [PHP] Session: I RTFM >> Date: Sat, 14 Dec 2002 18:41:40 -0500 >> From: John Taylor-Johnston <[EMAIL PROTECTED]> >> Reply-To: [EMAIL PROTECTED] >> Organization: FLSH, U-de-S >> To: [EMAIL PROTECTED] >> >>> Jason wrote: >>> RTFM again. >> >> Jason, again, I RTFM, but did not get it working. >> Otherwise I wouldn't have dared ask a question. >> >>> Sessions depends on a number of factors >>> including your version of PHP and the setting of register_globals. >> >> The FM manual says: >> >> "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended" >> >> So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test >> offline) >> >> Ok. I quit using $HTTP_POST_VARS["familyname"]. >> >> With a little rethinking, I have this working, I hope. >> >> Now ... is there a cleaner way to assign my variable "familyname"? >> >> Pseudo code: >> >> if _post["familyname"] exists set session variable >> (no sense in setting it until I post it) >> if _session["familyname"] exists, $familyname = $_SESSION["familyname"]; >> >> I'll have about 30 variables. Going to be alot of lines. There must be an >> easier, cleaner way? >> >> > #session_name("TestALS"); >> session_start(); >> >> if (isset($_POST["familyname"])) >> { >> session_register("familyname"); >> $familyname = $_POST["familyname"]; >> echo "Yay: \$familyname= $familyname"; >> } >> >> if (isset($_SESSION["familyname"])) >> { >> $familyname = $_SESSION["familyname"]; >> echo "yay session works, \$familyname= $familyname"; >> } >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > -- > John Taylor-Johnston > - > "If it's not open-source, it's Murphy's Law." > > ' ' ' Collège de Sherbrooke: > ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ > - Université de Sherbrooke: > http://compcanlit.ca/ > 819-569-2064 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php setup
Check phpinfo() on both the new and old server -- i think the var not defined stuff is related to a different (higher) error reporting directive on the laptop. As for the images, view the actual SOURCE of the resultant HTML page (browser > view source) and see how the image src's are being written, then check for the files directly -- my guess is you're dynamically writing the image URLs, and something is breaking (possibly needs register globals ON in php.ini). on 17/12/02 6:29 AM, Edward Peloke ([EMAIL PROTECTED]) wrote: > I recently got a laptop and was in the process this weekend of installing, > php, apache, mysql etc. One thing I noticed is when I ran the code (that > works fine everywhere else) on the laptop, I got errors of 'Variable not > defined' and I have pictures that just won't show. I am not sure if this is > the problem but most of the scripts giving the 'Variable not defined problem > and the images where in other folders and referenced in the php page like > /images/picture.gif and /includes/template1.inc. Is there something I need > to look at in my config file? > > Thanks, > Eddie > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] invoking the PHP engine on a single .html file
a .htaccess file in your document tree, anywhere above the file in question ForceType application/x-httpd-php (assuming apache server) on 17/12/02 2:38 PM, Krzysztof Wozniak ([EMAIL PROTECTED]) wrote: > Is there any possibility to invoke the PHP engine on a single, specific > file? I mean, I know I can ask PHP politely to treat every .html file as > a PHP file, but it will slow down the whole server. Can the PHP engine > be invoked locally (by folder) or preferably on a single file? > > Thanks, > > Krzysztof > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] selecting img file extension.
I would definitely store the file type (either extension or mime-type) of the files. Justin on 17/12/02 3:27 PM, Bruce Levick ([EMAIL PROTECTED]) wrote: > > Sorry for the newbie question. > I am an artist and entering my pieces into a databasebasically all > that will be displaying will be > > Title: > Medium: > Date Created: > and an image (.gif, .jpg, .swf) > > I want to know what is the best way to call a specific image type.??? > Should I give each image file extension a column |.gif | .jpg | .swf | > and set that all these columns to only display when asked?? > > So for an example case. I have a piece of artwork Called Cheetah. > > Title: Cheetah > Medium: Water Color > Date Created: 1998 > cheetah.jpg > > How do I set up my table so when I add this piece to my databse I can > select .jpeg extension to true.so to speak, and leave gif and swf > false. > > My image source might be (i know the coding will be wrong) src="images/?title? . ?ext?"> (cheetah.jpg). > > Cheers > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Number of sessions
If you're running your own server (ie, not a shared server), you could count the number of session files you have saved... the accuracy of this will depend on how often the garbage is cleaned out. on 17/12/02 7:08 PM, fragmonster ([EMAIL PROTECTED]) wrote: > Hello, > Is there a way to count how many sessions are opened on a PHP web site? > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables
1. the opposite of session_register('varname') is session_unregister('varname') NOT unset($varname) 2. Are you on PHP >= 4.1 ?? If so, move away from things like: and into: MUCH cleaner to work with :) Justin on 17/12/02 10:35 PM, Antti ([EMAIL PROTECTED]) wrote: > How can I change the values of session variables > (session_register('variable');) in a session. Do I just > unset($variable); and do session_register() again and give it a new > value. I tried this and it seems that it doesn't work. > > Antti > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if question
Not sure if 'OR' works... I use a double pipe/vertical bar ('||') for 'OR' Jus to point out the really obvious... in the above example, the following would also work: Cheers, Justin on 18/12/02 12:04 AM, John Fishworld ([EMAIL PROTECTED]) wrote: > Help ! > > Can anyone tell me why this doesn't seem to work ?? > > if (($stelle_who != '1') OR ($stelle_who != '2') OR ($stelle_who != '3') OR > ($stelle_who != '5') ) { > > and what can i use as an alternative syntex ?? > > thanks in advance > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if question
Oooops -- forgot to mention -- you might want AND not OR or ||... and some other posts have hinted that OR does work... Justin on 18/12/02 12:30 AM, Justin French ([EMAIL PROTECTED]) wrote: > Not sure if 'OR' works... I use a double pipe/vertical bar ('||') for 'OR' > > $stelle_who = '4'; > if(($stelle_who != '1') || ($stelle_who != '2') || ($stelle_who != '3') || > ($stelle_who != '5')) { > echo "success"; > } > ?> > > Jus to point out the really obvious... in the above example, the following > would also work: > > $stelle_who = '4'; > if($stelle_who == '4') { > echo "success"; > } > ?> > > > Cheers, > > Justin > > > on 18/12/02 12:04 AM, John Fishworld ([EMAIL PROTECTED]) wrote: > >> Help ! >> >> Can anyone tell me why this doesn't seem to work ?? >> >> if (($stelle_who != '1') OR ($stelle_who != '2') OR ($stelle_who != '3') OR >> ($stelle_who != '5') ) { >> >> and what can i use as an alternative syntex ?? >> >> thanks in advance >> >> > > Justin French > > http://Indent.com.au > Web Development & > Graphic Design > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session variables
on 19/12/02 2:25 AM, Antti ([EMAIL PROTECTED]) wrote: > Neather this seem to work > > $_SESSION['some_variable']=$variable; > > nor this: > > $_SESSION['today']= date('Y-m-d h:m:s'); > > antti What do you mean "don't work"... what are you trying to do? page1.php click to go to page 2 page2.php The value of $_SESSION['today'] is . This code assumes you either have trans-sid compiled OR are allowing cookies on your browser AND cookies is a method that PHP sessions use (it is by default) in php.ini. Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Empty textfield
read ALL of http://www.php.net/manual/en/features.file-upload.php I'm assuming php >= 4.1.1 Justin on 19/12/02 2:33 AM, shaun ([EMAIL PROTECTED]) wrote: > Hi, > > what is the best way to check if a textfield is empty, and is it the same > for file fields? > > thanks for your help > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] repeat region
Hi, what you want to do is only echo the and every 7 loops through the records. Untested example: "; } echo "{$myrow['id']}"; if($i == 7) { echo ""; $i = 0; } } ?> Justin on 19/12/02 4:27 PM, Bruce Levick ([EMAIL PROTECTED]) wrote: > Hi php'ers, > I have learnt alot in the last week in regards to php and listing the > rows of a table set. > > I need help with a small challenge. I can retrieve rows from a database > table and list the results in HTML cell successfully. My challenge > is this. > > I want to list the I.D (auto increment id number) of a data base table > in html to display 7 columns accross and then drop down to the next row > and another 7 columns accross. > > So the result would list numbers .1-7 then drop down and list 8-14 > underneath and so in until the end of the results. > > Is this at all possible?? Difficult?? > > Is there a project or a tutorial with an example I can draw from.?? > > Cheers > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Justin French http://Indent.com.au Web Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Random include???
Hi, untested code adapted from a random image thing I have... this works by checking the files in a directory and picking one at random. The other option is to keep all your include file paths in an array: The difference between the two options is *obviously* a few more lines of code for the first, BUT it lets you update the "random files list" just with FTPing to the rand files directory, whereas option 2 requires you to FTP the files AND update the $files array Justin on 20/12/02 1:45 AM, Benjamin Trépanier ([EMAIL PROTECTED]) wrote: > Hi, I'm a newbie in php so sorry for that question! > > I have a table in a html dcc and I want toinclude a file in a cell, but > that file must be random so people load a different page each time they > refresh... The basic syntax I use for the include is below now, I want to > know how to generate the random. > > Ex. My file are > > folio_1.php3 > folio_2.php3 > folio_3.php3 > folio_4.php3 > folio_5.php3 > > > > ?> > > > Thanks! > Ben > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good program to indent large quantity of files?
on 20/12/02 4:04 PM, Leif K-Brooks ([EMAIL PROTECTED]) wrote: > Thanks, but that's not what I'm looking for. I already have a good php > editor, what I'm looking for is something to indent exsiting files. ... so open them up in the editor, indent them, save them, continue using your old editor. Justin > Mike Bowers wrote: > >> I use Ultra-Edit 32 .. It auto-indents when u set highlight mode to PHP >> .. It also has a syntax higlight feature to show you when it recoginises >> PHP4.2.3 code .. http://www.ultraedit.com >> >> Mike Bowers >> PlanetModz Gaming Network Webmaster >> [EMAIL PROTECTED] >> ViperWeb Hosting Server Manager >> [EMAIL PROTECTED] >> [EMAIL PROTECTED] >> All outgoing messages scanned for viruses >> using Norton AV 2002 >> >> >> -Original Message- >> From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] >> Sent: Thursday, December 19, 2002 9:53 PM >> To: [EMAIL PROTECTED] >> Subject: [PHP] Good program to indent large quantity of files? >> >> >> I haven't been indenting any of my code, but I want to start indenting >> to make the code more readable. It would be near-impossible for me to >> manually indent what's already there, though. So, I'm looking for a >> program to indent an entire folder of PHP files at once. Any >> suggestions? >> >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternating Links
There was a post on a similar thing the other day, and about once a week for the past few years :P Quick (untested) example: '; } echo "{$myrow['link']}"; if($i == 2) { echo ''; $i = 0; } } ?> This is easily adaptable to three (or more) columns by changing the last if() statement... Justin on 20/12/02 5:21 PM, conbud ([EMAIL PROTECTED]) wrote: > Hi. > Lets says I have 8 links stored in a database, extracting those links is > no problem. Now lets says I have 2 columns, how do I get link 1 into > column 1 then get link 2 into column 2 then link 3 into column 1 and > link 4 into column 2 and so on... > > > > This is column 1 > This is column 2 > > > > -- > Conbud > Graphic & Web Design Using Open Source Technology > -- > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote from astring?
don't filter the quotes... escape them with add_slashes() justin on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > as title that I'm getting a trouble on filtering the single quote ' , since > there would be error when storing those string into MySQL, thus, i have to > find the appropriate method to solve it, anybody can help please? > thx a lot > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] login
You really need to check out sessions. 1. user logs in by a form 2. php validates the login, checks for a valid uid/pwd 3. if valid, sets a session variable like $_SESSION['uid'] 4. you put session_start() at the top of each page, and php will know that they are logged in as "justin" or whatever. Rather than passing around thier userid in the URL, you pass around a session id (long unique number) in the URL, and associate MANY session variables to it via either the URL or cookies (userid, first name, fav colour, preference for font size, preference for date format, whatever) on the server-side. The guts of it is a lot more complex than that of course, with many different options, but you get the drift :) What you would actually be testing for on each page would be $_SESSION['uid'], not $clientid or $_GET['clientid']. There are some simple examples on: http://www.php.net/manual/en/ref.session.php Cheers Justin on 21/12/02 1:20 AM, Edward Peloke ([EMAIL PROTECTED]) wrote: > Ok, > Newbie Question. > I know have a login and registration page on my website. What is the best > way to check to see if the users have logged in before they access the other > pages? SHould I add to each of the other url's ?clientid='' and if it is an > empty string I know they haven't logged in? > > Thanks, > Eddie > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any method to filter the single quote fromastring?
on 21/12/02 2:00 PM, Alexander Guevara ([EMAIL PROTECTED]) wrote: > It works.. but when you retrieve the data from the database to a text box it > doesnt appear if it has the single quote ('), o tought it was cause i have > the stripslashes but i delete stripslashes and it still doesnt appear in the > text box! Huh? I can't really understand what you're saying. If you're adding stuff to a database, and getting an error, use addslashes(), then on the way out of the database, you need to stripslashes(). Easy. If you don't get any errors, then magic quotes is probably enabled in your php.ini file. Justin > "Justin French" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > don't filter the quotes... escape them with add_slashes() > > justin > > on 20/12/02 10:50 PM, ªüYam ([EMAIL PROTECTED]) wrote: > >> as title that I'm getting a trouble on filtering the single quote ' , > since >> there would be error when storing those string into MySQL, thus, i have to >> find the appropriate method to solve it, anybody can help please? >> thx a lot >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Which one to use..
I use: if(eregi('index.php', $_SERVER['PHP_SELF'])) { include('welcome_thing.txt'); } although it'd be quicker without the eregi() call, as long as you knew the full value that PHP_SELF would return. Cheers, Justin on 23/12/02 11:30 AM, Peter Houchin ([EMAIL PROTECTED]) wrote: > Howdy, > > in my header page that I include I have a lil script that basically welcomes > a user to the site.. I've been asked if I can only get this to show up on > the 1st page of the site ( index.php ) now rather than have a whole new > header page I want to see if i can go something like this > > if page = index.php > do this > else > do that > > now to my actual question which way/function would be the better option to > use for this.. > > $_SERVER["REQUEST_URI"], $_SERVER["SCRIPT_NAME"] or try and do something > with $_SERVER["PHP_INFO"], or is the one that I am missing .. ? > > Cheers > > Peter > "the only dumb question is the one that wasn't asked" > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tutorials on OOP
Both of those classes would already exist on a site like phpclasses.org... do you have to BUILD them, or do you NEED them? Justin on 23/12/02 11:43 AM, Davy Obdam ([EMAIL PROTECTED]) wrote: > Hi people,. > > I have to build several classes for a project i am doing, but i am quite > new to OOP programming. I need to make a database abstraction layer > class and a user login class.. Does anyone know some good tutorials > about these things and OOP in general. Thanks in advance.. > > Best regards, > > Davy Obdam > mailto:[EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Flushing image from database to browser - how to get itcached??
image.php needs to send appropriate headers for caching... of course, i have no idea what they are, because i've never done dynamic images :) don't *think* mod rewrite will affect/help anything here. Justin on 23/12/02 6:35 PM, Tim Molendijk ([EMAIL PROTECTED]) wrote: > Hi all, > > I'm storing a bunch of images in a MySQL database. I use a small PHP script > to load the appropriate image from database and flush it to the browser. > Because this script flushes in content-type image/jpeg (or similar) it can > be used as IMG SRC. So images can be shown on a webpage using the following > HTML: > > This works perfectly fine but the browser (IE) does not cache these images. > On one hand I do understand why -- the image source is a script, not a > static image file, so the browser qualifies the resulting content as > dynamic. On the other hand though: in my setup image.php?id=1 is (as good > as) eternally the same image and for image.php?id=2, image.php?id=3, etc. > the same thing. So it would be no problem if the browser would cache f.e. > image.php?id=1 as if it is a static image. It would even be desirable > because it saves bandwidth. > > So actually the issue is: how can I get browser to cache image.php?id=1 (... > etc.) just as it caches image1.jpg (... etc.)?? The only thing I've thought > of is using mod_rewrite to rewrite URI's like image1.jpg into image.php?id=1 > but I haven't tried it yet -- don't know if it's a logical idea. > > Thanks in advance, > Tim Molendijk > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] md5()
You reset the password to something new... either manually (a person) or with a self-help script. md5 is one way encryption. Justin on 24/12/02 12:38 AM, Edward Peloke ([EMAIL PROTECTED]) wrote: > I don't want to store my users passwords in the db as clear text so I know I > can use md5(). But, what do I do when a user has forgotten his/her password > and I need to send it to them? Can I reverse md5()? > > Thanks, > Eddie > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date Subtraction
okay, this is just me thinking out loud... none of this is tested... basically, - take the string - get rid of the last 3 chars (eg .75) - split on ' days, ' - split the 2nd half on ':' - multiply each bit (days, hrs, mins) by the appropriate no of seconds - add it all together to get a number in seconds Cheers, Justin on 24/12/02 8:29 AM, Christopher J. Crane ([EMAIL PROTECTED]) wrote: > I have two periods in time from a Cisco router that I would like to find the > difference in seconds. I am not sure the best way to do this since it is not > a date, but rather an amount of time since last reset. > > Here is the numbers > > 181 days, 7:11:06.66 > //stands for 181 days, 7 hours, 11 minutes, 6.66 seconds. > > The next is > > 181 days, 7:16:6.75 > //stands for 181 days, 7 hours, 16 minutes, 7.75 seconds. > > I would probably shave off the .66 and .75 seconds while it was still a > string. It may be faster to round when it's in seconds, I really don't know. > Then what do I do? > > I was thinking of using strtotime(); but because it's not really a date, I > am at a loss for what to do. > > Any help with this would be great. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Formatting text output
What does the database table(s) look like? I don't understand what '0045' and '2354' are -- are they student no's? Better questions get better answers :) Justin on 26/12/02 12:03 PM, menezesd ([EMAIL PROTECTED]) wrote: > Hello friends. > > I work for a school where we need to put the class results on to our web, one > for every class. We enter the marks in the database and this should be > displayed in a particular varying format as follows(an example) : > > Grade A Pass : > 4554 7687 9834 2354 7671 > > Grade B Pass : > 0045 7612 2297 > > Failed : > 3104 6509 0286 8765 2229 0978 > > How can I put this in Mysql and get the same test formatting out? If the grade > types where standard and limited, it was okay. But the grades types can > increase or decrease. How can I maintain the same formatting as what I input? > > Thanks very much > Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rounding...sort of
php.net/floor OR Justin French on 28/12/02 8:49 PM, Peter Lavender ([EMAIL PROTECTED]) wrote: > Hi everyone, > > I have a nubmer: 4.1 but I only want the whole number 4, even if it's > 4.9, so this rules out using round (Unless I missed a parameter). > > How could I do this.. I'm drawing a blank... > > Pete > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Populating a list box from a database
SHOW US SOME CODE!!! none of us are mind readers... either copy a few lines from the HTML source in IE, or from the PHP script. Justin on 29/12/02 4:03 AM, Denis L. Menezes ([EMAIL PROTECTED]) wrote: > Hello Friends, > > Two days ago I had asked how to do this. Thanks for the replies. > > I have done the required code and I can see the html output(Under view-> > source in the IE browser) and see the option values for the listbox are > acheived. But the listbox in the browser is very thin and does not show the > values. > > Can someone tell me what is wrong? > > Thanks > denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: PHP3 + session handling limitation
on 31/12/02 5:54 PM, electroteque ([EMAIL PROTECTED]) wrote: > hi i've just started a job and they are sadly using php3 , what is the work > around for the session handling limitation ? i have an authentication class > which will not work now beause it cant handles sessions :| I don't think there's a work-around that will be able to port your class into the PHP3 environment. Using PHP3 (in ye olde days) meant either: a) rolling your own session handling system b) using PHPLib, a library of files and document templates that include session handling Either way, you're probably talking about a pretty major redevelopment / extension of your code to suit. The easiest solution is to just upgrade or move to a host using PHP4... really, it's been YEARS since PHP4, and I can't see any reason to hang around with PHP3. Good luck, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alternatives for Meta Refresh
on 31/12/02 2:48 AM, Stephen ([EMAIL PROTECTED]) wrote: > I'm writing a PHP chat script and I'm rather stumped on this. I either want > the chat window to refresh when there's a new message or refresh every few > seconds but not with meta refresh, rather something with less noise (the > infamous IE clicking sound) and/or something faster. The only thing I can > think of is the header function. Any ideas? The header() function (like everything in PHP) happens SERVER SIDE before the page hits the browser, so this won't help. META refresh is the only standard, HTML way to do it, AFAIK -- and even then, i'm not 100% sure that all browsers and user agents support it. Another option would be for javascript to refresh the page, but again, this will probably invoke the IE clicking sound. Most chat programs do use either meta refresh, or some sort of Java applet instead of refreshing. I think there are also some Flash chat things out there too. Cheers, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Securing areas of a web site with PHP
A lot has been said on the issue already, so I'll attempt to keep mine brief. Cache control will help a little, but not all browsers support it. Yes, it will cause a little more traffic on your site, and yes it will "help" keep some people from clicking back, but it certainly won't FIX anything. Javascript can disable back buttons, but i've never used it, because a) I hate javascript b) you can't rely on javascript to be available c) i don't like forcing people to work a certain way d) there are always work-arounds I know it sounds simple, but try to analyse what other big sites are doing in this situation: - amazon.com doesn't seem to "break" when I disrupt my surfing with a login or logout... it just picks up the pieces and does what it can. last time I bought stuff there, I certainly didn't notice any caching issues, or that my back button was disabled. - my bank, the national bank (national.com.au) pops up the entire secure banking process in a new javascript window... essentially, this starts a new process for the user in a new window. when they log-out, the window is useless and is closed... there is NO clicking back if the window is closed :) I guess the national were concerned enough about back buttons and all that stuff to require javascript in order to use net banking... you'd have to make your own assessment of that. If there's a big issue with people clicking back, I'd suggest that there *may* be a problem with the logic of your site. Afterall, clicking "back" is what the web is about!! If the big sites can cope with it, I'm sure you can. In short my solution is that if you CAN'T live with people clicking back, then you should open the sensitive content in a new window which is auto-closed when the user logs out... this way there is no hope of clicking back. Yes it requires javascript, which means you have to think hard about ignoring a % of your users. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get folders names in a dir
on 02/01/03 9:36 AM, Alexander Guevara ([EMAIL PROTECTED]) wrote: > i need to get in a select box all the dirs inside a folder.. how can i do > that? Give this a whirl. Please note, this code is very much slapped together... it works, and i've tested it, but there's nearly ZERO error checking. "; foreach($files as $key => $value) { echo "{$value}"; } echo ""; ?> Cheers, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using mail() for mailist list app
Check the archives... mail() tends to "break" pretty quickly... sometimes on less than 100 personalised emails... The issue ISN'T mail() itself, but things like server timeouts, script timeouts, etc etc. The issue also isn't really HTML mail, but more the fact that each email has to be sent to the mail que, and this is a slow-ish process, so the script timesout. So another option is Bcc'ing the email to everyone in a non-personalised manner... you can squeeze a lot more emails out of mail() before the script times out, but you will run into other issues like: a) Bcc'd mails of more than 100 recipients can't be sent on most shared hosts, because it looks like spam -- check with your ISP b) some mail programs and servers treat mass Bcc emails as spam, I hear At the moment, I've only got mailing lists that deals with 50-300 people, so I'm just Bcc'ing them in batches of 20 people... a trade off between lots of emails to timeout the script, and lots of people in the Bcc list. I think for 6000 though, you will really need to look at a class like Manuel's at PHPclasses.org (I think called mimeMail) which has various work-arounds, none of which I've tried. Cheers, Justin on 02/01/03 9:46 AM, Monty ([EMAIL PROTECTED]) wrote: > Happy New Year everyone! > > Is the PHP mail() command robust enough to use in a little mailing list app? > The app will basically send an HTML or Text e-mail to the member database of > about 6,000 people. I'm using RedHat Linux 7.2 with PHP 4.2.2, by the way. > I'm concerned I'll bog down my server if I issue the mail() command 6,000 > times on our server, but, maybe it won't be a problem? > > Also, although I'm sending HTML e-mail, I'm not including attachments or > inline graphics (only direct hotlinks to graphics on a web server). Will > mail() still work okay for this, or do I need to use one of the various PHP > e-mail classes available to send HTML e-mail? > > Any recommendations for online tutorials about building a mailing list > manager using PHP would be much appreciated! > > Thanks! > > Monty > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session problem
on 02/01/03 9:46 AM, Andrew Williams ([EMAIL PROTECTED]) wrote: > I have been messing with PHP 4 on a windows 2000 machine using apache and am > having trouble getting sessions to run. I'm going to assume PHP > 4.1 I'm also going to assume you're allowing cookies on your browser??? > session_register_var.php change your script to: Click here to go to the next page"; ?> > and > show_session_var.php change this script to: lemme know how you go Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Problem
on 02/01/03 11:42 AM, Michael J. Pawlowsky ([EMAIL PROTECTED]) wrote: > You don't need to accept cookies for sessions. That's the beauty of it. > PHP automatically appends ?PHPSESSID=$sessid to URLs. only if you compile with trans_sid (he didn't) or if you physically add the SID to each LINK (which he hasn't so far). > You will have to tweak this... especiallu since I use my own class for db > stuff... but here it is... enjoy. eeek, that's a whole lotta code for him to learn just to try and get sessions working, don't you think?? [mega snip] Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Problem
on 02/01/03 11:55 AM, Michael J. Pawlowsky ([EMAIL PROTECTED]) wrote: > Most it is HTML output... But If I'm not mistaken... and I might be... but > wasn't this a thread that started about securing web pages? > So basically I gave him my solution to it. And I didn't charge the $150/hr > consulting fee! :-) Wrong thread I think :) "securing areas of a site with PHP" was the other thread. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script!!
on 02/01/03 7:54 AM, Karl James ([EMAIL PROTECTED]) wrote: > can someone take a look at this > and see why this wont work. why don't you start by telling us what's wrong, or HOW it "doesn't work"? Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions & Security
Hi, There's actually another thread on this topic at the moment... quick summary: 1. you can't rely on the IP address 2. you can't rely on the referrer It's been suggested on the list that you could record the user agent into the session, and check against that -- keeping in mind that the user agent may be null, and that this would not prevent someone with an identical useragent from hijacking the session... it's more like an added layer of protection :) Check out the recent thread "prevent session_replay" Justin on 03/01/03 11:36 AM, Duncan ([EMAIL PROTECTED]) wrote: > Hi, > > i am currently working with sessions and how to secure them as much as > possible. > In an older script of mine, i used session_is_registered() to take care > of this, but according to the manual: "If you are using $_SESSION (or > $HTTP_SESSION_VARS), do not use session_register(), ..." - i can't use > this anymore. > Well, so i wondered: how do you or would you make sure that s.o. won't > be able to hijack the session? > Also any recommended URLs about this matter are more than welcome as well :) > > I am currently only checking the IP, but i read about issues with AOL > users about this, since it can happen that their IP changes while > browsing the site. > S.o. mentioned checking the referer and so making sure, the script comes > from the own server, but when using redirects or stuff like that (or the > browser doesn't support this properly - as read in the php manual), then > this isn't 100% working as well. > > So, start nuking me with your comments ;) > > Regards, > Duncan > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php