Re: [PHP] CHAT about PHP
Sites like these will drive me to ASP... On Wed, 2003-08-20 at 17:39, David Otton wrote: On 20 Aug 2003 11:31:02 -0400, you wrote: On Wed, 2003-08-20 at 11:11, Curt Zirzow wrote: * Thus wrote Damian Brown ([EMAIL PROTECTED]): www.phpexpert.org Programming Help and General Programming Topics Is this a joke? Looks like an email harvester. Why does it need an email address? Search-engine spammer and an onClose popup ad, too. And multiple!!! exclamation!!! marks!!! Yeah, that's someone I'd do business with. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image upload and scaling
Hi, I am trying to make a util whereby ppl can upload their own images to my server for me to automatically display them. The below code works fine, but I have the following problem. It only works fne if everyone complies to a standard of a set width and height for the image. This is not always possible, so I'm looking for a way to accept the image in any form they have and then to scale it to fit within an acceptable height/width range. This I need help with, so if someone could hep me ( at the hand of my current code) I would be very pleased. Thanks Petre below my code snippet ?php if ($submit) { if ($file != none) { $current_time = time(); $location_pic = /home/www/imgs/listings/.$current_time.$file_name; $url_pic = http://www.website.co.za/imgs/listings/.$current_time.$file_name; copy ($file,$location_pic); $db= mysql_pconnect(localhost,db_user,db_password); mysql_select_db(DB_NAME,$db); $sql = update table set location_pic = \$location_pic\, url_pic = \$url_pic\ where id = \$id_pic\ ; $result = mysql_query($sql); } echo Picture Uploaded! Thank You!br; echo Below is a preview of how your logo will look. If it displays incorrectly, adjust your image with an image editor of choice and upload again.br; echo img src=\$url_pic\ width=\350\ height=\150\; }else { echo Please use this form to upload image.brbrbr form method=\post\ action=\$PHP_SELF\ enctype=\multipart/form-data\ Logo Location : input type=\file\ name=\file\brbrbrbrPlease Note!Your image must be smaller than 50KB! input type=\hidden\ name=\MAX_FILE_SIZE\ value=\5\ input type=\hidden\ name=\id_pic\ value=\$id\br input type=\submit\ name=\submit\ value=\submit\ ;} ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mail function
Hi, I'm not sure this is the right list to post this, and i'm not even sure if there is already a solution to this problem, in which case, sorry... Ok, my problem: PHP has (as you all know) a mail() function which is very handy to send mail to people. Now, with the advent and subsequent ease of MySQL into the picture, anyone who have a bit of time on their hands and a table filled wiith e-mail addresses, can easily write a loop sending bulk mail or spam to thousands of users listed in the table. The problem with this as you might know, is that the mail() function seems to invoke a new sendmail process (on Unix boxes) for each mail() call, meaning that you can very quickly crash your sendmail if you have a fast enough server and a large enough list of addresses in the table. I know that using php to send so much mail is not the right answer, but there are people out there who DON'T know this, and are using this method, or at least trying to, causing great headaches to many administrators, as there is no way of preventing someone (barring a full on removal of the user's rights) from doing so again and again. Now, my question is, isn't it possible to re-write the mail function to instead of treating each call to the mail function as a separate event, to rather see it as a global event, ie., when called, it will always assume that more is coming until it gets a finished call. This way, surely, it should be possible to have the entire batch sent directly to the mail queue instead of trying to send the messages immediately as it comes in, thereby clogging sendmail and causing it to shut down... Unfortunately, I am not a programmer, so I would not be able to help much when it comes to doing this, but maybe the guys working on the code could look into this? Like I said, I am not sure if there might already be another way of solving this (not third party solutions like mailling list managers...) but if there is, and someone reading this and knows of one, please post me the solution! I really need to know that a single user on one of my websites cannot cause the entire systems mail to clog. Thanks alot, and keep up the good work, PHP is still the best! Petre Agenbag South Africa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Putting variables in a string
I am trying to make a string that will contain variables. The resulting string will be a sql query string and must look something like update $table_name set key='$key' , next='$next' where id = $id Since the variable name is the same as the key name, I tried to generate this string with a foreach statement looking something like this: foreach( $myrow as $key=$val) { $sql .= $key = ' \$$key ' ,; } This then makes the string look as follow: key='$key',next='$next', and I just add the rest of the string to the front and back, yet, when I now try to use this string in the mysql_query() function, it does not recognise the '$key' and '$next' as variables and add them into the db as $key and $next. I need to know how I am going to make this string recognise the variables in them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Generating Variables
Hi I am trying to auto generate some sql strings. The resulting string should look like this: update $table_name set var1='$var1', var2='$var2' . where id=$id I used a foreach loop to get the keys from a table and in each foreach loop I tried the following. foreach($myrow as $key=$val) { $var_list .= $key = '\$$key', ; } The first php page is the table generator; VIEW_ALL.PHP ?php $username_1 = user; $password_1 = password; $db_name = test; $table_name = users_db; $link = mysql_connect(localhost,$username_1,$password_1); mysql_select_db($db_name,$link); $sql = select * from $table_name; $result = mysql_query($sql); $result_2 = mysql_query($sql); echo table border=\1\; $myrow = mysql_fetch_assoc($result); echotr bgcolor=\#CC\; foreach($myrow as $key=$val) { echo tdb$key/b/td; } echo/tr; $count = 2; while($myrow_2 = mysql_fetch_assoc($result_2)) { $id = $myrow_2[id]; if ($count == 2) { $bgcol = #FF; $count = $count - 1; } else { $bgcol = #EFEFEF; $count = $count + 1; } echotr bgcolor=\$bgcol\; foreach($myrow_2 as $key=$val) { echotd$val/td; } echotda href=\edit.php?id_1=$idtable_name=$table_namedb_name=$db_nameusername_1=$username_1password_1=$password_1\Edit/a/td; echo/tr; } echo/table; ? Goes through to EDIT.PHP ?php $link = mysql_connect(localhost,$username_1,$password_1); mysql_select_db($db_name,$link); $sql = select * from $table_name where id=$id_1; $result = mysql_query($sql); $myrow = mysql_fetch_assoc($result); $count_fields = 0; echoform name=\form_1\ method=\post\ action=\update.php?username_1=$username_1password_1=$password_1db_name=$db_nametable_name=$table_name\; echotable border\1\; foreach($myrow as $key=$val) { echotr bgcolor=\#CC\td$key/tdtdtextarea name=\$key\$val/textarea/td/tr; $var_list_1 .= $key = '\$$key',; $count_fields = $count_fields + 1; } echo/table; $count = strlen($var_list); $new_count = $count - 1; $var_list_1[$new_count] = ; echoinput type=\hidden\ name=\var_list\ value=\$var_list_1\; echoinput type=\submit\ value=\submit\ name=\submit\; echo/form; ? And this goes to UPDATE.PHP ?php $link = mysql_connect(localhost,$username_1,$password_1); mysql_select_db($db_name,$link); $sql_1 = update $table_name set $var_list where id=$id; $result = mysql_query($sql_1); echo Your data has been updated!br; echo $sql_1 br; echo result: $resultbr; ? This is where the problems comes in, the SQL is not brought over correctly, rather is written as-is with the single quotes \-ed out, can someone plz help me? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]