General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 30th, 2003, 11:27 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
Question text area and hyperlinking

Hi everyone,

Is it possible to make tha contents of a text area hyperlinked so clicking one line will repopulate the text area with fresh contents based on link?

eg

Display all directories in the drive in the text area. clicking on a directory name should repopulate textbox with the clicked directory contents



Thanks in Advance.

Aparna

Reply With Quote
  #2  
Old December 30th, 2003, 11:36 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
To my knowledge, this is not possible. You could achieve a similar effect by using a DIV whose style makes it look like a textarea and whose overflow property is set to "scroll." This would allow you to have clickable links while emulating the appearance of a textarea.

Reply With Quote
  #3  
Old December 30th, 2003, 12:21 PM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
thanks alot . will look into that
apu

Reply With Quote
  #4  
Old January 1st, 2004, 08:28 PM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
i am using a list area to display the contents.the directory names there are hyperlinks .My problem now is clicking the links just refreshes the page instead of displaying the clicked directory contents.
HAPPY NEW YEAR
Thanks in advance.
Apu.

Reply With Quote
  #5  
Old January 2nd, 2004, 06:50 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Can you point me to the page? I'm having trouble envisioning exactly what's going on.

Reply With Quote
  #6  
Old January 3rd, 2004, 10:01 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi,
this is the link to my page

i think i have really messed up the whole thing

any help would be greatly appreciated
thanks in advance.
Apu
http://www.symonds.net/~dosai/aparna
the file is test1.php

Reply With Quote
  #7  
Old January 3rd, 2004, 10:54 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
It's kind of hard to decipher exactly what your code's doing, but my guess is that when you have a directory selected, validation() is returning true and the page is submitting itself because you gave it no action.

Maybe try moving the last line of validation() up above the return true statement. The script is never getting to that line because it returns, and perhaps moving it up will set a variable that your PHP uses to list the selected directory's contents.

Reply With Quote
  #8  
Old January 3rd, 2004, 11:05 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi,
i thought that was more to do with the onchange property of teh select box or is it not?

Reply With Quote
  #9  
Old January 4th, 2004, 08:30 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
please help out coz am in a real mess and running short of time.

Reply With Quote
  #10  
Old January 6th, 2004, 08:31 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Did you try what I had suggested?

Reply With Quote
  #11  
Old January 6th, 2004, 09:43 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
yes i did and it did not work

i am not able to figuer out why my list area is acting dynamic and resizing on every click

Reply With Quote
  #12  
Old January 6th, 2004, 10:41 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
Are you referring to the width of the SELECT box? If so, it changes width depending on the content inside it. It is possible to overide the width by using CSS.

e.g.
Code:
<select style="width:200px;">
  <option>foobar</option>
</select>

Reply With Quote
  #13  
Old January 6th, 2004, 11:27 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Looks like it's working alright to me. As far as the width, stumpy's dead on.

Reply With Quote
  #14  
Old January 6th, 2004, 12:08 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
Oh yeah - the directory browsing stuff seems to work fine for me too.

I get a page full of PHP errors when I initially load the page though.

Reply With Quote
  #15  
Old January 6th, 2004, 01:04 PM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi,
thanks alot stumpy and dhouston , that was very easy and effective solution.
just one small problem my path keeps getting appended ie when starting from a base directory eg var, it appends to prev path and adds a extra /
Thanks again
Apu

Reply With Quote
  #16  
Old January 6th, 2004, 04:08 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Post a short code snippet and maybe we can take a look and help you figure it out.

Reply With Quote
  #17  
Old January 6th, 2004, 09:16 PM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi
heres what i am using:
PHP Code:
 $output=
"<select onchange=\"this.form.submit();\"   name=\"directory\" size=\"9\"      style=\"width:700px;\">";                         

if(
$dirpath=="")          
{          
$dirpath="/";          
echo 
"<input type=\"hidden\" name=\"a\" value=\"1\">";         
}                         

$directory $_POST['directory'];          $dirpath $_POST['dirpath'];          $filelist="";          
$thisdirectory=$dirpath '/' $directory;    

$output "<input type=\"hidden\" name=\"dirpath\" value=\"$thisdirectory\">" $output

echo 
"<input type=\"hidden\" name=\"b\" value=\"$thisdirectory\">";          

