Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-22-2006, 07:30 PM Some questions
Extreme Talker

Posts: 217
Trades: 0
1)How would you add/remove something in a array with a form?

2)How can you find certian sessions on the server? IE finding a session where $_SESSION['username']; is bob.

3)What about listing current sessions?

4)Say you had a folder called admin. In it were a bunch of scripts for adminstration of a site. Say you also had a folder called includes that was seperate from the admin folder. In a script inside the admin folder, how would you include a script from the includes folder without including the full url of the site? Basicly, how would you include or access a file from a folder outside the curent one without urls?


I think thats all for now.
Slick Nick is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-22-2006, 11:08 PM Re: Some questions
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
1) I would take the form data and rebuild the old array with current data information.

2 & 3) If you designate the save path to store the sessions, you can iterate through each session file created there. Probably the most effecient way is to create a "Who's Online" table in mysql and refer to that for current live users.

4) You can include other server files by server root path (/home/user/public_html/includes/file.php) or relateive (../includes/file.php)
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-22-2006, 11:41 PM Re: Some questions
Extreme Talker

Posts: 217
Trades: 0
Thanks for replying

1)Hmm... there should be a more efficient way

2&3)I guess that would make sence for the mysql users online thing.. You could have it so that when they log in, updates the database and when they log out they get removed from the database. Problem with doing it like that though is what if they just close the browser?

4)Ohhhh. (../includes/file.php) Does the ".." in that represent somthing or is that just how you put it?
Slick Nick is offline
Reply With Quote
View Public Profile
 
Old 07-23-2006, 12:58 PM Re: Some questions
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
unset() is used for deleting array items. Just dont do something like unset($arrayName), be sure to use the key as well; unset($arrayName[$key]).

Full stops and forward slashes are used for relative paths. Ask Mr Google for articles about 'relative path name'. Be warned though, relative path names are interpreted differently by linux/unix and windows based servers. A more robust, x-platform method of including/requiring files is to build absolute paths from web app constant values; for e.g. $siteURL='http://www.domain.com/'; include ( $siteURL.'includes/file.php');.
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Old 07-25-2006, 12:49 PM Re: Some questions
Super Talker

Posts: 111
Name: Jonathan
Location: Arizona, USA
Trades: 0
Quote:
Originally Posted by Slick Nick View Post
4)Ohhhh. (../includes/file.php) Does the ".." in that represent somthing or is that just how you put it?
".." means to relatively backup one directory. When you place it in your code like mgraphic mentions it tells the script to go back a folder and look for the file.

Quote:
Originally Posted by metho
A more robust, x-platform method of including/requiring files is to build absolute paths from web app constant values; for e.g. $siteURL='http://www.domain.com/'; include ( $siteURL.'includes/file.php');.
I use this method also. When coding it this way, it makes it easier if you're going to be using the same code on a different site. All you would need to do is change the domain name and everything else is done.
__________________

Please login or register to view this content. Registration is FREE
- Computer Repair over the internet!
pcoptimized is offline
Reply With Quote
View Public Profile Visit pcoptimized's homepage!
 
Reply     « Reply to Some questions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18942 seconds with 12 queries