[PHP] Check for doubleposts
Hi, what is the easiest way to check if a person i registered twice in a mysql-table. Lets assume that I only check if the last name is in the table more than once. This is in mysql 4.0 (subquery not an option). Do I have to use arrays and in_array. Or is there a more elegant solution? Best regards Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String replace inside img
I have a some problems doing a search and replace in a string. I want to replace: img ALT= src=base/image.php?id=3 border=0 with img ALT= src=image.php?id=3 border=0 Note ALT, src, border properties may come in random order. My solution today is a not good enough because I only do an eregi_replace on all image.php, I only want to replace those inside a img Todays solution $string = eregi_replace(base\/image.php, image.php, $string); Solution? Best Regards -Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eregi
Hi, I'm doing: eregi($start(.*)end, $rf, $my_var); And I want it to stop at the first presedence of $end, not the last (thats what this is doing). Any hints? Best Regards Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help: eregi problem (?)
Hi, I'm doing: eregi($start(.*)end, $rf, $my_var); And I want it to stop at the first presedence of $end, not the last (thats what this is doing). Any hints? Best Regards Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML to HTML?!
Wrap into a output buffer. ob_start, ob_get_contents This was neat. I did: ob_start(); $myvar = ob_get_contents(); But it still outputs the page, can I disable that? Regards Fredrik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML to HTML?!
Miguel Cruz [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wed, 1 May 2002, Fredrik Arild Takle wrote: Wrap into a output buffer. ob_start, ob_get_contents This was neat. I did: ob_start(); $myvar = ob_get_contents(); But it still outputs the page, can I disable that? Read the output buffering section of the manual. Look for the word flush. Correct me if I am wrong, but isn't flush() a function to output the buffer? What I want to do is to prevent xml_parse() to output the html. Hints? Best Regards Fredrik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing XML
Hi, this might be a silly question, but I really haven't used XML alot with PHP. I've parsed som XML, when I do xml_parse it outputs the html-codes. I want to make a variable out of it.. I've tried $output = xml_parse(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML to HTML?!
Hi, this might be a silly question, but I really haven't used XML alot with PHP. I've parsed some XML, when I do xml_parse it outputs the html-codes. I want to make a variable out of it, so I can write it to a file. I've tried $output = xml_parse(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eregi_replace
Why won't this work? $NoteNm[$i] = eregi_replace (V:\memo\F0001\, , $NoteNm[$i]); $NoteNm[$i] = eregi_replace (\\LOBBY\VismaDok\Memo\, , $NoteNm[$i]); Best Regards Fredrik A. Takle Norway -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eregi_replace
Backslashes are magic. Double them and try again (e.g., --- $NoteNm[$i] = eregi_replace (LOBBY\\VismaDok\\Memo\\, ... Well I've allready tried that one: Outputs: Warning: REG_EESCAPE:~trailing backslash (\) in D:\Inetpub\wwwroot\www_lobb\phpshop.php on line 28 Warning: REG_EESCAPE:~trailing backslash (\) in D:\Inetpub\wwwroot\www_lobb\phpshop.php on line 29 Best Regards Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security Issue?!
Hi, I found a weekness in one of my local dev projects today. php.ini is set ut with cookies off in session handling. I asked another user to send me his url when logged in, I copied and pasted it and then I was logged in as him. What should I do? Turn cookies on? Or write ip to mysql? or...? Best Regards Fredrik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP + GD 2.0.1 + WIN2K
I have a win2k machine set-up with iis 5.0, php 4.1.0 and now I want to use image_copy_resample() image_copy_resample() is not working in the version of gd included in php 4.1.0. Where should I download the .dll for version 2.0.1? Regards Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Windows 2000 Permissions error
I guess you have to set EVERYONE. (Don't now for sure) Fredrik A. Takle Justin King [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... While trying to use dir() on a certain directory, I get the error Warning: OpenDir: Invalid argument (errno 22) in c:\inetpub\wwwroot\search\update.php on line 71. I'm aware this is most likely a permissions error, but I've already given SYSTEM, SELF, and SERVICE full control over the directory. I have to restrict access to a few users on our network for this directory so EVERYONE isn't an option. Anyone have any ideas as to what I need to set the permissions to? -Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Checking if session has been started
session_start(); $valid_session = true; session_register(valid_session); OR SOMETHING LIKE THIS? if (session_is_registered($valid_session)) { // Do something?! } Gaylen Fraley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Why not populate a session variable, in the page that starts the session, like : session_start(); session_register(valid_session); $valid_session = true; Then in the page that you need to check, like: if ($session_valid) { // Do something since a session is already running } -- Gaylen [EMAIL PROTECTED] http://www.gaylenandmargie.com PHP KISGB v1.2 Guestbook http://www.gaylenandmargie.com/publicscripts Alexander Skwar [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi I need to run some code if a session has been started. However, to do this, I need to figure out IF the session has been started at all. How can I do this? Is checking for the count of elements in HTTP_SESSION_VARS the only reliable way of doing this? Like so? ?php if (0 count($HTTP_SESSION_VARS)){ // Do something since a session is already running } ? Thanks, Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 3 days 3 hours 9 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: PHP EDITOR 4 WINDOWS?
Codewhiz is great. Remember to download php-language-files if you want syntax-highlighted-code (or something!) Best Regards Fredrik A. Takle Kyle Smith [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does it really exist? If so could someone post some URLs for me? -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Hmmm?
I think it's impossible to read/understand my own scripts if i don't do it. Do: ?php if ($submit) { echo Counting from 1-32br; for ($ii = '1'; $ii = '32' $ii++) { echo $ii. ; } } echo brAll done!; ? instead of: ?php if ($submit) { echo Counting from 1-32br; for ($ii = '1'; $ii = '32' $ii++) { echo $ii. ; } } echo brAll done!; ? Best Regards Fredrik A. Takle Keith Jeffery [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Simply indent formatting for readability. I personally don't indent after the ? tag, but to each his/her own. Kyle Smith [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Whenever i get a php script off a website why is it that most of the main parts in the script have a space from the left border. eg ?php echospazzz; ? -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: function that will print the url for embedded links
You might wanna make a function for links: ?php function makelink($descr, $href) { global $printer; if ($printer) { $link = $descr ($href); } else { $link = a href=\$href\$descr/a; } return $link; } To echo an link in a site, do: html above ?php echo makelink(Offical PHP-site, http://www.php.net;); ? html under contact.php will echo: a href=http://www.php.net;Offical PHP-site/a contact.php?printer=true will echo: Offical PHP-site (http://www.php.net) Hope this works! Best Regards Fredrik A. Takle ElanIT [EMAIL PROTECTED] wrote in message BB6D932A42D6D211B4AC0090274EBB1D2EF03B@GLOBAL1">news:BB6D932A42D6D211B4AC0090274EBB1D2EF03B@GLOBAL1... I'm looking for a way to have a url for a link explode into the actual url address. So for example, on a dynamically created webpage, I have a link called: Contact. When someone chooses to view the printer friendly version of this page, I want the link on the the printer-friendly page to change to the following: Contact (http://www.web.com/contact.html). Any ideas of how to automate this process? Thank you, Shawna -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: check if user exists
$result = mysql_query(SELECT uname FROM users WHERE uname=\'$username@$domain\'); $numrows = mysql_num_rows($result); if ($numrows == '1') { echo User already exists; } else { echo User don't exist; } Best Regards Fredrik A. Takle Bergen, Norway Ker Ruben Ramos [EMAIL PROTECTED] wrote in message 009f01c11aba$1110d6c0$323039ca@weblinq1">news:009f01c11aba$1110d6c0$323039ca@weblinq1... how do i check if user exist? I tried... $result = mysql_query(SELECT count(uname) FROM users WHERE uname=\'$username@$domain\'); if(isSet($result)) return(Username already exists.br\n); but still wont work.. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Output (Urgent!)
Why doesn't this work? Any ideas?! $resolution = SCRIPT LANGUAGE=\JavaScript\document.write(screen.width)/SCRIPT; if ($resolution = '1024') { $resolution = 1024; } else { $resolution = 800; } echo $resolution; It always output 1024 Best regards Fredrik A. Takle Bergen, Norway -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Output (Urgent!)
This fixed it, but I don't like it! If you have any other suggestions, feel free to email me. SCRIPT LANGUAGE=JavaScript if (screen.width = 1024) { var resolution = (1024) } else { var resolution = (800) } /SCRIPT Best Regards Fredrik A. Takle Fredrik A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Custom Headers?
Can I send like custom headers? header (Resolution: 1024); and echo it in the phpscript? Can I do this or is it a silly question? Best Regards Fredrik A. Takle -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] protected Images without using htaccess
1. Authenticate user 2. Put the pictures in a secret folder or outside http_root 3. Do this: ?php header(Content-Type: application/download\n); header(Content-Disposition: filename=\$file\); $fn = fopen($file , r); fpassthru($fn); ? I hope this helps! Fredrik A. Takle [EMAIL PROTECTED] www.iportal1.com Arash Dejkam [EMAIL PROTECTED] wrote in message 9gvk5g$8o0$[EMAIL PROTECTED]">news:9gvk5g$8o0$[EMAIL PROTECTED]... Hi, I'm going to make a page in which users (being authenticated by PHP session management) upload pictures and specify which other users can see those pictures, and I want all the process be automated, and I don't want to use Apache protection on directories, now I have a problem: if I store images in a directory which is in root directory of HTTP server, then any user can access any image by sending a direct query from his browser like : www.mysite.com/members/images/img023.jpg even if he is not allowed. and also I can not save image out of HTTP root directory because then http can not serve them. I found a very foolish solution for this :) I can store the images out of HTTP root dir and then use a PHP script which first checks the session ID and then sends the images with ImageCreateFromJPEG() and ImageJPEG() functions. Can anybody give me a better way to solve this problem ? Thanks Arash Dejkam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Is this a joke?!
Is this a joke? http://www.perl.com/search/index.php *hehe* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] protected Images without using htaccess
added the wrong script... arghh... ?php Header(Content-type: image/gif); $fp = @fopen($img,rb); fpassthru($fp); fclose($fp); ? Fredrik Arild Takle [EMAIL PROTECTED] wrote in message 9gvl19$er6$[EMAIL PROTECTED]">news:9gvl19$er6$[EMAIL PROTECTED]... 1. Authenticate user 2. Put the pictures in a secret folder or outside http_root 3. Do this: ?php header(Content-Type: application/download\n); header(Content-Disposition: filename=\$file\); $fn = fopen($file , r); fpassthru($fn); ? I hope this helps! Fredrik A. Takle [EMAIL PROTECTED] www.iportal1.com Arash Dejkam [EMAIL PROTECTED] wrote in message 9gvk5g$8o0$[EMAIL PROTECTED]">news:9gvk5g$8o0$[EMAIL PROTECTED]... Hi, I'm going to make a page in which users (being authenticated by PHP session management) upload pictures and specify which other users can see those pictures, and I want all the process be automated, and I don't want to use Apache protection on directories, now I have a problem: if I store images in a directory which is in root directory of HTTP server, then any user can access any image by sending a direct query from his browser like : www.mysite.com/members/images/img023.jpg even if he is not allowed. and also I can not save image out of HTTP root directory because then http can not serve them. I found a very foolish solution for this :) I can store the images out of HTTP root dir and then use a PHP script which first checks the session ID and then sends the images with ImageCreateFromJPEG() and ImageJPEG() functions. Can anybody give me a better way to solve this problem ? Thanks Arash Dejkam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] copy() ??
I'm trying to upload i file through a webpage... -- add.php3 FORM method="post" action="do_add.php3" input type="file" size=40 name="userfile" INPUT type="submit" name="pub" value="Publiser" /form -- do_add.php3 copy($userfile, "/imgs/artikler/test.jpg"); unlink($userfile); -- ERROR msg..: Warning: Unable to create '/imgs/artikler/test.jpg': No such file or directory in c:/programfiler/apache group/apache/htdocs/do_add.php3 on line 22 -- php.ini upload_tmp_dir = c:\programfiler\apache group\apache\htdocs\temp\ Note: I'm currently running the webserver on Win98 (I know, it sucks!) Any tips anyone? - Fredrik A. Takle Bergen, Norway [EMAIL PROTECTED]
[PHP] Problem!
1. $date = "20010101"; How could I output 01 01 2001 (or make it 3 variables, like day, month, year)? 2. What is the best way to encrypt (using PHP and MySQL)? Could you please answer me directly by mailadr. ([EMAIL PROTECTED]), because I'm currently not a member of this list at home! ----- Fredrik A. Takle [EMAIL PROTECTED]