apple
Members-
Content Count
32 -
Joined
-
Last visited
About apple
-
Rank
Member [ Level 1 ]
-
I want to update mysql records with basic form by using OOP PHP. Im doing in following way but i want to do by a function, so that i dont. please anybody help me, how can that. Thanks everybody. <?if($_POST[submit]){ $title = $_POST['title']; $body = $_POST['body']; $result = mysql_query("UPDATE blog SET title='$title', body='$body' WHERE id='$postid' ") or die (mysql_error()); echo "<b>Thank you! News UPDATED Successfully!<br>"; } ?><?$result = mysql_query("SELECT * FROM blog WHERE id='$postid' ") or die (mysql_error()); while($myrow = mysql_fetch_assoc($result)) { $title = $myrow["title"]; $body = $myrow["body"]; ?><br><h3>::Edit News</h3><form method="post">Title: <input name="title" size="40" maxlength="255" value="<? echo $title; ?>"><br>Text1: <textarea name="body" rows="7" cols="30"><? echo $body; ?></textarea><br><input type="submit" name="submit" value="Submit"></form>
-
Hello.. Im looking for some help. I want to use preg_replace function to replace the following type of code tags. <code lang="php"></code><code lang="javascript"></code><code lang="css"></code> My question is that, in the above code tags, language (lang) is not always same, how can i use preg_replace with the above code tags to place them with something. Any help will be very much appreciated. thanks.
-
Need Some Help In File Browser listing all sub folders and files in them.
apple replied to apple's topic in Programming
okay.. Below, the file fb4.php contains your solution 1 code and is located in directory "fb" . there are many sub directories, the following adress appears after clicking on a subdirectory name "images". LOCALHOST/test/fb/fb4.php?dir=images/ This page prints only this "Unable to open"... it can not open any subdirectory. -
Need Some Help In File Browser listing all sub folders and files in them.
apple replied to apple's topic in Programming
Thank you once again for your detailed explanation.. i really appreciate it.. your first solution is very nice.. but when i click on any subdirectory.. i get the message "Unable to open".. why it is unable to open the subdirectory -
Need Some Help In File Browser listing all sub folders and files in them.
apple replied to apple's topic in Programming
Thanks for your help.. but this code displays all the files of sub-folders on the index page.. i want to display the sub-folder files when clicked on the sub-folder.thanks. -
Hey I want to create a very simple file browser, so that, it reads all the sub-folders which are places in a directory, and the files inside the sub-folders (It reads only files inside sub-folders and list them in simply. ) Also, it creates a directory (any name) inside each sub folder. My Following code reads on the files inside the main directory, it does not read the files inside the sub-folders.. I appreciate any help. <?$path = "./";$dir_handle = @opendir($path) or die("Unable to open $path");while ($file = readdir($dir_handle)) {if($file == "." || $file == ".." || $file == "index.php" )continue;echo "<a href=\"$file\">$file</a><br />";}closedir($dir_handle);?>
-
I am trying to do a simple thing. I want to display all the images of a directory on a single page with the checkbox next to each image, so that i can select multi images and i can delete selected images. Following few lines of code display the images of a directory.. i need help to put the check boxes with each image. and I dont understand how can i select multi images with check box and then delete them. I hope someone can help. thanks. <?php$path = "./";$dir_handle = @opendir($path) or die("Unable to open folder");while (false !== ($file = readdir($dir_handle))) {if($file == "index.php")continue;if($file == ".")continue;if($file == "..")continue;echo "<img src='$file' alt='$file'><br />";}closedir($dir_handle);?>
-
There are many websites which offer free sms from website to mobile phone devices. I want to ask what is the technology behind that? Is it some SMS gateway? If someone want to create this service, is it free ? I want to know more about it, if someone can give me more information?Thanks
-
yes i have windows vista ultimate edition.. what i want to do is, to have dynamic ip.. i have static ip all the time.. but i need dynamic. any help will be very appreciated. thanks
-
Yes im on a network and i think its my lan ip.(i dont get internet connection directly from isp).. can you please tell more details about it.. how can i do that? thanks
-
I have static ip. I want to convert it into dynamic ip. please let me know if its possible to do with the help of any software?thanks
-
Can someone please have a look at the following code, this uploads an image, and make it in 2 sizes, one size is max. 600 x 800, uploads to images folder and second 120 x 120 and uploads to thumbs folder.this script works fine, with normal size images, but if i try to upload large pics( for example, an image with dimension 2432 x 3300, it shows blank page, and uploads the original image without sizing to "image" folder, and doesnt make any small thumbnail... I hope u understand.. Please someone help me, i shall be so thankful. <?PHPsession_start(); header("Cache-control: private");function Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path) { $s_path = trim($s_path); $o_path = trim($o_path); $save = $s_path . $save; $file = $o_path . $file; $ext = strtolower(end(explode('.',$save))); list($width, $height) = getimagesize($file); if(($width>$t_w) OR ($height>$t_h)) { $r1 = $t_w/$width; $r2 = $t_h/$height; if($r1<$r2) { $size = $t_w/$width; }else{ $size = $t_h/$height; } }else{ $size=1; } $modwidth = $width * $size; $modheight = $height * $size; $tn = imagecreatetruecolor($modwidth, $modheight); switch ($ext) { case 'jpg': case 'jpeg': $image = @imagecreatefromjpeg($file) or die ("Seems to be problem"); break; case 'gif': $image = imagecreatefromgif($file); break; case 'png': $image = imagecreatefrompng($file); break; } imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) or die("he"); imagejpeg($tn, $save, 100) or die ("heheh");; return;}function write_beg($filename, $data){ $handle = fopen ($filename, "r"); $old_content = fread ($handle, filesize ($filename)); fclose ($handle); $final_content = $data.$old_content; $handle2 = fopen ($filename, "w"); $finalwrite = fwrite ($handle2, $final_content); fclose ($handle2);} # check to see if form submitted# if yes, process form variables# if no, display formif($_POST["action"]== "Upload Image"){ # define the constant variables $uploadDir = 'images/'; // main picture folder $max_height = 600; // largest height you allowed; 0 means any $max_width = 800; // largest width you allowed; 0 means any $max_file = 2000000; // set the max file size in bytes $image_overwrite = 1; // 0 means overwite; 1 means new name $allowed_type01 = array( "image/gif", "image/pjpeg", "image/jpeg", "image/png", "image/x-png", "image/jpg"); // add or delete allowed image types $do_thumb = 1; // 1 make thumbnails; 0 means do NOT make $thumbDir = "thumbs/"; // thumbnail folder $thumb_prefix = ""; // prefix for thumbnails $thumb_width = 120; // max thumb width $thumb_height = 120; // max thumb height $flat_file = 1; // 1 flat file for data; 0 database $what_error = array(); # get basic info about uploaded file $original_name = $_FILES['imagename']['name']; $original_tmp = $_FILES['imagename']['tmp_name']; $original_size = $_FILES['imagename']['size']; $original_type = $_FILES['imagename']['type']; # do some basic error trapping and cleanup if($original_size>$max_file) { //too large, go back to form array_push($what_error, "File Size Exceeds Limit"); } if( $original_size<1) { //no file was uploaded array_push($what_error, "Please Select A File To Upload"); } if(!in_array($original_type, $allowed_type01)) { // wrong file type array_push($what_error, "File Type Is Not Allowed"); } if(count($what_error)>0) { // send to error page $_SESSION["resultset"] = $what_error; echo $what_error; //echo '<meta http-equiv="refresh" content="0;URL=mpg_error.php"> '; exit(); } # check to see if file already exists in the folder # if it exists AND rename option is , create new name $does_it = FALSE; $original_name = strtolower($original_name); if(file_exists($uploadDir . $original_name)) { if($image_overwrite == 1) { //rename while(!$does_it) { $add_this_name = rand(1,200); $original_name = $add_this_name . $original_name; if(!file_exists($uploadDir . $original_name)) { $does_it = TRUE; } } } } # attempt to MOVE the image to its proper location $uploadFile = $uploadDir . $original_name; if (move_uploaded_file($_FILES['imagename']['tmp_name'], $uploadFile) ) { // continue } else { // send to error page array_push($what_error, "error - unknown cause"); $_SESSION["resultset"] = $what_error; echo "error - unknown cause"; //echo '<meta http-equiv="refresh" content="0;URL=mpg_error.php"> '; exit(); } # check to see if image needs resizing and act accordingly list($original_width, $original_height) = getimagesize($uploadDir . $original_name);//echo $original_height; if($max_height<$original_height OR $max_width<$original_width) { // dimensions are too large - resize Resize_Image($original_name,$original_name,$max_width,$max_height,$uploadDir,$uploadDir); echo "image resized done<br>"; } # check to see if make thumbnails is true # if yes make and store thumb $thumb_name = $thumb_prefix . $original_name; if($do_thumb == 1) { // make a thumb Resize_Image($thumb_name,$original_name,$thumb_width,$thumb_height,$thumbDir,$uploadDir); echo "thumb too"; }}else{?><html><head><title>My Photo Gallery Upload Form</title><link rel="stylesheet" type="text/css" href="shared_files/textsize.css"></head><body bgcolor="#ffffff" text="#0000a6" link="#0000a6" vlink="#0000a6" alink="#0000a6"><div style="position: absolute; top: 50px; left: 300px; width:90%; font-size:10pt; padding:10px;filter:shadow(color:gray);"><div style="HEIGHT:250px; border : solid 2px #0000a0; padding : 4px; WIDTH:380px; OVERFLOW:auto; background-color:#fcfcfc; layer-background-color:#fcfcfc; visibility: visible; "><form action="<?php echo $PHP_SELF ?>" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="2000000">Browse a File to Upload: <br> <input type="file" name="imagename"><br>Enter a title for the picture<br><input type="text" name="imagetitle" size="40" maxlength="80" value=""><br>Enter your name<br><input type="text" name="artistname" size="40" maxlength="80" value=""><br>Enter a description for the picture<br><input type="text" name="imagedescript" size="40" maxlength="250" value=""><br><input type="submit" value="Upload Image" name="action"><br><br>note: <font color="#ff0080">max file size is: 2megs</font></div></div></body></html><?PHP}?> Notice from truefusion: Placed code into codebox.
-
suppose i make a dropdown menu having value 1, 2, 3, 4, 5, one option can be selected, and selected option is stored in database. now i create an edit page, how do i display the selected value in the menu and other values in dropdown, for example, Menu is like Select One 1 2 3 4 5 and i select 3, this 3 is stored in database, now on the edit page i want to show 3 as already selected, something like that.. [quote]<select name="select_thing"> <option value="1">1</option> <option value="2">2</option> <option value="3" selected>3</option> <option value="4">4</option> <option value="5">5</option></select>[/quote]I will be very thankful, if someone could help by explaining how do i make option 3 as selected.. eg. how i know option 3 is selected and stored in db.
-
I want to create a simple dropdown menu, which gets data from mysql.. but i need some help... that, for example, my dropdown menu looks like-- Select --Option1Option2Option 3im not getting the right syntax to get the selected option and then do something with that selected option..e..g if i select option1, i want to print.. "option 1 selected" etc. can someone help me with this pls.