Re[2]: [PHP] Self Submitting Form
Hi Sam, I did that only because I was too lazy to upload and did the testing locally so I could grab the value in Javascript. Of course it works with post as well... test.html form name=myform1 method=get action= input type=hidden name=myvar1 value=testing script window.open(test2.html, test); /script /form test2.html BODY onLoad=document.forms[0].submit(); form name=myform1 method=post action=test.php INPUT TYPE=hidden NAME=do_preview VALUE=1 script document.write('INPUT TYPE=hidden NAME=itworks VALUE='+opener.myform1.myvar1.value+''); /script /FORM /BODY test.php ? print_r($_POST); ? Outputs: Array ( [do_preview] = 1 [itworks] = testing ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CMS and images, how?
Hi there, I am presently coding a little CMS. I want to give users the possibility to add images to articles as easily and flexibly as possible. Does anyone have a recommendation on how to do it? So far, you can upload an image which then is checked for its dimensions. If necessary, the user is redirected to a flash tool that enables you to resize the image (imagemagick), a given aspect ratio is kept. A thumb is created and those two files are written to the database. I also write the alignment to the database as chosen during upload. And I have a template system that replaces tags like #img1# in a template with a table to nicely display the images from the db. The only problem is: how do I allow users to insert those images in the text? If I work with a fixed template, the number of images in an article is limited... I have thought about using buttons that you could press while editing the text that would then capture the cursor position in the textarea. But that would only work in IE and is not a very nice solution... Thank you for your suggestions... toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Self Submitting Form
Hi Sam, I am not sure I know what you want to do... I tried to recreate your problem: test.html form name=myform1 method=get action= input type=hidden name=myvar1 value=testing script window.open(test2.html, test); /script /form test2.html BODY onLoad=document.forms[0].submit(); form name=myform1 method=get action=test3.html INPUT TYPE=hidden NAME=do_preview VALUE=1 script document.write('INPUT TYPE=hidden NAME=itworks VALUE='+opener.myform1.myvar1.value+''); /script /FORM /BODY test3.html script language=Javascript function parseQueryString (str) { str = str ? str : location.search; var query = str.charAt(0) == '?' ? str.substring(1) : str; var args = new Object(); if (query) { var fields = query.split(''); for (var f = 0; f fields.length; f++) { var field = fields[f].split('='); args[unescape(field[0].replace(/\+/g, ' '))] = unescape(field[1].replace(/\+/g, ' ')); } } return args; } var args = parseQueryString (); for (var arg in args) { document.write(arg + ': ' + args[arg] + 'BR'); } /script And the output is: do_preview: 1 itworks: testing As should be expected... Pls try to specify your problem. toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pulling two field from mysql table into an array
How 'bout ? $query = SELECT field_name, user_id FROM table; $result = mysql_query($query); while($line = mysql_fetch_assoc($result) { $array[$line[user_id]] = $line[field_name]; } ? - Original Message - From: Richard Kurth [EMAIL PROTECTED] To: Richard Kurth [EMAIL PROTECTED] Sent: Monday, February 02, 2004 7:00 AM Subject: [PHP] Pulling two field from mysql table into an array What is the best way to pull two fields from a mysql database and add the two fields to an array for each record in the table field_name user_id I need it so iI can access the array with $key and $value -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question PHP - HTML
? echo hellobr; echo vivianebr; ? hth toby - Original Message - From: Viviane Hu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 26, 2004 2:13 PM Subject: [PHP] question PHP - HTML Hi, Je try to use PHP. Je wrote to this code ?php echo hello \n; echo viviane \n; ? I expect a print out like : hello viviane but the print out (IE) is hello viviane Could you help please thinks. Viviane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with $_POST
You can use a token to check if a form has been sent before... ? class formReload { var $tokenarray = '__token'; var $tokenname = '__token'; function createToken() { $tok = md5(uniqid(mytoken)); return sprintf(input type='hidden' name='%s' value='%s',$this-tokenname,htmlspecialchars($tok)); } function easyCheck() { $tok = $_REQUEST[$this-tokenname]; if (isset($_SESSION[$this-tokenarray][$tok])) { return false; } else { $_SESSION[$this-tokenarray][$tok] = true; return true; } } } ? hth toby - Original Message - From: Binay [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Reidar Solberg [EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 9:23 AM Subject: Re: [PHP] Problems with $_POST Hi What is the primary key in your tble? Using tht primary key check for duplicate entry... Theres no way u can change the posted data ... so even if u reset $_POST['submit'] after the insert operation is done, next time u refresh it will be set and hence will duplicate...so check for duplicate entries urself only based on primary key or unique values in ur table. Hope this helps Cheers Binay U wrote.. I have a FORM for entering data into a DB. I use: ... ... if ($_POST['submit'] == 'Register') { ... code for INSERT into DB. This works OK, but if I REFRESH the page, it duplicates the dataset in the table. How can I reset $_POST['submit'] so it don't make this happen? Rgds Reidar Solberg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorry the attachement was not received!! I put the codes here.
Go check your code for obvious errors before you post it on this list: $Random = 'Random' $result = mysql_query($query1) or die(Query error: . mysql_error()); Now spot the mistake. If you can't... tough luck. toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sorry the attachement was not received!! I put the codes here.
The error is not in that line... check the line before that one. Here, this might be of use... Copy and paste it: ; $result = mysql_query($query1) or die(Query error: . mysql_error()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Flash .swf outside webroot: width and height problems
Hey everybody, I am trying to display an .swf-file that is stored outside the webroot. Just sending the header and doing a readfile on the swf results in the swf being displayed with the maximum available width and height. Does anyone know a way of displaying Flash with its correct dimensions if it is stored outside the webroot? Your help is greatly appreciated. toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Flash .swf outside webroot: width and height problems
Thx for the fast response. Yes, I am doing that with the images... works fine. I also thought about using either an iframe or a div to control the size of the movie. It would have been nicer to be able to use a regular object tag, as it gives you more control over how the movie displayed. But I guess you can't write the tag and just do a PARAM NAME=movie VALUE=show.php?id=xy etc. and have the show.php output the header... May have to go for the div/iframe solution. If anyone can think of another way, I'd be happy to try it. Thank you, John. toby - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Toby Irmer [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 7:12 PM Subject: Re: [PHP] Flash .swf outside webroot: width and height problems From: Toby Irmer [EMAIL PROTECTED] I am trying to display an .swf-file that is stored outside the webroot. Just sending the header and doing a readfile on the swf results in the swf being displayed with the maximum available width and height. Does anyone know a way of displaying Flash with its correct dimensions if it is stored outside the webroot? Do you just have a flash.php file that sends the flash headers and data? If so, then there's probably not a way just using that method. You can embed it within a HTML page, though, maybe inside a div to control the size? div style=width:50%;height:50% embed src=flash.php?id=xx /div Obviously not the correct syntax b/c I don't know it, but you get the idea, I hope... This is the same method you'd control the height and width of a PHP generated image img src=pic.php?id=xx width=50 height=50 ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to search the database?
RTFM and stop sending messages to this list with a high priority. The questions you are asking are answered in the first 3 chapters of any good book about php. toby - Original Message - From: Radwan Aladdin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 19, 2004 9:13 AM Subject: [PHP] How to search the database? Hello.. I made my Login and registration pages and everything is okay.. but what I want now is to know how to make this : A PHP page for the administrator.. that has a TextBox (UserName).. he will enter a user name in it.. after that he will press the button (Activate).. Now by pressing that button the PHP page will search the database (A specified table) for that username, if it is exist then search his row for a field named (Activation) and then update its value into Activated.. but if this user is not exist in that table.. a message will apear for the administrator.. Waiting your replies guys ;-) Thanks in advance... Cheers.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Header Issues
Hi Larry, of course just having to give up sessions doesn't sound very attractive. I tried adding img=... to the url that calls the script. Only it didn't help. If you would be so kind as to post your code, maybe I will be able to find my error. If not, I will just have to live without the session_start, and pass the variables I need in the query string. It is not that you have to abolish sessions altogether. Just in the one tiny script that displays the image. toby - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Sunday, January 18, 2004 5:45 AM Subject: RE: [PHP] Image Header Issues Giving up sessions for one simple issue sounds a bit drastic. I'll dig up the header information I'm sending that the x.pdf addition helped me with and send them to you if you'd like. I can't see anything as strong/secure as sessions to manage authentication as well as a dozen other performance benefits. Larry. -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 11:30 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues OK, that's it. The session_start() is the issue. Unfortunately, the img=x.jpg didn't help. Now I've got to figure out some sorta security without using sessions. Thanks, for at least pointing me in the right direction. Now if we could figure out why this would be happening, that would be great. Bob - Original Message - From: Toby Irmer [EMAIL PROTECTED] To: Larry Brown [EMAIL PROTECTED]; Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 2:11 PM Subject: Re: [PHP] Image Header Issues I have the same problem. Strange: I have a session_start(); before the header... if I take that out, the image will download as a JPG... so maybe if you find a way to do things in this script without starting the session first... toby - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 6:32 PM Subject: RE: [PHP] Image Header Issues try adding showpicture.php?pid=111384img=x.jpg to the end even though you aren't using that variable, IE may see that the type is jpg here. I have this same problem/workaround in place right now for a script that wouldn't work with IE without it for downloading pdf. (pdf was generated on the fly) -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues Again, it is *not* that known issue. That's the very first thing I checked. If that were the issue, jpgs from other sources would also not save properly. But they do, as I've stated several times. Thanks, though. Bob - Original Message - From: Brian V Bonini [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED] Cc: PHP Lists [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 7:28 AM Subject: Re: [PHP] Image Header Issues This is a known issue with IE. And it is in their knowledge base. If I recall the fix is to clear the cache, cookies, and broken/corrupt objects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Drop down lists
if you say you don't know much, maybe you are looking for something like this ;) hth toby ? function formSelect($name, $options, $value) { echo select name=\$name\\n; foreach($options AS $key = $display) { echo option value=\$key\; if($value == $key) echo SELECTED; echo $display/option\n; } echo /select\n; } //get users from db $query = SELECT * FROM users; $result = mysql_query($query); while($line = mysql_fetch_array($result)) { $options[$line[id]] = $line[name]; } //write select formSelect(users, $options, $_REQUEST[users]); ?
Re: [PHP] Is this possible ?
One way: ? Function MyFunc() { if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\); $num = mysql_num_rows($sql); // I want to use this result outside this function. $returnsomething =blah blah; } return array($returnsomething, $num); } list($text, $numrows) = MyFunc(); ? hth toby - Original Message - From: Dave Carrera [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 18, 2004 11:22 AM Subject: [PHP] Is this possible ? Hi List, I have a function that makes a call to mysql based on certain vars. ---example Function MyFunc(){ if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $returnsomething =blah blah; } return $returnsomething; } And that all works fine no probs here but. I want to use a result somewhere in my script that is not returned by return. Let me show you... ---example Function MyFunc(){ if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $num = mysql_num_rows($sql); // I want to use this result outside this function. $returnsomething =blah blah; } return $returnsomething; } So $num contains a number that I want to use outside the function which is not covered by return. I know return stops a script and returns what I want it to return but how do I send out of the function the var I want. I have tried $GLOBAL[var]=$num; but that dont work, but I thought I would'nt anyway just tried it and yes I know I have to declare it inside my new function using global $var; to use it. So I ask is this achiveable or how can I do this. Thank you in advance Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Header Issues
I have the same problem. Strange: I have a session_start(); before the header... if I take that out, the image will download as a JPG... so maybe if you find a way to do things in this script without starting the session first... toby - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 6:32 PM Subject: RE: [PHP] Image Header Issues try adding showpicture.php?pid=111384img=x.jpg to the end even though you aren't using that variable, IE may see that the type is jpg here. I have this same problem/workaround in place right now for a script that wouldn't work with IE without it for downloading pdf. (pdf was generated on the fly) -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues Again, it is *not* that known issue. That's the very first thing I checked. If that were the issue, jpgs from other sources would also not save properly. But they do, as I've stated several times. Thanks, though. Bob - Original Message - From: Brian V Bonini [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED] Cc: PHP Lists [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 7:28 AM Subject: Re: [PHP] Image Header Issues This is a known issue with IE. And it is in their knowledge base. If I recall the fix is to clear the cache, cookies, and broken/corrupt objects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thumbnails in database
http://www.sum-it.nl/en200319.php3 quote Create thumbnail a.. Cropping and scaling a photo is surprisingly easy with PHP. b.. Unfortunately the functions imagecreatetruecolor() and imagecopyresampled() exist only since PHP 4.0.6 using GD 2.0.1. Older PHP version supports the functions imagecreate() and imagecopyresized(), which are good enough to do the job. c.. It is possible to generate a thumbnail on the fly, in RAM memory, using ob_start() and ob_end_clean(). That saves unnecessary fumbling around with temporary files. d.. ... /quote hth toby I am storing some images in a database. No problems there. But how can I create a thumbnail do store in the db also without having to create the thumbnail image on the file system first? Kind regards Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regexp with mysql
i guess SELECT * FROM `table` WHERE ids REGEXP ',2,|^2,|,2$' should do it... hth toby - Original Message - From: Lowell Allen [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 4:39 PM Subject: Re: [PHP] regexp with mysql i hope someone can help it should be easy but i still don't get it. i have a field which has numbers seperated via a comma for example 1,2,3,12,14,23,51 now if i was to do a search for a the rows that has '2' in it i do SELECT * FROM table WHERE ids REGEXP 2 will it show fields that has 12 22 23 etc...?? or just 2 Yes. I think you need something like: $sql = SELECT * FROM table WHERE . ids REGEXP '2' AND ids NOT REGEXP '([1-9]2)|(2[0-9])'; But I don't profess to much knowledge of regular expressions. Check the MySQL documentation. I saw something about REGEXP there recently. Also, there's a MySQL discussion list at http://lists.mysql.com/. HTH -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[4]: [PHP] Re: jpeg Uploader issue
file: show.php ? header(Content-type: image/jpeg); readfile(/path/to/file/.$_GET[filename]); ? in your files: img src=show.php?filename=myfile.jpg ... or something like that ;) hth toby - Original Message - From: Mike R [EMAIL PROTECTED] To: Richard Davey [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 5:03 PM Subject: RE: Re[4]: [PHP] Re: jpeg Uploader issue Since the link goes directly to the picture, how do I apply the header first? Should I apply it in the html page the link is on? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[4]: [PHP] Re: jpeg Uploader issue
that was explaining the prinicple. of course you wouldn't do it like this, but pass an id to identify. you could also send an encryption key... - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Toby Irmer [EMAIL PROTECTED]; Mike R [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 5:15 PM Subject: Re: Re[4]: [PHP] Re: jpeg Uploader issue From: Toby Irmer [EMAIL PROTECTED] file: show.php ? header(Content-type: image/jpeg); readfile(/path/to/file/.$_GET[filename]); ? in your files: img src=show.php?filename=myfile.jpg ... or something like that ;) Are you trying to get him to compromise his server? I'm sure that's just a simple suggestion, but it's horrible. This will allow a user to request the contents of any file PHP has access to read... ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi-table select?
Try SELECT teams.*, divisions.id AS divisonid, divisions.name AS divisionname FROM teams LEFT JOIN divisions ON teams.divisonID = divisions.divisionID if the ids are the same you can actually also write ON teams.divisonID and omit = divisions.divisionID ... I think. hth toby I'm looking for a good way to do the following: I have two tables, one named teams and one named divisions. Divisions relates divisionID to the name of the division (division_name). In teams I have the divisionID stored along with the team_name. [BG info: teams can be relegated or promoted so it's easier for me to store the divID in the teams table] I'd like to populate a drop down menu with the team_name and division_name and was wondering if I can do some kind of select statement that will get all the info at once with the following details on the two tables: mysql select * from teams; ++---+-++--++-+- -+-+---+---+ | teamID | team_name | coachID | divisionID | paid | pmnt_notes | win | loss | tie | goals_for | goals_against | ++---+-++--++-+- -+-+---+---+ | 1 | Metro | 0 | 1 | n| NULL | 0 | 0 | 0 | 0 | 0 | ++---+-++--++-+- -+-+---+---+ 1 row in set (0.00 sec) mysql select * from divisions; ++--+ | divisionID | division_name| ++--+ | 1 | Premier | | 2 | Classic | | 3 | Recreational 7v7 | ++--+ 3 rows in set (0.00 sec) Thanks in advance! Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] multi-table select?
i must overlooked that... no wonder my pages all take ages to load *g* ;) ;) - Original Message - From: Martin Towell [EMAIL PROTECTED] To: 'Kirk Babb' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, January 14, 2004 11:52 PM Subject: RE: [PHP] multi-table select? This is a basic table join: select * from teams, divisions where teams.divisionID = divisions.divisionID -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php