Jump to content

bibby

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Everything 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?
  6. bibby

    Distro

    That depends on who you ask. I'm using Ubuntu Dapper Drake with XFCE , but I think I'm going to switch to something else and run it headless.
  7. There was already a thread about this, that had a link to a great script. http://www.phpfreaks.com/forums/index.php/topic,124126.0.html
  8. what about  :-\ [code] document.getElementById("box").innerHTML=txt; [/code]
  9. Use FireBug for FireFox. Excellent JS debugger.
  10. Edit... I read your question backwards. Sorry. Anyway, here's a function to make that loop easier. function selectedValue(selBox) { return selBox.options[selBox.selectedIndex].value; }
  11. # depending on your version create table blah (lastvisit datetime default current_timestamp);
  12. I never remembered it being on the right side.  ??? Top / Left never fails. You have to remember that even though grandma has a 1280 x 1024 monitor, chances are she's rocking 800 x 600.
  13. 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.
  14. bibby

    snytax

    right, even though $array[index] still works, PHP tries to parse it as a constant first, so it's a resource burn.
  15. 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
  16. 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
  17. 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."); }
  18. You might want to try this too... Some servers want their includes to begin from root. $inc = $_SERVER['DOCUMENT_ROOT'].'/'.$iuser."/info/password.php";
  19. 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; ?>
  20. 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 ?)
  21. Am I right that checkboxes don't carry values? They are either on or off. You may be able to use the rare [b]attr[/b] though.
  22. 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]
  23. 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]
  24. Hector,   I'm sure the people who's names you've posted really appreciate your having done so.
  25. That sounds like something you'd want to delagate to your php, not your table. How easy is this? [code]$defaultReportID = 7;[/code]
×
×
  • 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.