[PHP] A more sane problem description
Sorry, The last post I made was fairly incomprehensible. I'm trying to a) edit information which is already in an intersection table, while b) allowing the user to add new information to the intersection table The information in it is pulled from the table media_art and I grab the media_art_id, media_id and art_id. If a media_id is associated with an art_id in the table, I grab all three and make the checkbox for that media_id checked. I need to understand how I can make it so that a) if the user UNchecks the box, then the row containing that media_id will be deleted. AND b) if the user checks a new box, a new row will be inserted into the media_art table containing the media_id and the art_id. This is so far beyond my comprehension it's not even funny. This is what I have so far - thank you in advance for the help.: //If editrecord hasn't been set, but selectcartoon has, get the cartoon's recordset //This is just to get the title for display purposes $query = "SELECT art_title FROM art WHERE art_id='$art_id'"; //end $media_query = "SELECT media.media_id, media.media_name, media_art.art_id, media_art.media_art_id FROM media LEFT JOIN media_art ON media_art.media_id=media.media_id AND media_art.art_id='$art_id'"; //These $art results are just to get the title for display purposes $art_result = mysql_query($query); $art_rows = mysql_fetch_assoc($art_result); //end $media_result = mysql_query($media_query); $checkbox_media = array (); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = "value='{$media_rows['media_id']}' "; if ($media_rows['art_id'] === $art_id) { $checkbox_media[] .= "checked media_art_id='{$media_rows['media_art_id']}'"; } $checkbox_media[] .= "/>{$media_rows['media_name']} "; } ?> Main Menu Add A Record Edit A Record Delete A Record name="editrecordMedia"> Choose media related to $art_rows['art_title'];?> Media: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Image upload form
Nadim Attari wrote: http://www.php-help.net/sources-php/image.upload.function.353.html Thanks, Nadim, I'm sure that is a great script. I am really trying to learn how it's working, so I'm trying to stay away from pre-rolled stuff as much as I can and beg for the mercy of the list in building these simple scripts. Believe it or not I'm actually improving pretty fast (despite scriptorial evidence to the contrary on this list)! Thanks again, JJ Regards, Nadim Attari Alienworkers.com Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ Cartoon: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Those checkboxes again
hi, I'm severely frustrated and perhaps you can help with what I have done wrong. The checkboxes I use to populate an intersection table work to add the records, and now I am trying to update them. It's almost there but producing some unexpected results when the form is submitted: the idea is that it displays the checkboxes as pre-selected if they're associated with the art_id in the intersection table. They're now appearing as all unselected. Any help is appreciated. //If editrecord hasn't been set, but selectcartoon has, get the cartoon's recordset //This is just to get the title for display purposes $query = "SELECT art_title FROM art WHERE art_id='$art_id'"; //end $media_query = "SELECT media.media_id, media.media_name, media_art.art_id FROM media LEFT JOIN media_art ON media_art.media_id=media.media_id AND media_art.art_id='$art_id'"; //These $art results are just to get the title for display purposes $art_result = mysql_query($query); $art_rows = mysql_fetch_assoc($art_result); //end $media_result = mysql_query($media_query); $checkbox_media = array (); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = "value='{$media_rows['media_id']}' "; if ($media_rows['art_id'] === $art_id) { $checkbox_media[] .= "checked "; } $checkbox_media[] .= "/>{$media_rows['media_name']} "; } ?> Main Menu Add A Record Edit A Record Delete A Record name="editrecordMedia"> Choose media related to $art_rows['art_title'];?> Media: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkboxes From Intersection Redux
That did it exactly, Kristen Thanks so much for the help! (and sorry for sending this to you and not the list the first time!) JJ Kristen G. Thorson wrote: Hopefully I understand your question correctly. You have this SQL: $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; And "For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked." The problem is, the SQL you have is not returning every media_id (because you're grouping on media_name). I wonder if you truly need to group on media_name. I would assume that media_name is unique in the media table. If it is not, then you need to rethink your table structure. If you group on media_name and there are duplicate media_names, you can have data like this: media_id media_name 4Name1 16 Name1 Grouping by media_name as in your query above will produce a line like: media_idmedia_name 4 Name1 You then output this to check boxes and use those to set the relation to art and media. But what's the difference between media_id 4 and media_id 16? In this case, if the database always returns the group by this way, you would never set the media_id 16. If there is a distinct difference between media_names with different ids, then I think you probably need to make some changes. That being said, if you do not need to group by media_name, then you can simply do something like this: select media.media_id, media.media_name, media_art.art_id, from media left join media_art on media_art.media_id=media.media_id and media_art.art_id=$cartoon['art_id'] Which would return a table like this if $cartoon['art_id']=15: media_idmedia_name art_id 4 Name1 NULL 8 Name2 15 12 Name3 NULL 16 Name4 15 17 Name5 NULL 18 Name6 NULL You could then test the output of art_id: $checkbox_media[] = "value='{$media_rows['media_id']}' ".(rows['art_id']==$cartoon['art_id']?" checked":"")."/>{$media_rows['media_name']} "; HTH kgt Jack Jackson wrote: Hi, With your help I got some checkboxes generated the other day for a form. I would like some help getting a similar problem solved. I am now making a form to edit db entries made in the previous form. I have three tables involved: art, media and media_art. I need to show checkboxes for all available media. For the chosen record ($cartoon, which equals an art_id selected by the user) I must also go into the media_art table, and where the selected art ID has a corresponding media_id, display that media_id's media_name as a checked box. TABLE media: media_id media_name 1 ink 2 pencil 3 watercolor 4 gauche 5 watercolor pencil To find out the art_id of the chosen record, the user is selecting from a dropdown box in the form. I'm doing queries like this to make a publisher dropdown in a similar vein: $query = "SELECT * FROM art WHERE art.art_id = '$cartoon'"; $publisher_query = 'SELECT * FROM publisher'; $result = mysql_query($query); $publisher_result = mysql_query($publisher_query); while ($rows = mysql_fetch_assoc($result)){ $publisher_dropdown = ''; while ($pub = mysql_fetch_assoc($publisher_result)){ $publisher_dropdown .= 'I now need to formulate how to make the checkboxes similarly. The original setup to make the checkboxes was : $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; $media_result = mysql_query($media_query); $checkbox_media = array (); $media_types = array(); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = "name='media_types[]' value='{$media_rows['media_id']}' />{$media_rows['media_name']} "; } Those which were checked were inserted into media_art thusly: media_id art_id 31 41 51 What I want to do is say "For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. How can I do this? Thanks very much in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload form
Yes, Jason, Those did it! Thanks so much for the help! Jason Wong wrote: On Thursday 16 June 2005 00:38, Jack Jackson wrote: //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; $_FILES['userfile']['type'] contains the mime-type that is provided by the browser and will vary depending on browser and hence extremely unreliable. In fact the returned value from getimagesize() already has mime-type info, use that instead. $newfile = md5(date("l-F-j-Y i:s")).'.'.$pext; $image_file = $uploaddir . $newfile; // print_r($newfile); // print_r($image_file); if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } The file pointed to by $newfile doesn't exist. You need to move ... $local_file = $_FILES['userfile']['tmp_name']; ... $localfile -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload form
Richard Davey wrote: Hello Jack, Wednesday, June 15, 2005, 5:38:11 PM, you wrote: JJ> newfile returns: 0fdae2e9e6aa43f067a9dd780a5a36a6.jpg JJ> image_file returns: JJ> images/jpg/test/0fdae2e9e6aa43f067a9dd780a5a36a6.jpg JJ> images/jpg/test is set to 777 but I still get (Could not move file to JJ> destination). What am I missing? Thanks! This directory needs to be absolute - i.e. the COMPLETE path: /usr/home/jack/images/jpg/test Thanks, Richard, Still no soap: I changed $uploaddir = "/home/jack/public_html/amyportnoy/images/jpg/test"; and $image_file = $uploaddir . '/' . $newfile; Now $image_file returns the valid path of: /home/jack/public_html/amyportnoy/images/jpg/test/09992d5379dd0a0cf376aab82241a66d.jpg but it still does not copy the file to that location. However the error has changed: if (is_uploaded_file($newfile)) { if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } else { echo 'image file uploaded.'; } } else { echo 'Problem with ' . $newfile; } } And I'm getting an error message of Problem with 6a26590fb45fd86e58954ba91d5580a4.jpg So i guess it's not uploading for some reason? Here's the whole thing I have so far once again, with several mods: 0) { echo 'Problem: '; switch ($_FILES['userfile']['error']) { case 1: echo 'File exceeds maximum upload size limit (upload_max_filesize).'; break; case 2: echo 'File exceeds maximum size limit (max_file_size).'; break; case 3: echo 'File was only partially uploaded.'; break; case 4: echo 'No file was uploaded.'; break; }//end switch }//end if error >0 $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case "image/jpeg": $pext = 'jpg'; break; case "image/tiff": $pext = 'tif'; break; default: echo "The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable."; } } else { echo "The file you are trying to upload is not a valid image file"; } $newfile = md5(date("l-F-j-Y i:s")).'.'.$pext; $image_file = $uploaddir . '/' . $newfile; // print_r($newfile); print_r($image_file); if (is_uploaded_file($newfile)) { if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } else { echo 'image file ' . $newfile . 'uploaded.'; } } else { echo 'Problem with ' . $newfile; } } ?> Cartoon: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload form
Okay, I started seeing some of my mistakes. I am still having a great deal of trouble: newfile returns: 0fdae2e9e6aa43f067a9dd780a5a36a6.jpg image_file returns: images/jpg/test/0fdae2e9e6aa43f067a9dd780a5a36a6.jpg images/jpg/test is set to 777 but I still get (Could not move file to destination). What am I missing? Thanks! //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case "image/jpeg": $pext = 'jpg'; break; case "image/tiff": $pext = 'tif'; break; default: echo "The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable."; } } else { echo "The file you are trying to upload is not a valid image file"; } $newfile = md5(date("l-F-j-Y i:s")).'.'.$pext; $image_file = $uploaddir . $newfile; // print_r($newfile); // print_r($image_file); if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } else { echo 'image file uploaded.'; } } ?> Cartoon: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image upload form
Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case "image/jpeg": $pext = 'jpg'; break; case "image/tiff": $pext = 'tif'; break; default: echo "The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable."; } } else { echo "The file you are trying to upload is not a valid image file"; } $main_image = md5(date("l-F-j-Y i:s")).'.'.$pext; move_uploaded_file($main_image,$uploaddir); } ?> Cartoon: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing Help
Jochem, I cannot believe you spent this much time helping me with this. I really appreciate it. I will go through and make ALL those changes. I am grateful. Especially the changes which cleaned up jibberish and tightened from several lines to one - really! Thank you thank you thank you! --JJ Jochem Maas wrote: jack jackson wrote: Hello, Recently with the help of several of you I got a script working. It's complex, I'm still new, some parts of it came from other authors and I adapted it, and generally despite the fact that it seems to work perfectly at this point, I am certain that there is bloat, repetition and simply useless crap. I'd like to know if anyone can have a look and help me optimize what I have. For example, there are several mysql queries - would it be possible to combine them somehow? I use the image upload section twice because I couldn't figure out how to make it work using different vars within the same section. That kind of newbie stuff. The code is here: http://hashphp.org/pastebin.php?pid=3701 # its allows you to reuse a single $result var (as well as being better in other ways) # $dropdown_publishers = ''; # while ($rows = mysql_fetch_assoc($result)){ # $dropdown_publishers .= '' . htmlentities($rows['publisher_name']); # } # $dropdown_publishers .= ''; here is a candidate for a function: buildOptionList($name, $result, $valKey, $nameKey) { while ($row = mysql_fetch_assoc($result)) { $dropdown[] = '' . htmlentities($row[$nameKey], ENT_QUOTES) . ''; // options have closing tags } return '' . join('',$dropdown) . ''; } # # # $dropdown_subject = ''; # while ($rows = mysql_fetch_assoc($subject_result)){ ^- white space? # $dropdown_subject .= '' . htmlentities($rows['subject_name']); # } # $dropdown_subject .= ''; # # $dropdown_series = 'Select A Series'; # while ($rows = mysql_fetch_assoc($series_result)){ # $dropdown_series .= '' . htmlentities($rows['series_name']); # } # $dropdown_series .= ''; # # $checkbox_media = array (); # $media_types = array(); # while ($media_rows = mysql_fetch_assoc($media_result)){ # $checkbox_media[] = "value='{$media_rows['media_id']}' />{$media_rows['media_name']} "; # } # # ///IMAGE SECTION - MAIN IMAGE (IMAGE UPLOAD SCRIPT COPYRIGHT INFO IN CFG FILE) # ///THIS SECTION Copyright (c) 2000 Marcus Kazmierczak, [EMAIL PROTECTED] # if ($REQUEST_METHOD == "POST") # { # $uploaddir = "images/jpg"; # # /*== checks the extension for .jpg or .tiff ==*/ # $pext = getFileExtension($imgfile_name); TURN OFF register_globals, and access the $_FILES array instead. # # $pext = strtolower($pext); # # # //If main image don't match extentions # if (empty($POST['imgfile'])) { # $errors[] = 'Please select an image. This is sort of the whole point, yes?'; your error checking for whether the image was actually uploaded is non-existent, check the manual (+usernotes) for guidelines on how to check whether anything made it thru. # } # # if (($pext != "jpg") && ($pext != "jpeg") && ($pext != "tif") && ($pext != "tiff")) # { or maybe: $validExtensions = array("jpg","jpeg","tif","tiff"); if (!in_array($pext, $validExtensions)) { /* bad */ } /* having said that the file extension doesn't say anything - better to use the info returned by imagegetsize() ... read this: http://nl2.php.net/manual/en/function.getimagesize.php */ # print "DOH!That's not a valid image extension. "; # print "You are only permitted to upload JPG, JPEG, tif or TIFF images with the extension .jpg, .jpeg, .tif or .tiff ONLY/>"; # print "See, now, that last thing you tried to upload? It ended in $pext. A review: # $pext != .jpg # $pext != .jpeg # $pext != .tif # $pext != .tiff # \n"; # } maybe a bit condescending, besides if the user can't grok image files then maybe its silly to assume the he/she understands '!=', I guess it depends on your audience. # # /*== setup final file location and name ==*/ # /*== rename file to md5 of image name ==*/ # # $secondary_imgname = date("l-F-j-Y i:s"); # $final_imgname = md5($secondary_imgname) . ".$pext"; # # $newfile = $uploaddir . "/$final_imgname"; # why not just...? (spare a var or 2): $newfile = $uploaddir.'/'.md5(date("l-F-j-Y i:s")).'.'.$
[PHP] Checkboxes From Intersection Redux
Hi, With your help I got some checkboxes generated the other day for a form. I would like some help getting a similar problem solved. I am now making a form to edit db entries made in the previous form. I have three tables involved: art, media and media_art. I need to show checkboxes for all available media. For the chosen record ($cartoon, which equals an art_id selected by the user) I must also go into the media_art table, and where the selected art ID has a corresponding media_id, display that media_id's media_name as a checked box. TABLE media: media_id media_name 1 ink 2 pencil 3 watercolor 4 gauche 5 watercolor pencil To find out the art_id of the chosen record, the user is selecting from a dropdown box in the form. I'm doing queries like this to make a publisher dropdown in a similar vein: $query = "SELECT * FROM art WHERE art.art_id = '$cartoon'"; $publisher_query = 'SELECT * FROM publisher'; $result = mysql_query($query); $publisher_result = mysql_query($publisher_query); while ($rows = mysql_fetch_assoc($result)){ $publisher_dropdown = ''; while ($pub = mysql_fetch_assoc($publisher_result)){ $publisher_dropdown .= 'I now need to formulate how to make the checkboxes similarly. The original setup to make the checkboxes was : $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; $media_result = mysql_query($media_query); $checkbox_media = array (); $media_types = array(); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = "value='{$media_rows['media_id']}' />{$media_rows['media_name']} "; } Those which were checked were inserted into media_art thusly: media_id art_id 31 41 51 What I want to do is say "For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. How can I do this? Thanks very much in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Optimizing Help
Thanks, Chris, I see what you're getting at. I'm not sure I understand what you mean about looping through the array in the area you specified- isn't that just the definitions of the vars? Or is that what you meant and I'm missing the point!!? On 6/13/05, Chris Ramsay <[EMAIL PROTECTED]> wrote: > Hey there Jackson, > > The first thing I would consider would be to see if you can classify > the code into chunks that do a certain job, and then rewrite them as > functions. I would also consider looping through arrays for repetitive > jobs (lines 258 -> 270 for example). > > Down the line you could consider the use of classes, your own or ready > made - such as the ever useful PEAR (http://pear.php.net). I > personally found that the greatest saver of time to be the re-use of > code that I know works well for given situations. > > HTH > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Optimizing Help
Hello, Recently with the help of several of you I got a script working. It's complex, I'm still new, some parts of it came from other authors and I adapted it, and generally despite the fact that it seems to work perfectly at this point, I am certain that there is bloat, repetition and simply useless crap. I'd like to know if anyone can have a look and help me optimize what I have. For example, there are several mysql queries - would it be possible to combine them somehow? I use the image upload section twice because I couldn't figure out how to make it work using different vars within the same section. That kind of newbie stuff. The code is here: http://hashphp.org/pastebin.php?pid=3701 Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fwrite/fopen
fwrite failed for "quota disc exceeded", so I end up with empty file. the algorithm is something like : if (! $fp = @fopen($config['pagecachedir'].$path.$tmp_value,'wb')) { $errorLog .= "Writing problem for ".$config['pagecachedir']. "$path$tmp_value!\n"; } else { $txt_length = strlen($txt); if (@fwrite($fp,$txt,$txt_length) != $txt_length) { $errorLog .= "Writing problem in file !\n"; @fclose($fp); @unlink($config['pagecachedir'].$path.$tmp_value); } else { //everything is OK @fclose($fp); } On 6/11/05, Richard Lynch <[EMAIL PROTECTED]> wrote: > > You would probably have to fclose it before you can unlink it, and if it's > fargled enough that fwrite failed, you probably can't fclose it > successfully... > > Your best bet would be to put the filename into a database table, then run > a cron job that deletes all the files in that table, and only takes them > out of the table if they are successfully deleted. > > Course, you then want to be sure you have UNIQUE filenames so you don't > delete a good file later. > > > > On Fri, June 10, 2005 4:03 pm, Mister Jack said: > > Hi, > > > > I having a problem at the moment, I open a file, try to write in it, > > and then remove the file if the write goes wrong (if write count != of > > my initial buffer length). But I still get some empty file (and then a > > blank page). Could possibly fopen (with a 'wb' flag, and under freebsd > > 4.11) failed but still create that empty file ? > > > > Where could I get more info on the behavior of fopen/fwrite ? > > > > Thanks for your help. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fwrite/fopen
Hi, I having a problem at the moment, I open a file, try to write in it, and then remove the file if the write goes wrong (if write count != of my initial buffer length). But I still get some empty file (and then a blank page). Could possibly fopen (with a 'wb' flag, and under freebsd 4.11) failed but still create that empty file ? Where could I get more info on the behavior of fopen/fwrite ? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting checkboxes as array
Whoops. I must be botching this syntax because this is printing ",,0,," as the query: All the first part of the query works and inserts records into the database, and it's when I try to get mysql_insert_id () that I seem to run into trouble. Ah. ave I not yet run the first query? The part of the code that actually runs it was given to me in a class and I don't quite understand how it's suppose to be working ... Thanks in advance: $trimblog = (trim($_POST['blog'])); $blog = (nl2br($trimblog)); $image = mysql_real_escape_string($final_imgname); $image_thb = mysql_real_escape_string($final_thb_filename); $pubwidth = mysql_real_escape_string(trim($_POST['art_width'])); $pubheight = mysql_real_escape_string(trim($_POST['art_height'])); $origwidth = mysql_real_escape_string(trim($_POST['orig_width'])); $origheight = mysql_real_escape_string(trim($_POST['orig_height'])); $publisher = mysql_real_escape_string(trim($_POST['publisher'])); $series = mysql_real_escape_string(trim($_POST['series'])); $subject = mysql_real_escape_string(trim($_POST['subject'])); $title = mysql_real_escape_string(trim($_POST['title'])); $caption = mysql_real_escape_string(trim($_POST['art_caption'])); $blog = mysql_real_escape_string($blog); $keywords = mysql_real_escape_string(trim($_POST['keywords'])); $query = "INSERT INTO art (art_id,art_thumbnail, art_image, art_width, art_height, orig_width, orig_height, art_pub_date, publisher_id, art_creation_date, series_id, subject_id, art_title, art_caption, art_keywords, art_blog) VALUES ('','" . $image_thb . "','" . $image . "','" . $pubwidth . "','" . $pubheight . "','" . $origwidth . "','" . $origheight . "','" . $pubdate . "','" . $publisher . "','" . $orig_date . "','" . $series . "','" . $subject . "','" . $title . "','" . $caption . "','" . $keywords . "','" . $blog . "')"; $art_id = mysql_insert_id(); foreach ($media_types[] as $type) { $query .= "INSERT INTO media_art (media_art_id,media_id, art_id) VALUES ('','" . $type . "','" . $art_id . "')"; // perform query here } if (!mysql_query($query) || mysql_error($query)!= ''){ $errMsg = mysql_error($query); trigger_error("Problem with addrecord: $query\r\n$errMsg\r\n", E_USER_ERROR); } else { $msgText = 'Your record was saved!'; } On 6/9/05, Richard Davey <[EMAIL PROTECTED]> wrote: > Hello jack, > > Friday, June 10, 2005, 2:16:06 AM, you wrote: > > jj> $query = "INSERT INTO media_art (media_art_id,art_id, media_id) > jj> VALUES ('','" . $art_id . "','" . $media_types[2]. "')"; > > jj> repeat as many or few times as possible to account for the number of > jj> checked boxes, such as > > One way: > > for ($i = 0; $i < count($media_types); $++) > { > $query = "INSERT INTO media_art (media_art_id,art_id, media_id) > VALUES ('','$art_id','{$media_types[$i]}')"; > // perform query here > } > > Another: > > foreach ($media_types as $type) > { > $query = "INSERT INTO media_art (media_art_id,art_id, media_id) > VALUES ('','$art_id','$type')"; > // perform query here > } > > Best regards, > > Richard Davey > -- > http://www.launchcode.co.uk - PHP Development Services > "I do not fear computers. I fear the lack of them." - Isaac Asimov > > -- > 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] Getting checkboxes as array
Thank you Sebastian! Saved me some hell there!! On 6/9/05, Sebastian <[EMAIL PROTECTED]> wrote: > Don't forget to mention that even if you don't select a checkbox it will > still add a empty record to the db.. i know for sure the foreach loop > will add a record even if a box is not check, so you have to check its > actually set before you start inserting. > > Richard Davey wrote: > > >Hello jack, > > > >Friday, June 10, 2005, 2:16:06 AM, you wrote: > > > >jj> $query = "INSERT INTO media_art (media_art_id,art_id, media_id) > >jj> VALUES ('','" . $art_id . "','" . $media_types[2]. "')"; > > > >jj> repeat as many or few times as possible to account for the number of > >jj> checked boxes, such as > > > >One way: > > > >for ($i = 0; $i < count($media_types); $++) > >{ > >$query = "INSERT INTO media_art (media_art_id,art_id, media_id) > >VALUES ('','$art_id','{$media_types[$i]}')"; > >// perform query here > >} > > > >Another: > > > >foreach ($media_types as $type) > >{ > >$query = "INSERT INTO media_art (media_art_id,art_id, media_id) > >VALUES ('','$art_id','$type')"; > >// perform query here > >} > > > >Best regards, > > > >Richard Davey > > > > > > -- > 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] Getting checkboxes as array
HI I have a form which pulls values from the db, and thanks to help from the irc chat, hopefully makes any checkboxes which are selected part of an array to be gotten in post: while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = "{$media_rows['media_name']} "; } I'd like to now add the value of any checked box to an intersection table based on my last question to the list: $art_id = mysql_insert_id(); What I'd like to end up with is something which for each value in media_types[] create a New row in the intersection table (media_art) However how can I make this: $query = "INSERT INTO media_art (media_art_id,art_id, media_id) VALUES ('','" . $art_id . "','" . $media_types[2]. "')"; repeat as many or few times as possible to account for the number of checked boxes, such as $art_id $media_types[5] $art_id $media_types[9] etc I suspect it's something to do with the foreach but I'm stuck in figuring it out. Thanks in advance! $media_types[] = ($_POST['media_types[]']); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Three queries. One Form.
Thanks for this Richard! On 6/9/05, Richard Davey <[EMAIL PROTECTED]> wrote: > Hello jack, > > Friday, June 10, 2005, 12:05:35 AM, you wrote: > > jj> I am trying to make one form on a single page insert info into three > jj> tables; query 1 creates an art_id (auto-increment) for the newly > jj> created row in table art; > > jj> query2 creates a media_id in table media. > > jj> Then I need to get the art_id and media_id created by the first two > jj> queries to insert into an intersection table as query three. > > Assuming MySQL - just use 2 insert statements and after each one get > the last_insert_id. Once you've got both of those you can perform your > third and final insert using both of those values. > > Best regards, > > Richard Davey > -- > http://www.launchcode.co.uk - PHP Development Services > "I do not fear computers. I fear the lack of them." - Isaac Asimov > > -- > 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] Three queries. One Form.
On 6/9/05, Matt Babineau <[EMAIL PROTECTED]> wrote: > Well after the first query you could do this: > > $art_id = mysql_insert_id(); > > There is your new unique art_id you just created. > > Do this for the next table, the do the insert on your 3rd table. Thanks, Matt! > > > Matt Babineau > Criticalcode > w: http://www.criticalcode.com > p: 858.733.0160 > e: [EMAIL PROTECTED] > > -Original Message- > From: jack jackson [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 09, 2005 4:06 PM > To: php-general@lists.php.net > Subject: [PHP] Three queries. One Form. > > Hi, > I am trying to make one form on a single page insert info into three tables; > query 1 creates an art_id (auto-increment) for the newly created row in > table art; > > query2 creates a media_id in table media. > > Then I need to get the art_id and media_id created by the first two queries > to insert into an intersection table as query three. > > Must I run an intermediate query to get the ids, and assign it to vars? What > would it even look like? > > Thanks in advance, > > -- > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Three queries. One Form.
Hi, I am trying to make one form on a single page insert info into three tables; query 1 creates an art_id (auto-increment) for the newly created row in table art; query2 creates a media_id in table media. Then I need to get the art_id and media_id created by the first two queries to insert into an intersection table as query three. Must I run an intermediate query to get the ids, and assign it to vars? What would it even look like? Thanks in advance, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beautiful HTML Invoice -> Prints like crap! I need some suggestions!
Matt Babineau wrote: >Hi all - > >I've got a great html invoice that prints like crap because of my user of >background images and foreground images. Does anyone have any good >suggestions other than turn on images in IE to get this thing to print the >graphics? Is there a good way I could convert the HTML view to a JPG? I'm on >a linux box and have php 4.3.10. > >Thanks for the help! > >Matt Babineau >Criticalcode >w: http://www.criticalcode.com >p: 858.733.0160 >e: [EMAIL PROTECTED] > > > > Sorry, more helpful:http://us4.php.net/pdf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beautiful HTML Invoice -> Prints like crap! I need some suggestions!
Matt Babineau wrote: >Hi all - > >I've got a great html invoice that prints like crap because of my user of >background images and foreground images. Does anyone have any good >suggestions other than turn on images in IE to get this thing to print the >graphics? Is there a good way I could convert the HTML view to a JPG? I'm on >a linux box and have php 4.3.10. > >Thanks for the help! > >Matt Babineau >Criticalcode >w: http://www.criticalcode.com >p: 858.733.0160 >e: [EMAIL PROTECTED] > > > > Make it a pdf? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Implode? Explode?
Brent Baisley wrote: You're close, but you need to group your data on the series_id first. You can do that by looping through your array and creating another array using series_id as the array key. You'll end up with a list of arrays named after the series_id. foreach( $result_set as $result_item ) { //Add an array item to the series_id slot of the grouped_result array $grouped_result[ $result_item['series_id'] ][]= array('id'=>$result_items['art_id'], 'title'=>$result_item['art_title']); } That did the trick, Brent. Thanks so much for this useful information. Now you have your data grouped by series_id. Each item of the grouped_result array will contain one or more arrays which contain the art_id and art_title. If you are not familiar with multidimensional arrays, this may be a little confusing. A little is right! But tanks for the intro to multi-dimensional arrays! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Implode? Explode?
Hi all, I'm trying to fetch similar things - in this case, rows which share a series ID no - and bring them into an array and display them grouped by what makes them similar (in this case, series id). I looked at implode and explode which seem wrong for this - the only separator I can see is that they're each in a table cell. The result of my query returns something like: art_id series_id art_titleseries_name 2 1 Weddings 2004Summer Special 4 1 Summer In The City Summer Special 5 2 Bags of NY Op-Art 7 2 Dogs of NY Op-Art I'd like to create a list of links to each art_id grouped together as series, href code obviously not complete but demonstrative: Summer Special Weddings 2004 | Summer In The City Op-Art Bags of NY | Dogs of NY ? Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] linux php editor
Clive Zagno wrote: what php GUI editors do you recommend. Ive used bluefish before, any other recommendations, thanks clive I love Jedit http://www.jedit.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through an array problem
If my last post read (and I see that it did) that I was defending myself as opposed to falling ALL OVER my sword, I apologize: allow me to be clear: No, you're all correct and M. Sokolewicz doubly so: I had unintentionally selected fields from the wrong table for no reason other than lack of sleep coupled with lack of experience and a desperation to try to understand The problem was that I was pulling data in a manner both useless and complex from a thoroughly unnecessary table (I could tell you all why but you'll all just laugh at me more) I am grateful for all the help everyone has offered up to now and hope I did not offend - I was trying in my last post to indicate that I was an idiot, and it appears I've come off as arrogant. I promise it was not my intent! Jochem Maas wrote: Jack Jackson wrote: M. Sokolewicz wrote: Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. by that statement I ment the exact same thing Jochem ment in his 2nd part; I have NO idea why you're selecting *ANYTHING* from the arts table... it's *useless* if you don't need the data... Er, yes, that was what I meant: I had unintentionally included that bit.Thank you for your help. Er, Jack - your original query was: SELECT art.art_id,art.publisher_id,publisher.publisher_name, FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id which is a selection on the art table... ( with a typo) if you did: SELECT art.publisher_id,publisher.publisher_name FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id nothing would change. and if you did: SELECT publisher.publisher_id,publisher.publisher_name publisher i.e. not 'unintentionally' selecting from the arts table. then you would not have had a problem in the first place?! I think I'm missing something ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through an array problem
Ah. I just remembered one reason I had done it involving the art_id field: I have more publishers in the db than are currently associated with artworks. I don't want a publisher to appear unless there is at least one image associated with it. So I did this to avoid having people see a link to the Sneezy Acres Tribune only to arrive at the next page and see, "There are no images associated with this publisher." Jochem Maas wrote: Jack Jackson wrote: M. Sokolewicz wrote: Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. by that statement I ment the exact same thing Jochem ment in his 2nd part; I have NO idea why you're selecting *ANYTHING* from the arts table... it's *useless* if you don't need the data... Er, yes, that was what I meant: I had unintentionally included that bit.Thank you for your help. Er, Jack - your original query was: SELECT art.art_id,art.publisher_id,publisher.publisher_name, FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id which is a selection on the art table... ( with a typo) if you did: SELECT art.publisher_id,publisher.publisher_name FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id nothing would change. and if you did: SELECT publisher.publisher_id,publisher.publisher_name publisher i.e. not 'unintentionally' selecting from the arts table. then you would not have had a problem in the first place?! I think I'm missing something ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through an array problem
Forgive me if this comes twice: my ISP had a service blackout for three hours and I don't know what went: If my last post read (and I see that it did) that I was defending myself as opposed to falling ALL OVER my sword, I apologize: allow me to be clear: No, you're all correct and M. Sokolewicz doubly so: I had unintentionally selected fields from the wrong table for no reason other than lack of sleep coupled with lack of experience and a desperation to try to understand The problem was that I was pulling data in a manner both useless and complex from a thoroughly unnecessary table (I could tell you all why but you'll all just laugh at me more) I am grateful for all the help everyone has offered up to now and hope I did not offend - I was trying in my last post to indicate that I was an idiot, and it appears I've come off as arrogant. I promise it was not my intent! [Then I wrote::] Ah. I just remembered one reason I had done it involving the art_id field: I have more publishers in the db than are currently associated with artworks. I don't want a publisher to appear unless there is at least one image associated with it. So I did this to avoid having people see a link to the Sneezy Acres Tribune only to arrive at the next page and see, "There are no images associated with this publisher." Jochem Maas wrote: Jack Jackson wrote: M. Sokolewicz wrote: Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. by that statement I ment the exact same thing Jochem ment in his 2nd part; I have NO idea why you're selecting *ANYTHING* from the arts table... it's *useless* if you don't need the data... Er, yes, that was what I meant: I had unintentionally included that bit.Thank you for your help. Er, Jack - your original query was: SELECT art.art_id,art.publisher_id,publisher.publisher_name, FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id which is a selection on the art table... ( with a typo) if you did: SELECT art.publisher_id,publisher.publisher_name FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id nothing would change. and if you did: SELECT publisher.publisher_id,publisher.publisher_name publisher i.e. not 'unintentionally' selecting from the arts table. then you would not have had a problem in the first place?! I think I'm missing something ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through an array problem
M. Sokolewicz wrote: Jack Jackson wrote: Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. by that statement I ment the exact same thing Jochem ment in his 2nd part; I have NO idea why you're selecting *ANYTHING* from the arts table... it's *useless* if you don't need the data... Er, yes, that was what I meant: I had unintentionally included that bit.Thank you for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping through an array problem
Thanks for all the replies. Jochem, thank you for this code, which will take me all night to understand (though I bet it works). I also note that SELECT DISTINCT worked here, too Also as many of you noticed before me, the art_id was in there as a fly in the ointment. Thanks all! Jochem Maas wrote: Jack Jackson wrote: This is something dumb I am doing but: Trying to pull all names of publishers in db. This sql: its a mysql question in disguise, maybe...: SELECT DISTINCT art.art_id,art.publisher_id,publisher.publisher_name FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_iduse, on the other hand if you want to pull every article from the DB then that won't do it. maybe you need to be extracting the name of the article instead/aswell? on the other hand if you are trying to display a list of publishers, why are you selecting from the arts table? SELECT p.publisher_id,p.publisher_name FROM publisher p ORDER BY p publisher_id DESC (maybe you only want to show publishers with listed 'art's?) what does this do for you?: SELECT COUNT(a.art_id) as art_count,a.publisher_id,p.publisher_name FROM art a, publisher p WHERE p.publisher_id=a.publisher_id AND art_count > 0 GROUP BY a.publisher_id SELECT art.art_id,art.publisher_id,publisher.publisher_name, FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id pulls (in phpmyadmin) four rows: artID pubID Publisher_name 17 The New York Times: Sunday Styles 23 The New York Sun 32 Metro NY 43 The New York Sun I'm trying to make a sidebar which will make links to each unique publisher name: and/or something like.: %2$s'; while ($cartoon = mysql_fetch_assoc($result)) { if (in_array($cartoon['publisher_id'], $seenAlready)) continue; $seenAlready[] = $cartoon['publisher_id']; $pub_sidebar[] = sprintf($templet, $cartoon['publisher_id'], $cartoon['publisher_name']); } while ($cartoon = mysql_fetch_assoc($result)) { $pub_sidebar[] = "href='{$_SERVER['PHP_SELF']}?p={$cartoon['publisher_id']}' title=\"{$cartoon['publisher_name']}\">{$cartoon['publisher_name']}"; } This prints: The New York Times: Sunday Styles The New York Sun Metro NY The New York Sun I'd like to stop the NY Sun from appearing twice! What have i missed here? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] looping through an array problem
This is something dumb I am doing but: Trying to pull all names of publishers in db. This sql: SELECT art.art_id,art.publisher_id,publisher.publisher_name, FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id pulls (in phpmyadmin) four rows: artID pubID Publisher_name 17 The New York Times: Sunday Styles 23 The New York Sun 32 Metro NY 43 The New York Sun I'm trying to make a sidebar which will make links to each unique publisher name: while ($cartoon = mysql_fetch_assoc($result)) { $pub_sidebar[] = "href='{$_SERVER['PHP_SELF']}?p={$cartoon['publisher_id']}' title=\"{$cartoon['publisher_name']}\">{$cartoon['publisher_name']}"; } This prints: The New York Times: Sunday Styles The New York Sun Metro NY The New York Sun I'd like to stop the NY Sun from appearing twice! What have i missed here? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ampersands in href's
Thanks! Leon Poon wrote: The simplest way to make sure everything work well regardless of what the values are: "; ?> htmlspecialchars() changes characters '&', '"', ''', '<', '>' into the HTML equivilant. And yup, you should do this for all *ML pages as long as the thing being printed is not part of the mark-up syntax. Jack Jackson wrote:> Rory Browne wrote: On 6/4/05, Jack Jackson <[EMAIL PROTECTED]> wrote: Hi, Rory Rory Browne wrote: I think you have the idea. The &'s are used to seperate the various variables. If you want to set $p to something like 'Tom & Jerry' then personally I'd do something like: That's nice. To get more specific (because my code varies a bit from yours and I don't wanna mess up the ) and ' and " s: $p and $c are actually row ID numbers so up to 3 digits. So for example if $p=1 $c=32 I was wanting to see a URL of http://foo.com?r=1&c=32 In that case, you can simply echo them out, once you're sure that $r, and $c are actually integers. I forgot to mention that above I did $r = intval($_GET[r]) ! Thanks, everyone! echo "whatever" if not(sure they're integers, you could always printf("http://foo.com?r=%d&c=%d\";>whatever", $r, $c); Alternatively you could $r = (int)$r; or echo "whatever"; There's more than one way to do it... so was this the way to go? //Make a thumbnail table of contents to display in the left sidebar while ($sidebar = mysql_fetch_assoc($sidebar_result)) { $sidebar_thumbnails[] = "href='{$_SERVER['PHP_SELF']}?p=%p&c={$sidebar['art_id']}, urlencode($p)' title=\"{$sidebar['art_title']}\">"; } ? Thanks in advance! On 6/4/05, Jack Jackson <[EMAIL PROTECTED]> wrote: Hi, If I want to make a link to a URL which includes some GETs can I just do: 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] ampersands in href's
Rory Browne wrote: On 6/4/05, Jack Jackson <[EMAIL PROTECTED]> wrote: Hi, Rory Rory Browne wrote: I think you have the idea. The &'s are used to seperate the various variables. If you want to set $p to something like 'Tom & Jerry' then personally I'd do something like: That's nice. To get more specific (because my code varies a bit from yours and I don't wanna mess up the ) and ' and " s: $p and $c are actually row ID numbers so up to 3 digits. So for example if $p=1 $c=32 I was wanting to see a URL of http://foo.com?r=1&c=32 In that case, you can simply echo them out, once you're sure that $r, and $c are actually integers. I forgot to mention that above I did $r = intval($_GET[r]) ! Thanks, everyone! echo "whatever" if not(sure they're integers, you could always printf("http://foo.com?r=%d&c=%d\";>whatever", $r, $c); Alternatively you could $r = (int)$r; or echo "whatever"; There's more than one way to do it... so was this the way to go? //Make a thumbnail table of contents to display in the left sidebar while ($sidebar = mysql_fetch_assoc($sidebar_result)) { $sidebar_thumbnails[] = ""; } ? Thanks in advance! On 6/4/05, Jack Jackson <[EMAIL PROTECTED]> wrote: Hi, If I want to make a link to a URL which includes some GETs can I just do: 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] ampersands in href's
Murray @ PlanetThoughtful wrote: If I want to make a link to a URL which includes some GETs can I just do: Depends very much on the document type of your page. Valid XHTML (transitional, at least), for example, doesn't like single ampersands in links. For XHTML, you need to replace "&"s with "&"s. So the following link: Something ...should be changed to: Something Thank you Murray. The page is in xhtml 1.0/transitional. That was precisely what I was worried about. The & will be converted as part of the URL right? I mean, the printed URL resulting from clicking on that link won't say & it'll just say & is this correct? Combined with Rory's post this is really, really useful stuff and I thank you ! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ampersands in href's
Hi, Rory Rory Browne wrote: I think you have the idea. The &'s are used to seperate the various variables. If you want to set $p to something like 'Tom & Jerry' then personally I'd do something like: $p = "Tom & Jerry"; $s = "Cat & Mouse"; printf(" That's nice. To get more specific (because my code varies a bit from yours and I don't wanna mess up the ) and ' and " s: $p and $c are actually row ID numbers so up to 3 digits. So for example if $p=1 $c=32 I was wanting to see a URL of http://foo.com?r=1&c=32 so was this the way to go? //Make a thumbnail table of contents to display in the left sidebar while ($sidebar = mysql_fetch_assoc($sidebar_result)) { $sidebar_thumbnails[] = "href='{$_SERVER['PHP_SELF']}?p=%p&c={$sidebar['art_id']}, urlencode($p)' title=\"{$sidebar['art_title']}\">src='{$image_dir}{$sidebar['art_thumbnail']}' width='50' height='60' border='0' alt=\"{$sidebar['art_title']}\" />"; } ? Thanks in advance! On 6/4/05, Jack Jackson <[EMAIL PROTECTED]> wrote: Hi, If I want to make a link to a URL which includes some GETs can I just do: 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] ampersands in href's
Hi, If I want to make a link to a URL which includes some GETs can I just do: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
asinning wrote: This is my first post to this group. I've been trying to figure this out on my own, but I keep running into complications, so I've decided to get some help. Much thanks for any help! I've been writing php server application for a couple of years, but now I'm turning my attention to re-building our company's aging website. This is a big project and is going to require a solid foundation. At the crux of this post is the following question: How do you develop a very robust, dynamic web-site, but also allow non-technical people to contribute? There must be an easier way. Here are my working assumptions and my strategy. Please help me if I'm thinking down the wrong path. Assumptions: 1) Non-technical people in the company need to be able to build pages, and they should be able to post their pages without bothering me. We have a tech-support person who will be able to help them, but she has zero programming knowledge and only a superficial understanding of HTML. 2) Every page needs to reside within he "shell" of the web site. This includes header(the top-level menu) left-side menu (a dynamic, context-specific menu) content (this is what the non-technical people will produce) footer (your standard fare text-based links) 3) I don't want to use frames, and I don't want to use Dreamweaver templates. Strategy: Currently, I am working on the following model: There is a top-level index.php page. This is the target of EVERY page on the site. The page that gets loaded in depends on the parameters of query-string. It's very simple, if the query string reads "?target=products/gsp", then my php will look for a site-relative document such as "products/gsp.htm" OR "products/gsp/index.hml". Then, this document will get "included" as the content in my "shell". Well, this works to a degree, but it requires that people use "site-relative" paths for all of their graphics and links, which is way, way to much to ask. After all, people are using WYSIWIG editors such as Dreamweaver and even Word to build their pages. Typically, site-relative paths don't work in these environments. They shouldn't need to upload their document to preview it. It also requires that they put their page within a 550 pixel wide -td- tag. I'd love to drop that requirement. So, now I considering the following: A parser that will convert any content into "includable" form. Relative paths will be translated to the site-root, etc. I'm a bit stuck here. Maybe I've misunderstood but here's a thought: I'm not sure what they're actually doing with these pages but it's usually in my experience something like a headline, a block of text in which you can allow certain HTML tags (you can use tidy within PHP) and some images and some links. Is there more that these folks are doing? Is there a reason to give them so much flexibility in design? Are these home pages as in personal showcases or department-specific offerings? You probably want to set up each user with their own directory or db area so they can upload all their images through your control panel, enter their text and have everything in one place for each user. If you give users the opportunity to put in unlimited matched sets of Headline, text block, image float right left or center (cna cation if required) plus , and a limited href capability 99% of people will probably be happy. Make sure you rename all images they upload to remove spaces, weird characters and duplicate names. You can use a naming convention like user.image.x. or even md5(imagename). So this way, each user gets a user directory in which all image links are relative to that directory, all images are righ there and ties to the user. > It also requires that they put their page within a 550 pixel wide > -td- tag. I'd love to drop that requirement. AAARG. We use a wrapper in XHTML, putting everything in tags so that later, when we change the format, they're not stuck in a as you rightly worry about. Using and CSS positioning increases exponentially your flexibility both now and later. And requires fairly modern browsers but according to our logs almost everyone has them. And if they come in using lynx it'll still *work* in that they get all the info in sensible order. Netscape 4 and IE 4 users are out of luck, but then, they often are anyway in terms of support on the web (please let's not devolve into a flame war over that statement). HTH and makes sense. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using GET to build multiple sql queries
Greg, thank you for all this... See below Greg Donald wrote: On 6/2/05, Jack Jackson <[EMAIL PROTECTED]> wrote: Thanks for the reply, Greg, I see how that is useful. I am confused as to how I would implement it here. Please bear with me as I am a newbie and am now perhaps more confused than ever!: Bummer, sorry. Twasn't you; were me. I'm trying to use the number given in the $_GET URL to build one piece of the sql: If there is anything set in the $_GET field other than ?c=[valid int] or ?p=[valid int] or ?s=[valid int] then I want to bounce to a plain index. if( !( isset( $_GET[ 'c' ] ) && is_int( $_GET[ 'c' ] ) || isset( $_GET[ 'p' ] ) && is_int( $_GET[ 'p' ] ) || isset( $_GET[ 's' ] ) && is_int( $_GET[ 's' ] ) ) ) { header( 'Location: index.php' ); exit; } Of course, that almost did it. But I wanted to do it it *weren't* an int. I put a ! in front and that works like a charm! If it's a valid int (a positive int which corresponds to a valid row) then I want to set its value to the appropriate variable: either $c, $p or $s, If it's in the URL it's already set as $_GET[ 'c' ], $_GET[ 'p' ], or $_GET[ 's' ]. I get it. Thanks for that. Including it in the sql didn't work as you suggested: WHERE art.art_id = '$_GET[c]' I guess it was missing a print command or something. I did this up top though: $c = intval($_GET['c']); $p = intval($_GET['p']); $s = intval($_GET['s']); and then did it as I had it in the sample above and it worked like a charm, too. subject.subject_id=art.subject_id"; ?> If that were instead a $p then I would do: art.publisher_id = '$_GET[p]' AND subject.subject_id=art.subject_id"; ?> If that were instead an $s then I would do: I'm sure your method works ( ;) ). If I understand it, as my friend Darrell said about your suggestion: '...We iterate through the array seeing if there's a submitted HTML form field name that matches the current database column name. If so, we add the column name and the value submitted in the form to a string that is being built into a database query.' It's just a matter of checking for variables in the $_GET array and doing what you need to do if they exist and are valid or not. Do you know about print_r() yet? echo ''; print_r( $_GET ); echo ''; I did and thank you. This is close to working, though I still have to deal with what happens once I run those queries. But thanks for sorting out that mess for me,. I really appreciate it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using GET to build multiple sql queries
SORRY - one small correction below: If that were instead an $s then I would do: I had accidentally put a number 1 in place of the $s in the above example. Apologies for the extra mail and thanks in advance. Greg Donald wrote: On 6/2/05, Jack Jackson <[EMAIL PROTECTED]> wrote: I'd love some help with http://hashphp.org/pastebin?pid=3443 if anyone can... Basically I want to make it so that, if the get in the url specifies no query or a query to a nonexistent row, send to vanilla index. If url specifies c= then set $c=c and use the number to build the mysql query; same for p= and s= - if they're valid build the query, if not kick em out. Can anyone offer any help? I'd iterate over the $_GET array to build the query elements. Then implode those elements. $array = array(); while( list( $k, $v ) = each( $_GET ) ) { if( $k == 'somekeynotindb' ) { continue; } $array[] = $k . "='" . $v . "'"; } if( $array ) { $and = implode( ', ', $array ); } $sql = " SELECT * FROM table WHERE 1 $and "; $query = mysql_query( $sql ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using GET to build multiple sql queries
Thanks for the reply, Greg, I see how that is useful. I am confused as to how I would implement it here. Please bear with me as I am a newbie and am now perhaps more confused than ever!: I'm trying to use the number given in the $_GET URL to build one piece of the sql: If there is anything set in the $_GET field other than ?c=[valid int] or ?p=[valid int] or ?s=[valid int] then I want to bounce to a plain index. If it's a valid int (a positive int which corresponds to a valid row) then I want to set its value to the appropriate variable: either $c, $p or $s, and thus set the values of $fields, $from and $where. If that were instead a $p then I would do: If that were instead an $s then I would do: I'm sure your method works ( ;) ). If I understand it, as my friend Darrell said about your suggestion: '...We iterate through the array seeing if there's a submitted HTML form field name that matches the current database column name. If so, we add the column name and the value submitted in the form to a string that is being built into a database query.' I'm trying to see how this code lets me do that. I know it's right in front of my face but I cannot see how to adapt it to the task. . Thanks in advance!! Greg Donald wrote: On 6/2/05, Jack Jackson <[EMAIL PROTECTED]> wrote: I'd love some help with http://hashphp.org/pastebin?pid=3443 if anyone can... Basically I want to make it so that, if the get in the url specifies no query or a query to a nonexistent row, send to vanilla index. If url specifies c= then set $c=c and use the number to build the mysql query; same for p= and s= - if they're valid build the query, if not kick em out. Can anyone offer any help? I'd iterate over the $_GET array to build the query elements. Then implode those elements. $array = array(); while( list( $k, $v ) = each( $_GET ) ) { if( $k == 'somekeynotindb' ) { continue; } $array[] = $k . "='" . $v . "'"; } if( $array ) { $and = implode( ', ', $array ); } $sql = " SELECT * FROM table WHERE 1 $and "; $query = mysql_query( $sql ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delay?
Has anyone else noticed significant delays in messages getting posted? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using GET to build multiple sql queries
I'd love some help with http://hashphp.org/pastebin?pid=3443 if anyone can... Basically I want to make it so that, if the get in the url specifies no query or a query to a nonexistent row, send to vanilla index. If url specifies c= then set $c=c and use the number to build the mysql query; same for p= and s= - if they're valid build the query, if not kick em out. Can anyone offer any help? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] foreach ($media as $key => $val) problem
Hi, all, This might look like a mysql problem but I assure you it's my botching the PHP which is the problem! I'm building a part of a page with info from three tables: art, media and media_art. Media_art is the intersection table. For every entry in art there can be one or more entries in media. art.art_id 1 has two entries in media_art: Media_id art_id 32 52 I do this SQL, which in phpmyadmin returns the two names of media as expected SELECT media.media_name FROM art, media_art, media WHERE art.art_id = 1 AND art.art_id = media_art.art_id AND media.media_id = media_art.media_id Yet here's where I mess up. To see if I've got them in an array, I do: $media = mysql_fetch_assoc($media_result); while ($media = mysql_fetch_assoc($media_result)) { asort($media); foreach($media as $key => $val) { echo "key: $key value: $val "; } } //end while $media = mysql_fetch_assoc($media_result) and this returns only the name of the HIGHer number of the two (that is, 5). What have I done wrong to echo out each name of the media associated with this record? I'm trying, eventually, to echo it out in the age so that it appears as [art_id 1] comprises Ink, watercolor. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php not allowed in .htaccess
Hi, dumb config issue. I'm putting a php_value include_path statement in an .htaccess file php_value include_path ".:/home/user/public_html/dis/admin/:/home/nick/" php_value auto_prepend_file /home/user/public_html/dis/admin/wcsconf.php and getting a 500 Server Error. Apache logs say, ".htaccess: php_value not allowed here" Where can I change this behavior - is this an apache httpd.conf or php.ini setting? Something else? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php not allowed in .htaccess
Sorry folks. Figured it out: in httpd.conf it wasn't in the first or second AllowOverride section (which I had set to All and that's why I was so gobsmacked) BUT it was in the "Control access to UserDir directories" section. Thanks everyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: cache class
Many thanks for all the answers. I've checked that I was saving the right file (I even think about it !), and even if I'm using Templeet (sort of smarty http://templeet.org ) i've disabled all cache, and this code is only PHP not template-language. I've checked the error.log, and it just said that the file does not exists (which is normal, the page is generated when it's missing, by Templeet, thus proving it's not using a cache). Now, i've put the class definition inside by PHP file, (I do not include it anymore with include ''), and it just hang with the error.log saying that it exhausted all memory. On Tue, 22 Mar 2005 15:18:17 -0500, Jeremiah Fisher <[EMAIL PROTECTED]> wrote: > I usually encounter this when there's an error of some sort. Tail your > error log and see if the apache child thread is seg faulting (if you're > using httpd). > > The web server may still be up, but your code is causing the particular > connection to fail. Because the connection just dies, the browser never > receives any content, and so never changes what's on screen. > > Look for scoping issues: i.e., accessing a singleton from an aggregate > object's constructor (before the singleton has been instantiated). > > Alternatively, comment out everything but the first few lines, and start > uncommenting more and more until it stops working all together. As a > good test, try this: > > [...trial code...] > > echo 'test run finished'; > exit; > > /* > [...unknown code...] > */ > ?> > > Hope this helps, > > Jeremy > > > Mister Jack wrote: > > Hi, > > > > I'm having a bit of a problem. > > I include a class in my script, the first time run fine, and then if I > > change anything in my class, changes are not reflected on the browser, > > it's like it's still the old class which is used. I've cleared the > > browser cache, force a pragma no-cache, but no, nothing do the trick. > > even if I do "return;" at the beginning of the method I called, it > > doesn't work... does someone have a clue about what is going on ? > > -- > 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] cache class
Hi, I'm having a bit of a problem. I include a class in my script, the first time run fine, and then if I change anything in my class, changes are not reflected on the browser, it's like it's still the old class which is used. I've cleared the browser cache, force a pragma no-cache, but no, nothing do the trick. even if I do "return;" at the beginning of the method I called, it doesn't work... does someone have a clue about what is going on ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class and global
Ok, i've found a workaround. So contrary to what is stated apparently in the documentation I had to declara the variables explicitely "global" to make it working and to create the object and assign _without_ reference. to sum up : global $freedb; $freedb = new freedbaxs(); function return_freedb_search($array) { global $freedb; [snip] $freedb->freedb_search($txt); } this is the one working. On Sun, 20 Mar 2005 11:37:53 +, Mister Jack <[EMAIL PROTECTED]> wrote: > Ok, I've tried with a dummy class : > > class dummy { > var $yank; > Function dummy() > { > $this->yank = "test dummy"; > } > } > > and the problem is exactly the same. > i've done > print_r($dummy); > is works ok outside the function, but inside print_r($dummy) doesn't > return anything, like $dummy wasn't existing, even tough I declared it > to be global... So the class n itself doesn't have anything to do with > it. > I'm really stuck with this. Is there any incompatibiliy with class and > global declaration ? > btw, I'm using PHP 4.3.10-8 > thanks for your help, > > > On Sat, 19 Mar 2005 20:45:55 +, Mister Jack <[EMAIL PROTECTED]> wrote: > > there is no database connection involved here. if I displace the > > $freedb =& new freedbaxs(); > > inside the function it's works. > > > > I should give a try with a dummy object. (but the constructor, only > > initialize empty array) > > > > On Sat, 19 Mar 2005 21:17:02 +0200, BAO RuiXian <[EMAIL PROTECTED]> wrote: > > > > > > > > > Evert - Rooftop Solutions wrote: > > > > > > > pooly wrote: > > > > > > > >> I'm trying to use a global object (declared at a upper level), but > > > >> all I got is : > > > >> Call to a member function on a non-object in > > > >> /home/pooly/public_html/templeet/modules/freedb.php on line 16 > > > >> > > > Hmm, perhaps your problem is the failed connection to your database. Can > > > you verify this? > > > > > > Best > > > > > > Bao > > > > > > >> part of the code is : > > > >> $freedb =& new freedbaxs(); > > > >> Function return_freedb_search($array) > > > >> { > > > >> global $freedb; > > > >> [snip] > > > >> $freedb->freedb_search($txt); > > > >> > > > >> > > > > I don't see an error in this code, perhaps you should give us a bit > > > > more information. > > > > > > > > grt, > > > > Evert > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class and global
Ok, I've tried with a dummy class : class dummy { var $yank; Function dummy() { $this->yank = "test dummy"; } } and the problem is exactly the same. i've done print_r($dummy); is works ok outside the function, but inside print_r($dummy) doesn't return anything, like $dummy wasn't existing, even tough I declared it to be global... So the class n itself doesn't have anything to do with it. I'm really stuck with this. Is there any incompatibiliy with class and global declaration ? btw, I'm using PHP 4.3.10-8 thanks for your help, On Sat, 19 Mar 2005 20:45:55 +, Mister Jack <[EMAIL PROTECTED]> wrote: > there is no database connection involved here. if I displace the > $freedb =& new freedbaxs(); > inside the function it's works. > > I should give a try with a dummy object. (but the constructor, only > initialize empty array) > > On Sat, 19 Mar 2005 21:17:02 +0200, BAO RuiXian <[EMAIL PROTECTED]> wrote: > > > > > > Evert - Rooftop Solutions wrote: > > > > > pooly wrote: > > > > > >> I'm trying to use a global object (declared at a upper level), but > > >> all I got is : > > >> Call to a member function on a non-object in > > >> /home/pooly/public_html/templeet/modules/freedb.php on line 16 > > >> > > Hmm, perhaps your problem is the failed connection to your database. Can > > you verify this? > > > > Best > > > > Bao > > > > >> part of the code is : > > >> $freedb =& new freedbaxs(); > > >> Function return_freedb_search($array) > > >> { > > >> global $freedb; > > >> [snip] > > >> $freedb->freedb_search($txt); > > >> > > >> > > > I don't see an error in this code, perhaps you should give us a bit > > > more information. > > > > > > grt, > > > Evert > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class and global
there is no database connection involved here. if I displace the $freedb =& new freedbaxs(); inside the function it's works. I should give a try with a dummy object. (but the constructor, only initialize empty array) On Sat, 19 Mar 2005 21:17:02 +0200, BAO RuiXian <[EMAIL PROTECTED]> wrote: > > > Evert - Rooftop Solutions wrote: > > > pooly wrote: > > > >> I'm trying to use a global object (declared at a upper level), but > >> all I got is : > >> Call to a member function on a non-object in > >> /home/pooly/public_html/templeet/modules/freedb.php on line 16 > >> > Hmm, perhaps your problem is the failed connection to your database. Can > you verify this? > > Best > > Bao > > >> part of the code is : > >> $freedb =& new freedbaxs(); > >> Function return_freedb_search($array) > >> { > >> global $freedb; > >> [snip] > >> $freedb->freedb_search($txt); > >> > >> > > I don't see an error in this code, perhaps you should give us a bit > > more information. > > > > grt, > > Evert > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class and global
The initialisation seems to be ok, since : Function return_freedb_search($array) { global $freedb; $freedb =& new freedbaxs(); [snip] $freedb->freedb_search($txt); //line 16... } works and also $freedb =& new freedbaxs(); $freedb->freedb_search("ploplop"); Function return_freedb_search($array) { global $freedb; [snip] //$freedb->freedb_search($txt); //line 16... } those line are all in a PHP file which is include if needed, by parsing the template file. So the file is include (then $freedb =& new freedbaxs(); should be executed) and return_freedb_search is call a bit later. Everythin has always worked fine, but this is the first time I tried with an object, and all i got is this error. that's really strange, and I really don't have a clue about what is going on. (is the object disapearing ? ) On Sat, 19 Mar 2005 19:59:55 +0100, Evert - Rooftop Solutions <[EMAIL PROTECTED]> wrote: > pooly wrote: > > > I'm trying to use a global object (declared at a upper level), but all > > I got is : > > Call to a member function on a non-object in > > /home/pooly/public_html/templeet/modules/freedb.php on line 16 > > > > part of the code is : > > $freedb =& new freedbaxs(); > > Function return_freedb_search($array) > > { > > global $freedb; > > [snip] > > $freedb->freedb_search($txt); > > > > > I don't see an error in this code, perhaps you should give us a bit more > information. > > grt, > Evert > > -- > Rooftop Solutions - Web Applications on Demand > tel. (+31)628962319 fax. (+31)842242474 > [EMAIL PROTECTED] > http://www.rooftopsolutions.nl > > -- > 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] global and object
Oops, sorry for double posting. my mistake. accept my apologies :-p On Fri, 18 Mar 2005 23:51:15 +, pooly <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to use a global object (declared at a upper level), but all I > got is : > Call to a member function on a non-object in > /home/pooly/public_html/templeet/modules/freedb.php on line 16 > > part of the code is : > $freedb =& new freedbaxs(); > Function return_freedb_search($array) > { > global $freedb; > [snip] > $freedb->freedb_search($txt); > > so, can I access an object allocated outside a function ? this > functionis meant to be a wrapper for that class, because I cannot access > directly. > thanks for you help, > > -- > Pooly ;) > http://www.w-fenec.org/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Student Suspended
Its sad too see so many programmers with so much time on their hands. Stop wasting this valuable resource on something which came from a parody site in the first place! post your idiotic commentary somewhere else -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP to send file through a http pipe?
I was wondering if I could get some help on a minor problem I have. Here's the deal I have set up on my system. http://ftp.brajah.com/ I created this simple little interface to list files and directories in the public ftp folder. The only problem is, I had to move the whole directory to my web site just to allow people to download the file. (ie: (site)/ftp/atcommand.txt ) What I want to do is have a file (like get.php) which will read the file on the drive, and then transfer it through to the client on the browser. (ie: get.php?file=/atcommand.txt ) Is there a simple way to do this while reducing security concerns? (Ie: reading ../../../../../etc/passwd ) --Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Attempted to unsubscribe to no avail
look at the bottom of the emails you are getting. Specially the last paragraph may be of interest If you are receiving mail from one of the mailing lists, there should be absolutely no reason that you would be unable to unsubscribe yourself from the list, except for your ability to follow these directions. However, if you find yourself unable to unsubscribe from the mailing list, send an email to [EMAIL PROTECTED] Make sure to include the complete headers from one of the messages you have received from the mailing list. Keep in mind that there's a human being at the other end of that last email address, so you'll have to be patient. -Oorspronkelijk bericht- Van: Scott Hamm [mailto:[EMAIL PROTECTED] Verzonden: maandag 13 december 2004 14:45 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Attempted to unsubscribe to no avail GRR, I've tried in various and numerous ways to unsubscribe, even RTFM'd. How do I unsubscribe?! -- 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 get 2 columns to display?
can you maybe add some debug code to print out the value of $r just before the if? and just after the if It looks at first glance to be correct, except you seem to be missing opening (actually that may be your problem) Jack -Oorspronkelijk bericht- Van: Aaron Wolski [mailto:[EMAIL PROTECTED] Verzonden: maandag 6 december 2004 15:21 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] How to get 2 columns to display? Hi guys, I'm trying to get two columns of to display side by side and then go to a new row. I am using this code but nothing I seem to do is working this far. What is happening with this code is I am getting results like: IMAGE HERE IMAGE HERE IMAGE HERE IMAGE HERE IMAGE HERE What I WANT is: IMAGE HERE IMAGE HERE IMAGE HERE IMAGE HERE IMAGE HERE ANY clue where I am going wrong? Thanks so much. Aaron -- 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 show errors in browser
Hi In your PHP.INI there is a section that will take care of that ;; ; Error handling and logging ; ;; ; error_reporting is a bit-field. Or each number up to get desired error ; reporting level ; E_ALL - All errors and warnings ; E_ERROR - fatal run-time errors ; E_WARNING - run-time warnings (non-fatal errors) ; E_PARSE - compile-time parse errors ; E_NOTICE - run-time notices (these are warnings which often result ; from a bug in your code, but it's possible that it was ; intentional (e.g., using an uninitialized variable and ; relying on the fact it's automatically initialized to an ; empty string) ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup ; E_CORE_WARNING- warnings (non-fatal errors) that occur during PHP's ; initial startup ; E_COMPILE_ERROR - fatal compile-time errors ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) ; E_USER_ERROR - user-generated error message ; E_USER_WARNING- user-generated warning message ; E_USER_NOTICE - user-generated notice message ; ; Examples: ; ; - Show all errors, except for notices ; ;error_reporting = E_ALL & ~E_NOTICE ; ; - Show only errors ; ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ; ; - Show all errors except for notices ; error_reporting = E_ALL & ~E_NOTICE -Original Message- From: Rayan Lahoud [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 3:01 PM To: [EMAIL PROTECTED] Subject: [PHP] how to show errors in browser Hy, i am opening php files from my browser. If there are some errors in the php file i can not see what are the errors in the browser Can anyone help please? - Do you Yahoo!? Discover all that's new in My Yahoo! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PDFLIB error 2516
Thx That was it. Anybody have any ideas as to why this behaviour changed?? Regards Jack -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, November 05, 2004 12:46 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] PDFLIB error 2516 Hi, Friday, November 5, 2004, 8:18:16 PM, you wrote: JvZnc> Hi All, JvZnc> I upgraded my test system to 4.3.9 (from 4.3.4) and now run into JvZnc> problems with pdf creation. Scripts that ran fine before now JvZnc> return the following JvZnc> error: JvZnc> Fatal error: PDFlib error: [2516] PDF_findfont: Metrics data for JvZnc> font 'Arial' not found in d:\website\pdf_graph.php on line 50 JvZnc> Has anybody seen this before and knows of the solution? Google JvZnc> returned no hits that solved the problem. JvZnc> JvZnc> pdf_open_file($pdf, "d:\\website\\graphs.pdf"); JvZnc> pdf_set_info($pdf, "Author", "Automatically Generated"); JvZnc> pdf_set_info($pdf, "Title", "Management graphs"); JvZnc> pdf_set_info($pdf, "Creator", "Jacob A. van Zanen"); JvZnc> pdf_set_info($pdf, "Subject", "Management Graphs"); JvZnc> pdf_begin_page($pdf, 700, 600); JvZnc> $bookmark1 = pdf_add_bookmark($pdf, "Information for machine JvZnc> SBPXXA1"); $arial = pdf_findfont($pdf, "Arial", "host", 1); JvZnc> pdf_setfont($pdf, $arial, 12); //-this is line 50 JvZnc> pdf_show_xy($pdf, "1 Information for machine SBPXXA1 for $_POST[day]/ JvZnc> $_POST[month]/$_POST[year]",50, 510); JvZnc> JvZnc> TiA JvZnc> Jack van Zanen You have to tell pdf where to find the font, I do it this way pdf_set_parameter($pdf, "FontOutline", "Arial=/path/to/arial.ttf"); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDFLIB error 2516
Hi All, I upgraded my test system to 4.3.9 (from 4.3.4) and now run into problems with pdf creation. Scripts that ran fine before now return the following error: Fatal error: PDFlib error: [2516] PDF_findfont: Metrics data for font 'Arial' not found in d:\website\pdf_graph.php on line 50 Has anybody seen this before and knows of the solution? Google returned no hits that solved the problem. pdf_open_file($pdf, "d:\\website\\graphs.pdf"); pdf_set_info($pdf, "Author", "Automatically Generated"); pdf_set_info($pdf, "Title", "Management graphs"); pdf_set_info($pdf, "Creator", "Jacob A. van Zanen"); pdf_set_info($pdf, "Subject", "Management Graphs"); pdf_begin_page($pdf, 700, 600); $bookmark1 = pdf_add_bookmark($pdf, "Information for machine SBPXXA1"); $arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 12); //-this is line 50 pdf_show_xy($pdf, "1Information for machine SBPXXA1 for $_POST[day]/ $_POST[month]/$_POST[year]",50, 510); TiA Jack van Zanen
RE: [PHP] what am i doing wrong..??
somehow keeps the $_GET variables. If you change this to the real script name it seems to work JACK -Original Message- From: Aalee [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 1:54 PM To: [EMAIL PROTECTED] Subject: [PHP] what am i doing wrong..?? Hi there please have a look the code below...I dont know wht am doing wrong here... This code is suppose to show the number of jokes in a mysql database and allows user to add a joke when the user clicks addjoke link. And when the joke is added, it suppose to say that "Joke inserted, Thank you" and list all the jokes below this line. So far am able to view all the jokes and take the user to add joke page. But the problem is when the user clicks insert joke button, it does not display the message "Joke inserted, Thank you" and the jokes are not listed. Infact it does not give any error aswell, it just stays on the add joke form page. I checked the database and no joke is added. Working on PHP ver 4.3.8 with register_globals turned OFF and Apache 1.3.31. MySQL ver 4.0.20a on winXP pro SP1. Recently i started using registre_globals OFF and all these probs strted coming up. This code was working fine with globals ON. But my hosting has it off. So need to do so. I was able to fix all the other issues came coz of this global thing in this code. But stuck on the issue i just mentioned. Any help would be GREATLY appreciated. Type your joke : "; echo mysql_error(); } $color1 = "#66CCFF"; $color2 = "#66CC99"; $row_count = 1; // -- Following lines list the jokes in the database echo " These are the jokes we have got so far"; $db = mysql_connect("localhost","homesite","test") or die(mysql_error()); mysql_select_db("jokes",$db); $sql = "SELECT id, JokeText, JokeDate from jokes"; $query = mysql_query($sql); echo " ID Joke Text Joke Date"; while ($myrow = mysql_fetch_array($query)) { $row_color = ($row_count % 2) ? $color1 : $color2; echo"". "". $myrow["id"]."". "". $myrow["JokeText"]. "". "". $myrow["JokeDate"].""; $row_count++; } echo ""; $current_url = $_SERVER['PHP_SELF']; echo("" ."Add a Joke!"); } // end main else statement ?> -- 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] Cannot retrive the data ???
Try if($_POST[insert]) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, November 01, 2004 5:08 PM To: [EMAIL PROTECTED] Subject: [PHP] Cannot retrive the data ??? Hi there, Look at the following code please. I have a mysql db setup and apache running. I have the register_globals=OFF on the php.ini file. The code is suppose to show all the jokes in the databse and give user to enter jokes. The code works fine when when the register_globals=ON in the php.ini file. But for some reason it does not work when it is OFF. Infact when it is OFF it give a blank page with no data retrieved from the databse and gives no errors. Please help me.Code is below..." Type your joke : "; } else { echo "Joke NOT entered. An error occured while entering"; } $color1 = "#CCFFCC"; $color2 = "#BFD8BC"; $row_count = 0; // -- Following lines list the jokes echo " These are the jokes we have got so far"; $db = mysql_connect("localhost","homesite","951753") or die(mysql_error()); mysql_select_db("jokes",$db); $sql = "SELECT id, JokeText, JokeDate from jokes"; $query = mysql_query($sql); echo " ID Joke Text Joke Date"; while ($myrow = mysql_fetch_array($query)) { $row_color = ($row_count % 2) ? $color1 : $color2; echo"". "". $myrow["id"]."". "". $myrow["JokeText"]. "". "". $myrow["JokeDate"].""; // echo "".$myrow["id"]."-- ". $myrow["JokeText"]. " ". $myrow["Name"]." ".$myrow["Email"]. ""; $row_count++; } echo("" ."Add a Joke!"); } ?> "Cheers Mike -- 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] Parsing a concatenated variable and string?
Hi Paul Try print $instrument."number"; jack -Original Message- From: Paul Evans [mailto:[EMAIL PROTECTED] Sent: Friday, October 29, 2004 9:45 AM To: [EMAIL PROTECTED] Subject: [PHP] Parsing a concatenated variable and string? Hi, I am new to PHP and cant seem to find a way to parse a concatenated string and variable. To explain: I have a database to catalogue a composers works, one of the tables has a list of instruments which I then access to dynamically display on a wep page using checkboxes - if a particular instrument is used in the work then the checkbox is checked.  //This creates a checkbox for each instrument in the database  So far so good. The problem I am having is when I want to insert the number of instruments used in the work. This snipet of code produces a dynamically created form where the user can enter the number of instruments required. (Ie 2 flutes)  Here is a part of the form created from the code above for the instrument Flute: To process the information in this form I think I need to concatenate $instrument with the string 'number'.  the only problem is that PHP reads this literally and the output is just $Flutenumber and not the number actually entered. Here is the code I have at the moment Any help would be greatly appreciated. Thanks, Paul. -- 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] Regular expressions Q
Thx, Just joined today, should have looked thru the archives first though. Jack -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 3:31 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regular expressions Q > ereg("(([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?)","$zn[1]", > $zaakn > ummers1); > > I thought that ereg would get all of them and store them in the array > $zaaknummers1 however this is not the case I just asked a question similar to this the other day. Try using; preg_match_all("(([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?)", $zn[1], $zaaknummers1); alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular expressions Q
Hi All I'm trying to achieve the following: In a text string there may be a number of substrings that match my criteria. I need to retrieve all of them. This is what I have so far and works perfect for the first substring but ignores the possibility of others. I need to know if there are more in the string that match and if so need to have those. ereg("(([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?)","$zn[1]",$zaakn ummers1); I thought that ereg would get all of them and store them in the array $zaaknummers1 however this is not the case PHP 4.3.4 What am I doing wrong here? THX Jack
Re: [PHP] Re: New PHP tutorial - suggestions welcome
On Sunday 26 September 2004 12:32 am, John Taylor-Johnston wrote: > Consistently crashes my Netscape 4.8 (circa 2003). yeah, I still use it, > because I prefer its news reader. Very few attacks on this mature mail > program. That said, you're forcing me to use IE6 :-| No one is forcing you to use anything. You made your own choice to use an older browser. His site works great with Mozilla 1.4 on Linux an Mozilla 1.7.1 on Windows -- Jack "The Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 readdir is_dir working incorrectly?
This is just to say that I never sent that to the list. I sent it privately. So for you to send this to the list to say that I probably should not was not good either. Because now the whole list has been bothered instead of just one. On Thursday 16 September 2004 03:15 pm, Kristopher Spencer-Yates wrote: > Out of respect for everyone on the list, it is probably best to not use > this mailing list as a sales tool. Many of us here on the list are in > the same business of developing and hosting. It is wise to assume > everyone on the list is in the same business (even if it is untrue). > Just know that if someone is looking for hosting, they will definitely > post a request specifically looking for such services. It may also be > beneficial to you personally if you were to have a working PHP5 server > online before attempting to sell it as a service. I hope you take this > advice kindly, as I mean you no harm. > > One thing that I am not sure of is whether or not the PHP.NET group > already has a mailing list specifically for posting PHP related service > availability. If so, you may want to look for business there. > > Best of luck in your ventures. The US economy is starting to pick up > which is hopefully a benefit to all PHP programmers worldwide. > > Respectfully, > > -- > Kristopher Spencer-Yates > Dev Mgr/Systems Administration > [EMAIL PROTECTED] -- Jack "The Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 readdir is_dir working incorrectly?
> Out of respect for everyone on the list, it is probably best to not use > this mailing list as a sales tool. Many of us here on the list are in > the same business of developing and hosting. It is wise to assume > everyone on the list is in the same business (even if it is untrue). > Just know that if someone is looking for hosting, they will definitely > post a request specifically looking for such services. It may also be > beneficial to you personally if you were to have a working PHP5 server > online before attempting to sell it as a service. I hope you take this > advice kindly, as I mean you no harm. > > One thing that I am not sure of is whether or not the PHP.NET group > already has a mailing list specifically for posting PHP related service > availability. If so, you may want to look for business there. > > Best of luck in your ventures. The US economy is starting to pick up > which is hopefully a benefit to all PHP programmers worldwide. > > Respectfully, > > -- > Kristopher Spencer-Yates > Dev Mgr/Systems Administration > [EMAIL PROTECTED] -- Jack "The Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP to execute hyperlink?
I use an application that has a web browser engine built in and every time I open the app there is some code executing a hyperlink and pulling up a HTML page to a specific place on the page. This action changes according to if it is AM or PM and the date. Example: from 00:00 to 11:59 during the same day you will see the same starting place on the page any time this app is opened. From 12:00 to 23:59 during the same day you will see something different from the AM but it will be the same for the 12 hour time period. The next day the AM section and the PM do the same thing but on a different place on the page. Each day this behavior repeats but each day the place on the page is new. The page that is called has name anchors through out the page. It is these name anchors that are being called on the page. I said all that to ask this. I want to do the same thing using PHP script. Can this be done? I know PHP is server side script. I am not sure which date/time function to use. I assume that "if else" statements will be needed. I don't know how to get PHP to execute the hyperlink when the page opens. Basically the PHP code would execute something like this: Get the current date and time, find the matching name anchor that reflects the current month and day and if it is AM or PM and then display the correct place on the page. I am still learning PHP so this as been a little more than I can figure out right now. Just trying to figure out how to use all the date time functions is confusing. I do know how to use date() that one was easy to figure out. I don't know if I should be using date() or getdate() If I could figure out the start and end of the script I could probably figure this out. I think the middle with the "if else" statements will be easy to figure out. Every time I try to figure out these date time functions I get syntax errors. I can't figure out what the PHP manual says about these functions. Any body have any ideas? Thanks, -- Jack "The Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Does any one else get this?
Sorry! Chris, I meant to send this to the list. On Saturday 04 September 2004 10:17 pm, Chris Martin wrote: > Jack Gates wrote: > > Every time I post to the list, I get an undeliverable on the address > > below. Does any one else get this? > > > > If this address is on the list can we get it removed? > > > > To: [EMAIL PROTECTED] > > Subject: [PHP] PHP site ? > > > > was undeliverable due to the following reason: > > > > [EMAIL PROTECTED] - User doesn't exist or is inactive. > > I don't get them from that address, but I get them from > > From: "Mailer Iguanahosting.com" <[EMAIL PROTECTED]> > Subject: Destinatario No exitente I get that one also. So far those are the only two. > > On top of that I've received post confirmations for messages I never > sent. Hopefully since I never confirmed them, they never made it. I > don't want to be considered one of the spammers that I'd like to knock > the F* out. I send addresses to spamcop.net all the time. > > > -- > Chris Martin > Web Developer > Open Source & Web Standards Advocate > http://www.chriscodes.com/ -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP site ?
I replaced this: $address = getenv("REMOTE_ADDR"); with this $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); and now I am getting exactly what I was trying to get. -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does any one else get this?
Every time I post to the list, I get an undeliverable on the address below. Does any one else get this? If this address is on the list can we get it removed? To: [EMAIL PROTECTED] Subject: [PHP] PHP site ? was undeliverable due to the following reason: [EMAIL PROTECTED] - User doesn't exist or is inactive. -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP site ?
Thanks for all the responses. Now I am satisfied and can leave this one alone. -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP site ?
How is osCommerce doing this? Go here to see exactly what I am talking about: http://wiki.oscommerce.com/docs I am using the REMOTE_ADDR but it does not provide all the information that osCommerce is showing. When I use the variable it shows the numbers like 192.168.10.25 (I know this is an internal network address, it is just for example.) osCommerce gets more than just the numbers, they get the name as well I think. Thanks for any insight on what they might be doing. -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP to replace javascript
On Friday 03 September 2004 01:11 am, Sam Hobbs wrote: > "Jack Gates" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > Javascript can open a separate and specifically sized window from a web > > page > > when a user clicks on a link that might reference a note or picture etc. > > > > Can this be done with PHP? If yes, will someone tell me where in the > > manual > > on the php.net site I can find the information to learn how to do this? > > > > I have been looking through the manual on the site but without knowing > > the name or names of what I am looking for it is real hard to find it. > > I am new to PHP also but there is some fundamental understanding of PHP > that is likely to make things much more clear. PHP is a server-side > facility. PHP executes before the HTML is (considered to be) complete. Then > the HTML is sent to the client. By the time that the user clicks on the > page, PHP is totally gone (for the purposes of the page). This concept is > quite easy to explain and to understand, yet you are likely to spend many, > many hours of reading before you read enough to understand this. In other > words, I am sure you can understand it, but this is the type of concept > that documentation seldom makes clear. > > You can, instead, put resize code (using PHP or nearly any language) in the > page that shows the image. This is also a more object-oriented solution. Thanks for the response, it makes sense. I already understand that PHP is server side code and Javascript is client side code. Last night I was tired when I sent this. I knew I had seen a pop up window on a web site that I new was completely written in PHP and driven by MySQL. The HTML output was done on the fly by the code and database, which prompted my question. I went to the actual PHP script source since I have direct access to it. The picture that was popping up when the link is picked is being done by Javascript embedded in the source PHP script. Now it is a lot clearer that the window pop up can't be done with PHP. If by chance my conclusion is wrong some one please enlighten me. My objective here is to remove Javascript from my site every where that I possibly can and to replace it with server side code or something else. The reason for this is simply because some people are going to turn off Javascript from their browser because of the danger that it could pose to their local box if they visit a site with evil intent. -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP to replace javascript
Greetings, This is my first post here and I am still new to PHP and learning. I just joined this list last night. Javascript can open a separate and specifically sized window from a web page when a user clicks on a link that might reference a note or picture etc. Can this be done with PHP? If yes, will someone tell me where in the manual on the php.net site I can find the information to learn how to do this? I have been looking through the manual on the site but without knowing the name or names of what I am looking for it is real hard to find it. TIA, -- Jack "Rhino" Gates, Registered Linux user #342662 Morning Star Communications, www.morningstarcom.net Web Hosting, Site Design, Domain Registration, VMware Workstation Software and GSX Server Software -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] which user is a script executing as?
How do I determine with which user's permissions PHP scripts are executing? I am experimenting with suEXEC and running PHPs as CGIs; I need to know with which user's permissions PHP scripts are executing. I've tried using getmyuid() and get_current_user(), but these only report the owner of the script - not necessarily whether the script is actually executing as this user or not. I couldn't find this information in phpinfo(). Suggestions much appreciated! Thanks! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] >>>>>> THREADS IN PHP
hi, i'm looking for a methode to use threads in php (on linux) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ## Getting into Netscape.com Inbox
Hi, i'm trying to access my netscape.com inbox with php, so i started to decode the ssl session and got all sent packets in plaintext, not really hard. but know i have to deal with encrypted cookies and i have no clue what i have to do. i found no help while i crawled the web for hours. an example: Cookie: MC_MS_LDC=1 activationde 1 1086246633 0 1086245744 0; MC_NPID=mc-sr12.websys.aol.com/9738; MC_SESSION0=%2FO7gI0OrZnCyKU9ZmWBsOA%3D%3D-diAxLjAga2lkIDIwMDQwNjAyMDEwMDAxM TE1OQ%3D%3D-nrVhh6NyA2ucnTGoqHuGR%2FW8HXEp74Oo%2FBWpqzwyvOvf77IyX6CWZ0YIHJyg TZzKxaQ4181tOTlZwZI11OGY1TfbIX1JRDLS3LL2xDtnIaXYf7V8yDXTeA%3D%3D; C_SITE_ACT=yiBeRJ8fvFTwAFG+ZefJmA==-yI/TFXODOR4TuSu2hocH7bDa744fsOwU+92Ub3mW tfBUOnWuJkVCJ34mEq9zmEsz5mto1KN24NA=; MC_SITE_ACT=yiBeRJ8fvFTwAFG+ZefJmA==-yI/TFXODOR7m9s106Mf3qlzvgDhdyOqWVpA43Kx 7G1H3uij9bZQ7iXEb3BgZsRJwqoPSTd1IzJ4=; MC_SITEID=nscpenusmail; MC_SSTATE=mach5%3d1; MC_AUTHLEV=2 i tried to use rawurldecode() and base64_decode and i got only one small part in plaintext: diAxLjAga2lkIDIwMDQwNjAyMDEwMDAxMTE1OQ%3D%3D v 1.0 kid 200406020100011159 someone in here that have a clue what should i do next? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and HTTPS POSTs
Has anyone had any problems with the $_POST super global not working in a HTTPS environment? My code works perfectly fine through a unsecured HTTP POST but when I do an HTTPS POST it only handles a few variable (I think 15 or 16). Any more than that and it looses all the $_POSTed variables. Has anyone seen this and more importantly know the fix for the problem? May or may not be the same, but I certainly wasted a couple days this week tracking down similar problems. Turns out it was an IE bug when using Apache/mod_ssl. There's a fix listed on the mod_ssl site - I just added the following to an .htaccess file or the apache configuration file... SetEnvIf User-Agent ".MSIE." nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0 -- Jack Baty Fusionary Media - http://fusionary.com/ Weblog - http://jackbaty.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT PHP Programmers
Not sure where to post this, but my company is looking to hire an inhouse PHP programmer. This could be part or full time depending on details. We are not looking to contract an outside company ( doesn't work for us) or to get headhunters etc to call us. If you are a good PHP/MySQL/HTML programmer then drop me an email. You would HAVE to work in our Miami Office ( not to far from 826 & Bird Road ). Thanks! Joey
[PHP] Flash and Sessions
I have a page with an embedded Flash movie that I'm having trouble with. The Flash movie loads and calls a different url on the same host, retrieving some XML and parsing it. The problem is that many people are reporting that they lose thier session when leaving the page with the Flash movie. Essentially, when posting the form on that page, they get "kicked out" of the app. After removing the Flash movie completely, the problem goes away. This seems to occur about 1 out of 5 posts, but only for about 1/3 of the users. This doesn't seem to be specific to a particular Flash or browser version, as I'm using the same combination as some of the folks reporting problems and have never seen it. Server is IIS 5 and PHP 4.3.3. It also doesn't seem to be a cookie or javascript issue either. Any thoughts? -- Jack Baty Fusionary Media - http://www.fusionary.com/ for life is not a paragraph, and death i think is no parenthesis. -e.e. cummings -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POSSIBLE TO SETUP PHP USING PROXY AS DEFAULT?
The problem is that i'm using a windows for that, the anomizer i use to connect to different proxys waits on 127.0.0.1/localhost, so i can't redirect the whole outbound traffic on port 80 for that Hi, There is a topic called transparent proxying. Don't have any links in my bookmarks but if you visit either the squid proxy websites or the iptables website you will find it. (this is usually done with this combination but can be done with other proxy/firewall combos as well). Basically what happens is that at the network layer all outbound port 80 traffic is redirected by iptables to the proxy server (which will have to run on a different port). Most ISPs in asia resort to this tactic. all the best Jack Bauer wrote: >Hi, > >i'm looking for a method to setup php to use >a proxy for all http/ftp connections. >i know it's possible to write a script >that can do this, but i need to setup php >itself for that (php.ini or something like this) > >i tried different tools for that to tunnel all >connection but i didn't found anything that >works for me > > >regards > > > -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POSSIBLE TO SETUP PHP USING PROXY AS DEFAULT?
Hi, i'm looking for a method to setup php to use a proxy for all http/ftp connections. i know it's possible to write a script that can do this, but i need to setup php itself for that (php.ini or something like this) i tried different tools for that to tunnel all connection but i didn't found anything that works for me regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] >>Remove Dynamic String between StringA and StringB
Hi :), i tried your code zu replace some parts of a string, the problem is that this method only replaces when there is only 1 word between stringA and stringB. i got the problem that the part between both strings is a dynamic one and much larger then 1 word. i really tried to use the php manual and google to find some help for this, but i got no luck with that :( $stringA = "AA"; $stringB = "BB"; $string = "AA oneword BB AA two words BB"; $pattern = "/$stringA.\w*.$stringB/"; $replacement = ""; echo preg_replace($pattern, $replacement, $string); i think it have to do something with the \w in the pattern, is there a parameter to resolve my problem too? regards manuel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Remove Dynamic String between StringA and StringB
Hi :), i'm looking for a function to remove multiple dynamic parts of a string, there are only the start and end strings given (remove all between string A and string B) got somebody a working procedure for that? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting content with fput, SESSIONS and frames
Hi Guys, i wanna get some content from an other website with a sessionid and a frameset. my starting code looks like this: http://domain.tld/frameset.php?q=string";, "r"); if($fp){ while($in = fread($fp, 1024)) $reply .= $in; echo ("$fp\n\n"); echo ("$reply\n\n"); fclose($fp); } ?> now i got in $replay a frameset that links to the main.php without the session id. the paket header including the forward looks like this: HTTP/1.1 302 Found Date: Mon, 26 Jan 2004 11:38:51 GMT Server: Apache X-Powered-By: PHP/4.3.1 Location: http://domain.tld/c17c340a3e6a2cb268451f3eda5930ce/frameset.php?q=string Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Connection: close Content-Type: text/html now i'm looking for a method to get the location into a $var to extract the sessionid any ideas for that? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: basic set and read a cookie probs
Sorry, No such thing as $_POST_VARS "Jack E. Wasserstein" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am using the following code on the php form handler > > if ($_POST[referdrremember] == "true") { > setcookie("remailcookie", > "$_POST_VARS[refdremail]",time()+3600,"/","wasserstein.com","0"); > > Try to see the cookie in the same script, not sure which one to use with or > without $ > > print " the cookie's value is $HTTP_COOKIE_VARS[remailcookie] "; > print " the cookie's value is 2 $HTTP_COOKIE_VARS[$remailcookie] "; > > In addition when I get back to the calling form and refresh it I try to see > the cookie with this: > > if ($HTTP_COOKIE_VARS[remailcookie]) { > print ("remail cookie exists"); } > else { > print ("no cookie"); > } > > This yeilds "no cookie" > > I have also tried $_COOKIE[] as well > > > What am I doing wrong. > > Thanks in advance, > > Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] basic set and read a cookie probs
I am using the following code on the php form handler if ($_POST[referdrremember] == "true") { setcookie("remailcookie", "$_POST_VARS[refdremail]",time()+3600,"/","wasserstein.com","0"); Try to see the cookie in the same script, not sure which one to use with or without $ print " the cookie's value is $HTTP_COOKIE_VARS[remailcookie] "; print " the cookie's value is 2 $HTTP_COOKIE_VARS[$remailcookie] "; In addition when I get back to the calling form and refresh it I try to see the cookie with this: if ($HTTP_COOKIE_VARS[remailcookie]) { print ("remail cookie exists"); } else { print ("no cookie"); } This yeilds "no cookie" I have also tried $_COOKIE[] as well What am I doing wrong. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pgp form handler will not display data
There must be something obvious that I am missing but I cant get the php form handler with the script below to display the vairables. The form which sends this data has the correct field names. I am also using the get action, so I can see the variables and values so I know that they are being passed correctly to the form. On submit, the form below displays as follows below. \n"; print " the referral date is $dateofreferral .\n"; print " the patients first name is $pfirst .\n"; print " the patients last name is $plast .\n"; print " the patients telephone number is $telephone .\n"; print " the referring doctor email is $refdremail .\n"; print " the upload is $imageupload \n"; ?> output from patreferhandler.php?%24referringdr=sample+person&[EMAIL PROTECTED] .com&dateofreferral=12%2F03%2F03&pfirst=clientfirst&plast=clientlast&telepho ne=555-&imageupload=&Submit=Submit the referring doctor is . the referral date is . the patients first name is . the patients last name is . the patients telephone number is . the referring doctor email is . the upload is Thanks, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phphandle form wont display data
This must be obvious, but I am having trouble displaying the results of a form in the php handler. Here is the php code in the handler: \n"; print " the referral date is $dateofreferral .\n"; print " the patients first name is $pfirst .\n"; print " the patients last name is $plast .\n"; print " the patients telephone number is $telephone .\n"; print " the referring doctor email is $refdremail .\n"; print " the upload is $imageupload \n"; ?> I am using the get action on the actual form and I can see all of the values being passed to the script. The spellings of the -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to swap the table's bg color with php
Dear all I had write a script using php,which will pull the values from a mysql table to display in HTML. now i want to add a function which when the mouse had move over a table cell, the background of the table cell will turn to other color! Is anyone know how i can perform this task? Thx alot! Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF Problem
Dear all I want to convert a text file to pdf format and store it in somewhere in my harddisk. I had found out that there is a dll inside my php4.04 directory ("c:\php\extensions\php_pdf.dll") and from php.ini i had check that the extension_dir=c:\php\extensions; extension=php_pdf.dll had actived; now i obtained a simple script from the net, and tried to test it , but it return alot of errors! Here is the testing script : and here is the error message i got when i ran the script : X-Powered-By: PHP/4.0.4pl1 Content-type: text/html Warning: Function registration failed - duplicate name - pdf_set_info in C:\InetPub\wwwroot\Nedcor Internal Live\test\hello.php on line 2 Warning: Function registration failed - duplicate name - pdf_set_info_creator in C:\InetPub\wwwroot\Nedcor Internal Live\test\hello.php on line 2 Warning: Function registration failed - duplicate name - pdf_set_info_title in C:\InetPub\wwwroot\Nedcor Internal Live\test\hello.php on line 2 Warning: Function registration failed - duplicate name - pdf_set_info_subject in C:\InetPub\wwwroot\Nedcor Internal Live\test\hello.php on line 2 Warning: pdf: Unable to register functions, unable to load in Unknown on line 0 Fatal error: Call to undefined function: pdf_new() in C:\InetPub\wwwroot\Nedcor Internal Live\test\hello.php on line 6 PHP Warning: Unable to load dynamic library 'c:\php\extensions/libpdf_php.dll' - The specified procedure could not be found. in Unknown on line 0 Can anyone seens this before? if so, could you please give me some hints how i can convert a text file to pdf file under windows environment? Thx alot Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can we control the content of MS Outlook Express
Dear all Here is the question: I had a link which will open user's outlook express and let the user to type the content and send it to me! Now i want to set some content which will appear on the outlook express and then user will type the rest of the content to it and send it to me! is this possible? Thx alot Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to make a global scope array
Thank you very much! "David Nicholson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, This is a reply to an e-mail that you wrote on Sat, 26 Jul 2003 at 00:50, lines prefixed by '>' were originally written by you. > Ouch! > Sometimes I wish global didn't exist Yes, it can be better to pass in a variable (by reference if you need to write to it from within a function and not have it as the value that you return), e.g. function doSomething(&$a){ $a = 20; return true; // to signify success } $a = 10; doSomething($a); echo $a; // prints 20 -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to make a global scope array
It works! Thanks guys! "David Nicholson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, This is a reply to an e-mail that you wrote on Fri, 25 Jul 2003 at 23:51, lines prefixed by '>' were originally written by you. > <[EMAIL PROTECTED]> > Jack Lee: > > //I have an array a[] like this: > > > $a[]=0; > > //How to define and use it in a function like this? > > function myfunc(something) > > { > > echo $a[0]; //got error here Notice: Undefined variable: > > } > > //Thanks for any help.!!! > global $a; .. or echo $GLOBALS['a'][0]; David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to make a global scope array
//I have an array a[] like this: //Thanks for any help.!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need a function to calculate time difference.
datetime. Thanks Jim Lucas wrote: what type of format does your column take? date time datetime ?? Jim Lucas - Original Message - From: "Jack Sasportas" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> Sent: Wednesday, July 02, 2003 2:11 PM Subject: [PHP] Need a function to calculate time difference. I am trying to find a function or information on how to properly take a start time and an end time from mysql timestamps in order to calculate time taken. So in theory $endtime-$starttime = timespent. It would be great if this understood that 11:55 pm til 12:10am one day apart only equals 15 minutes. Links, example code etc would be great! Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Need a function to calculate time difference.
I am trying to find a function or information on how to properly take a start time and an end time from mysql timestamps in order to calculate time taken. So in theory $endtime-$starttime = timespent. It would be great if this understood that 11:55 pm til 12:10am one day apart only equals 15 minutes. Links, example code etc would be great! Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] odd problem
"Sebastian" <[EMAIL PROTECTED]> wrote: > having a little problem. I know i have a connection to the mysql database > but for some reason i can't get this to update the database when submit is > clicked. perhaps i am overlooking something.. Here is part of the script: > > if($HTTP_POST_VARS[send]) { > > $result = $db->sql("UPDATE comments SET reported = '1' WHERE id = > '$HTTP_GET_VARS[comment]'"); > > } from where do you get this: $HTTP_GET_VARS[comment] ?? ( GET <--> POST, 'comment'? ) > echo " > > > > "; > > Its suppose to update mysql once the submit button is pressed, but its not.. > Is the form ok? looks ok -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Q. How to remove new line/CrLf in string??
Thank you very much. Jack André cupini wrote: > >Part 1.1Type: Plain Text (text/plain) >Encoding: quoted-printable -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php