Jump to content

khburres

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

khburres's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Code looks fine...you sure its a problem in the sort?
  2. Slight alteration from: $theData = ereg_replace('<b>', '<b> $person_name', $theData); to: $theData = ereg_replace('<b>', '<b> ' . $person_name, $theData); Example: [code]<?php $person_name = "Billy"; $theData = "<b> is great"; $theData = ereg_replace('<b>', '<b> ' . $person_name, $theData); echo $theData; ?>[/code]
  3. You're welcome; glad it worked!
  4. Consider storing your ranks in the $info array, then sort that array based on rank. Instead of: $ranks[$i] = $rank; Try: $info[$i]['rank'] = $rank; Then use a custom function to sort. Instead of: sort($ranks); Try: usort($info, "desc"); Somewhere else define the function: [code] function desc($a, $b) {    if($a['rank'] == $b['rank'])       return 0;    else       return ($a['rank'] > $b['rank']) ? -1 : 1; } [/code] Once you call usort, your $info array should be sorted by rank in descending order. Print out in table as normal. Update db if necessary. Now, having said that, if you are going to store the rank in the db anyway, why not use ORDER BY rank DESC? Unless of course the ranking constantly changes.
  5. [!--quoteo(post=350128:date=Feb 27 2006, 10:20 PM:name=vzwhaley)--][div class=\'quotetop\']QUOTE(vzwhaley @ Feb 27 2006, 10:20 PM) [snapback]350128[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] echo "<b><a href=#".$i." class=\"TopStories\">".$RSMiddle2['Title']."</a></b><br>"; [/code] [/quote] try including quotation marks: [code] echo '<b><a href="#' . $i . '" class...</a>'; [/code] Also, do you have the actual anchors somewhere in your html? i.e., do you have corresponding <a name="1"></a>, <a name="2"></a>?
  6. [!--quoteo(post=350130:date=Feb 27 2006, 10:28 PM:name=eranwein)--][div class=\'quotetop\']QUOTE(eranwein @ Feb 27 2006, 10:28 PM) [snapback]350130[/snapback][/div][div class=\'quotemain\'][!--quotec--] i have two dates which are formed by date and time. how do i get the difference between them. let's say i need the number of days or hours that pased between start and end? [/quote] Convert each to their seconds equivalent, subtract the earlier from the latter, then convert number of days, minutes, etc. How are the dates formatted? Are these MySQL date/times?
  7. If I understand the problem correctly, you would want to first calculate the totals for each username before outputing your rows. Make this total part of your $userPoints array ($userPoints[$username]['total']). Then you should be able to use a PHP sort function that is designed to sort based on the value in $userPoints[$username]['total']. After the sort is performed, you can output your rows using the sorted array. [code]//-- totals foreach($userPoints as $username => $rounds) {    $userPoints[$username]['total'] = 0;    for($i = 0; $i < count($rounds); $i++)       $userPoints[$username]['total'] += $rounds[$i]; } //-- sort usort($userPoints, "desc"); //if you want ascending order, change 'desc' to 'asc' //-- now print rows in descending order (or ascending) // {your code here} //======================= // Functions // ------------------------ // can be placed elsewhere //======================= function desc($a, $b) {     if($a['total'] == $b['total'])         return 0;     else         return ($a['total'] > $b['total']) ? -1 : 1; } function asc($a, $b) {     if($a['total'] == $b['total'])         return 0;     else         return ($a['total'] < $b['total']) ? -1 : 1; } [/code]
  8. Not exactly sure what you're looking for. Are you trying to extract the url from the html code? In that case, you could try something like that below. It uses regular expressions - though I must disclose I am far from being an expert in the use of regular expressions. [code]<?php $html_code = '<a href="thispage.php">Click Here</a>'; $pattern = '/(.*)(<a href=")(.*)(">)(.*)/'; preg_match($pattern, $html_code, $matches); echo $matches[3]; ?>[/code]
  9. check your incident_report.php file?
  10. What you may want to do is store the links for user that have logged on in a separate html file that is 'included' when the login is validated. If the login is not validated, then the include would not take place. Something like: ... include('header.html'); include('links_allusers.html'); if(goodLogin()) { include('links_login.html'); } include('body.html'); include('footer.html');
  11. [!--quoteo(post=350921:date=Mar 2 2006, 06:48 AM:name=Rackspace)--][div class=\'quotetop\']QUOTE(Rackspace @ Mar 2 2006, 06:48 AM) [snapback]350921[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello peeps, does anyone know a simple way to limit a string to the first word in it? [/quote] Another possibility: <?php //-- Using string methods $mystring = "Hello there"; $mystring = substr($mystring,0,strpos($mystring,' ')); echo $mystring; //-- Using regular expressions $str = "Hi there"; $pattern = '/^([\w]*)(\b)/'; preg_match($pattern, $str, $matches); echo $matches[1]; ?> I admit, I'm not nearly an expert with regular expressions, so there could be a better way than that proposed.
  12. I am running into a problem accessing certain php scripts on my webserver. Any help is appreciated. Specs: - PHP 5 - IIS 5.0 - Windows 2000 Server Problem: I have setup a directory 'admin' that I have put my HTML pages that perform administrative functions for the website. I have setup IIS to utilize Windows security for access to these pages. In Windows I have given specific individuals and administrators access to this folder and all child objects. When I attempt to access an HTML file in the admin folder via a browser, the browser rightfully requests credentials. If I use one of the individuals' account that has permissions they are able to access the HTML file. From there, however, if they attempt to access a php page from within the same folder they are again asked for credentials, however, their credentials are not sufficient to access the php file, even though I've given them "Full Access" privileges for everything. The only way I can access the php files is to use an administrators account. Problem Solving Steps: In order to figure out what the problem was, I started by allowing anonymous access to the folder in IIS. Since the permissions still exist on the folder through Windows, no access is allowed, even to the HTML docs. So, I remove the restricted permissions and give Full Access privileges to Everyone. Then I can access anything in the admin folder. I then attempted to re-establish the restricted access to the folder via IIS by again setting up the folder to use Windows authentication, but still keeping the privileges for Everyone from within Windows. Now, anyone can access the HTML pages within the folder, but as soon as you attempt to access a PHP script in that folder, the authentication window comes up and administrator credentials must be provided in order to get access. To test the scripts themselves, I copied them from the protected folder into a non protected folder, and anyone can access them. Any ideas on how to solve this problem? Any help is appreciated.
×
×
  • 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.