if(
filetype("$thisdirectory")!='dir')          
{          
$output .= "<option   value=\"$thisdirectory\">$thisdirectory</option>"$a=1;          
}          
if(
$a!=1)          
{          
$dir opendir ("$thisdirectory");         while ($filereaddir ($dir))          
{           
if(
filetype("$dirpath")=='dir')         
{         
 
$output =$output "<option value=\"$file\">$file</option>";          
}          
else         
 {          
$filelist =$filelist "<option value=\"$file\">$file</option>";          
}          
}          
closedir ($dir);          
}          
$output $output $filelist "</select></form>";          
echo 
$output

thanks
Apu

Reply With Quote
  #18  
Old January 7th, 2004, 08:23 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
I think you're getting the extra path because you say "$dirpath='/'" if $dirpath is blank. A few lines further down, you set $thisdirectory to $dirpath (which you've just set to "/" plus "/" plus $directory -- so there's an extra slash.

Reply With Quote
  #19  
Old January 7th, 2004, 09:11 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
well if i dont set that ,
then the list area turn up empty
also when i get into subdirs, the dirs are concatted ie varwww instead of var/www

Reply With Quote
  #20  
Old January 7th, 2004, 10:39 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Perhaps you should consider using a variable name other than $dirpath. If register_globals is turned on in your php.ini, then $dirpath holds the value of $_POST["dirpath"]. So when you do your initial test to see if $dirpath is blank, if the form has been submitted, it's not blank, and you're setting it to /. Or in any case, you're always resetting $dirpath to $_POST["dirpath"] after performing this test and setting $dirpath to /, so it's either extraneous or needs to be reworked. This could explain why if there's no $_POST["dirpath"], you're getting varwww (because even though you've set $dirpath to /, you're overwriting it immediately afterward with the blank value from $_POST["dirpath"].

Reply With Quote
  #21  
Old January 8th, 2004, 09:55 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi,
took care of extra / by stripslashes
however, my path is getting appended to old path
ie when i get back to base directories and start again, i get old path + new path (/var/www/html/./usr/)

Reply With Quote
  #22  
Old January 8th, 2004, 11:33 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Hmm, I don't know. I'm at kind of a loss. To debug further, I'd need the code on my system.

Reply With Quote
  #23  
Old January 8th, 2004, 12:32 PM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
whole code

hi,
heres the whole code,
Thanks alot for all ur help.
Apu
Attached Files
File Type: php test.php (10.3 KB, 715 views)

Reply With Quote
  #24  
Old January 8th, 2004, 01:07 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Use the following line

PHP Code:
 $dirpath .= (($dirpath=="/")?"":"/") . $directory


in place of:

PHP Code:
 $dirpath .= "/" $directory


so that upon the first submittal, when the path is /, you're not appending another / after it.

Also, this is a no-brainer, but I presume you're going to tighten security on this so that, for example, somebody can't browse to /etc and delete your passwd file.

Reply With Quote
  #25  
Old January 8th, 2004, 09:19 PM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi,
thanks alopt, that took care fo extra slash
but its still appending.
this is what i am getting:
/var/lock/../../etc
it should start afresh from etc
ie /etc
Apu

Reply With Quote
  #26  
Old January 9th, 2004, 07:39 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Just write a function that checks to see if the directory clicked is "..". If it is, split the path on slashes and stick the parts in an array; then pop the last element off and join the array on slashes to build the new path. Do another test for "." and just don't modify the directory if it's clicked.

Reply With Quote
  #27  
Old January 10th, 2004, 01:06 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
Red face

hi,
am sorry but could u elaborate alit more.
am a still a bit in the dark.
Apu

Reply With Quote
  #28  
Old January 14th, 2004, 01:46 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
hi,
got it right, used realpath
thanks alot everyone for ur advice and help;
Aparna

Reply With Quote
  #29  
Old January 14th, 2004, 07:55 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
Oops, didn't see your last post. Glad you got this working. Don't forget to validate what files/directories you allow people to manipulate.

Reply With Quote
  #30  
Old January 26th, 2004, 03:59 AM
aparna aparna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 17 aparna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 34 sec
Reputation Power: 0
well, will sure doand thanks alot

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > text area and hyperlinking


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap