Jump to content

bibby

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Posts posted by bibby

  1. hi marksie1988,

     

      It'd be much easier to do on a linux server, but here's a way for a windows server,

    <?
    echo shell_exec('net statistics server');
    ?>
    

     

    One of the returned lines it the servers start time, which you could then mktime() with and parse the difference from the current time. Good luck.

  2. Hi Mr Chris,  the SQL Forum would have been a better place for this post. But, did you know mysql can do IF statements? IF statements take three arguments:  the conditional, what to do if true, what to do in false.

     

    # Let's that that right now your query is,
    select home_team, home_score, away_team, away_score from `games` where gameid=1;
    
    # You can derive a "form" within your query with an IF statement, in this case as the 5th column.
    select 
          home_team, 
          home_score, 
          away_team, 
          away_score,
          if( home_score=away_score , 'draw',
                        if (home_score>away_score, 'home_win' , 'away_win')
            ) as form
    from `games` where gameid=1;
    

     

     

  3. Hi OLG. Neat scrape.

     

    I'm not so good with RegEx either, but you can probably get what you want with explode() alone.

    // after you've assign $html
    $x= explode('Rank: ',$html,2);
    if($x[1]) $y = explode(' ',$x[1],2);
    $rank = str_replace(',','',$y[0]);
    
    if(is_numeric($rank)) echo $rank;
    else echo 'this didnt work after all..';
    

  4. hackerkts' regular expressions remove any non-alpha numeric characters from the string, covering up the symptoms.

     

    Assuming your mail parameters are assigned to variables, check to see if they are escaped before they hit the mail function. If so, fix the escape-age the occurs before the mail() call. Your string may also look escaped, because it has been escaped twice,

    string ' the user\\'s ' renders as ' the user\'s '

     

    //are these escaped first? If so, the problem isn't in mail().
    echo $to  . "<br />\n";  // escaped?
    echo $subject  . "<br />\n";  // escaped?
    echo $body  . "<br />\n";  // escaped?
    echo $headers  . "<br />\n";  // escaped?
    
    //the mail call
    // mail($to,$subject,$body,$headers);
    

     

    *edit _ spelling ~!b

  5. >> file will be seen in web browser but it will get open using appropriate application.

     

      Yeah, good luck with that. I don't see how you can make a web editable file in .doc format.

     

    >>user will be accessing a file in browser but it will be open in MS Word withing that browser.

     

      Different users' computers will handle the the 'doc type' in different ways. I know that some users have MSWord integration with their web browsers, but the majority do not. How would you propose making this accessible to someone like me, running Ubuntu Linux and Open Office as opposed to Windoze and M$Word?  :P

     

  6. That depends on who you ask.  :P

     

    I'm using Ubuntu Dapper Drake with XFCE ,

    but I think I'm going to switch to something else and run it headless.

  7. The only downside, imo , to sessions if that you have to include session_start() at the top of each script.

    That said, sessions are the way to go, especially for logins.

     

    People can mess with their cookies...  make them never expire for instance.

     

    With sessions, they have no control anymore. Plus, you can stash all sorts of info (ip address, browser info, useful site vars) in the session var and the user won't know or care because it's your on your server.

  8. naw,  then if he had exactly 9 images, you're left with an extra tr.

     

     

    Use a ticker still though :)

    $tick=0;
    foreach ($images as $img)
    {
         $td.="\t<td>".$img."<td>\n";
         $tick++;
          
         if($tick==3)
         {
             $rows.="<tr>".$td."</tr>\n";
             unset($td);
             $tick=0;
         }
    }
    
    if ($td)   // left over images
       $rows.="<tr>".$td."</tr>\n";
    
    $table= "<table>\n".$rows."</table>\n";
    
    echo $table;
    

     

    edit: my spelling

    edit2: reset my tick

  9. ah, ok.

      I have a server that does that too.

    Do you have shell acces?

     

    php -l file.php

      You may be able to get error msgs this way.

     

    Also, try kicking that error reporting back on.

    Add this to the very top of your script.

    ini_set('display_errors', 1);
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
    

     

    That wouldn't be a Plesk server, would it?  I hate those boxes

  10. You have...

    while ($find_items = mysql_fetch_array($find_items2))
    {
    $id = $find_items['id'];
    $price = $find_items['price'];    //<--- this is an integer
    
    if ($price[$shopitemid] > "200000")   //<----  this gets treated like an array.
    {
    	die("Please do not price items more than 200000 points.");
    }
    

     

     

    Did you mean?

    {
    $id = $find_items['id'];
    $price[$id] = $find_items['price'];    //<--- array assignment
    
    if ($price[$shopitemid] > "200000")   
    {
    	die("Please do not price items more than 200000 points.");
    }
    

     

    Or even...

     

    {
    $id = $find_items['id'];
    $price = $find_items['price'];    
    
    if ($price > "200000")   // <-- straight up int ?
    {
    	die("Please do not price items more than 200000 points.");
    }
    

  11. Here's some a test for some possible errors.

    <?
    $inc = $iuser . "/info/password.php";
    
    if (file_exists($inc))
    {
    if ( (fileperms($inc) & 4) == 4)
    	include($inc);
    else
    	echo "dood, you don't have read permission for this file. (User: Other)";
    }
    else
    echo "dood, check this path. IS it right? ->".$inc;
    ?>
    

  12. Both Apache and PHP are backwards compatible, so I doubt that it's that.

     

    When I move files from server to server, sometimes they lose their read permission.

     

    chmod 644 those files , if they aren't already.

     

    A lot of times after scp, mine could be 700.

     

    --

     

    What do you mean by "won't work".

     

    Forbidden error?

    no images?

    What about read permission to dir rotate/birthdays ?  (each digit >= 5 ?)

     

  13. This?

    [code]
    $qr="SELECT audio FROM audio where id=41";
    if($q=mysql_query($qr))
    {
        if(($n=mysql_num_rows($q))>0)
        {
            // good query + result
            $r=mysql_fetch_row($q);
            $mp3track=$r[0];
        }
        else
            echo "good query, no result though";
    }
    else
      echo "that query didn't run. --> $qr";

    [/code]
  14. Lv-Kris you can select from multiple tables almost as if they are one.
    [code]
    select
      users.user_name,
      user_stuff.stuffis
    from
      users,
      user_stuff
    where
      user.user_id = user_stuff.user_id
      and user.userid=1
    [/code]

    shortened by aliases, but the same
    [code]
    select u.user_name , s.stuffis
    from users u , user_stuff s
    where u.user_id = s.user_id
    and u.user_id =1
    [/code]

    Joins are great too.
    If you want to use joins , the ref page is here
    [url=http://dev.mysql.com/doc/refman/5.1/en/join.html]http://dev.mysql.com/doc/refman/5.1/en/join.html[/url]
×
×
  • 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.