Jump to content

phil.t

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phil.t's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Let me see if I understand correctly what it is you're trying to do. You have users that have profiles, and buddy lists.  The buddy lists are lists of other users.  And for a particular user, you want to retrieve and display information from the profiles of the users in their buddy list.  Is that correct? A little more information about the structure of your database would probably be helpful.  My general advice would be to test the SQL independently (using phpMyAdmin or Access, as jsladek suggested... or even running the query directly at the mysql prompt if you can), and unless you're sure that the query returns the values you expect, make them simpler and start from there. For each buddy on the buddy list, retrieve the information from the tables containing profile information separately (one SQL statement for each table -- calendar, children, parent, etc.)  See if that works for getting the information that you need.  From there if you really need to consolidate your SQL into one statement you can work from the simple to the more complex, and revert back if the changes didn't have the desired result. Good luck.
  2. I would recommend that you store the image paths in a numbered array, and increment through them one by one as the images are clicked. Here's an example: [code] <?php $photos = array (1=>'img/photo_1.jpg', 'img/photo_2.jpg', 'img/photo_3.jpg', 'img/photo_4.jpg'); $curPic = $_GET['id'] + 1; if ($curPic < 5)    echo '<a href="slideshow.php?id=' . $curPic . '"><img src="' . $photos[$curPic] . '" /></a>'; else    echo '<p>End of Show</p>'; ?> [/code] The id displayed in the URL will be one behind the index of the picture actually being displayed.  If that bothers you, then you can modify where you actually increment your index value.  In case it isn't obvious, replace 'slideshow.php' with whatever you name your php file.
  3. oh, and it's always a good idea to escape your \'s.  Thanks.
  4. I think you should be able to accomplish what you're describing by limiting access (via permissions) to the directory containing the file to be downloaded.  In both Windows and Linux there are ways of password protecting a web directory such that if a user attempts to access a directory or any file therein, they will be prompted for a username/password. Limitations are that it would be impracticle to have more than one username/password combination for any given directory; and having the password for that directory would allow access to all files in the dirctory (unless file level permissions were set otherwise)... which means if you limited access on a per-user/per-file basis, it could get pretty ugly. You could do something like this: 1) Have a form with a password field, and a button, with action to verify.php 2) In verify.php, verify the validity of the password... if it's correct redirect the user to the download location (using the header('Location: ' , $url) function) and redirect them to an error message otherwise. Once they download once, though, they will know the location of the url.  If they didn't get the password right, the location is still unknown to them and they'd have to guess.  Using this approach with good file/directory naming could be effective. Hope this helps.
  5. Try using a virtual directory.  This description assumes you have Administrative priviledges over the server in question. In the IIS manager right click the name of your site, and select New-->Virtual Directory.  This will take you through a series of dialogs where you select an alias, and the physical location of the directory (this could be anywhere).  In your PHP code just use the alias as your target directory. You will want to pay careful attention to your NTFS and IIS permissions for the physical directory.  IUSR will need write permissions to copy the file, though if this is implemented carelessly it could pose a security risk. I recommend the above approach, but I've also accomplished this by using the absolute path to the directory (i.e. D:\uploads\).
  6. Thanks, this is great information. In my current application however, I use CSS for simple text formatting (colors, fonts, etc) and a template engine (Smarty) for layout.  My intention was to create a separate template for handheld devices; when a visitor comes I check which category they fall into and direct output to the appropriate template. Any further advice on how I would check in this instance?
  7. My site looks less than flattering on a Pocket PC / Smartphone; so I want to alter the display based on whether the site is being viewed from a web browser on a computer (greater than 800x600 resolution) or whether it's being viewed by a smaller hand-held device. My question is this: How do I go about determining this information?  Is there a PHP global I need to check? Or is there another generally accepted method for determining this? Thanks, Phil.
  8. Here is one way you could retrieve the results: [code] $query = 'SELECT username FROM members'; $result = mysql_query($query); $max = mysql_num_rows($result) - 1; // Display 5 random usernames; to display more change the 5 for ($i=0; $i < 5; $i++) {   $user_number = rand(0, $max);   $user = mysql_result($result, $user_number, 'username');   echo $user . '<br>'; } [/code] The mysql_result function accepts three parameters.  The result set, the row, and the column.  If you were displaying random users (as in this case), the row number is a random number whose MAX is the number of rows returned in the result set.  The column can be accessed by its number or its name. I hope I understood correctly what you are trying to do.  No matter how many users you had, this would choose five random from among them all and return their username.  You could then add them to an array for further output processing, output them on the spot, or whatever.
×
×
  • 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.