Jump to content

freebsdntu

Members
  • Posts

    56
  • Joined

  • Last visited

    Never

Everything posted by freebsdntu

  1. Thank you for your reply,rajivgonsalves .I tried your method, but got this: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent I remember I read somewhere that session_start() should always be the first statement,I don't know whether it is due to this reason. Also,does that mean I must include the file in every php file that I am gonna use the object?
  2. I have created a user class for user,in the class, there are profile attributes like names,email,etc and I also have get and set method for each of the attribute. Besides those, there are also user action methods like browseProfile,editProfile,etc When a user log in,I will instantiate a user object,the problem is how to remember the object so that other php files can also use it?I have tried something like this:$_SESSION['user'] = $user, where the $user is the object.But id did not work. Does anybody have any suggestion on how to do this? Thank you very much!
  3. Ok,thank you for your useful inputs,I got it.
  4. Hi guys, I am building a system where there are 2 types of users,odinary user and super user,when they login,they will both have a control panel,but with different user actions based on their user type. So for the logged in page, should I write seperate pages for each type or should I just write one page, with conditional php? Thank you in advance!
  5. Ah,sorry,my fault,I did a google search just now, and it is input tag. But I tried with the form tag, it works as well, don't know why.
  6. should the input tag be form tag,I guess? Thank you very much,rajivgonsalves. Now it works fine! Can you also give me some explanations on that?
  7. I wrote a php registration file which contains both the presetation - the form, and the logic to get the user input. The problem is when loading the page, the php logic will be executed even when user has not entered anything yet, how do I handle this problem? Previously I created two seperate files, register.html and register.php, where the form action would trigger register.php, and it worked fine. Any hints?Thank you very much!
  8. thank you very much,flamerail,now I got it!
  9. Oh,by the way,sKunKbad.If all put in php,do you do it like this?(use php also to echo the html elements) <?php echo "<html></html>" ?> or like this?(php embeded in html where neccessary) <html> <?php ?> </html>
  10. Thank you for both of your inputs,sKunKbad and Daniel0. By the way,daniel, template? What do you mean by that? Like css? or other html template?
  11. Hi guys,I am having a bit of design doubt here. Should I write all the code in php file? Or should I present the presentation(i.e. forms) in plain html file and create another php file for the server-side functionality(i.e.form handling?)? Which approach is better? Any hints?
  12. Hi guys,I am trying to write a very simple photo album, like the one on msn space. I am planning to make use of both php and javascript, actually I would prefer to use more of js to handle client side operations. What I am trying to do now as a start is to get all the image urls of a album folder on the server. I tried to store all the image urls into an array in server side php, the question is how do I pass the array to client side so that my javascript code can access it? here is the php code I have written, just for reference. <?php class PhotoAlbum { var $albumUrl; /*the url of the album*/ var $size; /*totl number of images in the folder*/ /*class constructor*/ function PhotoAlbum($albumUrl) { $this -> albumUrl = $albumUrl; $this -> size = 0; } /*function to get total number of photos in an album*/ function getSize() { $this -> getImageUrls(); return $this -> size; } /*function to store the urls of each image into an array and returns the array*/ function getImageUrls() { $imageUrls = array(); if (!($dir_handle = opendir($this -> albumUrl))) echo "cannot open directory '$this -> albumUrl'"; while ($file = readdir($dir_handle)) { $size = $size + 1; array_push(imageUrls,$file); } $this -> size = $size; return $imageUrls; } } ?> Also I would love to hear better approaches regarding the design?
  13. I am writing a script to display user profile and let the user edit his or her profile. Regarding the password field,since it is stored as md5 hash string in the database,so how can I get it back to normal string? Also would there be any security issues in doing the conversion? I would display the password as password input type,of course. Any hints?Thank you!
  14. Wow,great,thank you so much,rajivgonsalves Could you explain to me what function does the .. around $fname do? Also, since $fname is alreay a string variable, why do I have to include ' ' to .$fname.? Thank you very much!
  15. function editProfile() { echo '<html><head></head><body><form><table> <tr><td><label for = "Fname"></label></td><td><input type = "text" id = "Fname" value = ""></td></tr> </table></form></body></html>' } I have a function to retrieve the Fname field from database,the problem is how am i set it as the default value for the input field
  16. I am writing a php code to retrieve user profile from database and display the data,also let the user to edit his or her profile. I use php to echo the form.For instance, for the username field. <input type = "text" id = "username" name = "username" value = ""> What am i gonna write to the value = "" attribute?So that it loads with the profile? Thank you!
  17. thank you,adam,that's very useful piece of information,I am gonna study it thoroughly.Thank you very much!
  18. Wow,that's great,can you give me some solid examples?Like how do I change the content?
  19. I just did a google search,if I understand it correctly,it should be implying the start of a query string. Back to the main issue,if I do that,I would have to load the entire page,don't I? What if I only want to load the content portion,rather then the link portion which is the same for all the pages?
  20. Wow,that's nice,no wonder I see all those ?page= strings in many urls. I would definitely look into this. By the way,what actually does the ? symbol function there? Any good tutorials on this? Thank you very much!
  21. Hi, the design is like this. In a webpage,I have a left side navigator occupying about 20% of the width,the remain 80% on the right becomes the content part. Say in the navigation bar,there are several links, and I would like to display corresponding contents on the right depending on which link the user presses. How do I achieve this? I have heard of the Iframe approach, but my concern is the compatibility with browsers,is there an alternative way to achieve it in php? Thank you very much!
  22. Thank you very much for the hints,Northern Flame.I got it done!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.