Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Yeah, i guess with the sheer number of sites out there its inevitable some of them will be insecure. Looks like there are stacks of live cameras out there - some with panning and zooming features.
  2. http://en.wikipedia.org/wiki/Google_hacking Interesting. Though it does of course still rely on you leaving sensitive information lying about.
  3. It shouldn't really matter if they do anyway - thats the whole point of password protecting that kind of thing.
  4. It's possible that your host only allows PHP uploads for paying members, which might explain the forums posts. Either way, you can check if your host is allowing PHP uploads by looking at the output of phpinfo(); One of the options under PHP core is file_uploads. As for your code one thing immediately jumps out at me. The move_uploaded_file() function requires two parameters. You only give it one. See the manual for a short, simple example of a PHP file upload script.
  5. How's about cycling through each moderator and checking the relevant array for their priviledges: <?php $array = array('forum_addDelCategory'=>array(1,3),'chat'=>array(1,3),'news'=>array(3),'forum_moderate'=>array(3)); $moderators = array(1,3);//list of moderators pulled from the table foreach($moderators as $v){ $update = ''; foreach($array as $k2=>$v2){ if(in_array($v,$v2)){ $update.=$k2.'=1 '; }else{ $update.=$k2.'=0 '; } } $sql = "UPDATE tbl SET $update WHERE userID=$v"; mysql_query($sql) or die(mysql_error()); } ?> The above is tested and works. You'll need to grab the array of moderators from the table first. You'll also need to carefully check the user input, since it's relying on the form's names and values in the query.
  6. Try: SELECT Listing.*,Location.Location FROM Listing,Location WHERE Listing.Listing_id=Location.Location_id
  7. Im not entirely sure what you mean. You could use the following to produce a result set with the number of each duplicated cat_main and the name of this category: SELECT cat_main,COUNT(*) as count FROM tracker_data GROUP BY cat_main HAVING count > 1 I dont think there would be a way of doing this for each sub_category in one query; you'd have to UNION the results. If that's not what you were after, then maybe you could describe the problem a little more. On a side note, it sounds like your ought to look into some database normalization. You should have a separate table for the sub categories. This sticky might get you started
  8. There was a thread in the polls about this: http://www.phpfreaks.com/forums/index.php/topic,139673.0.html As has been mentioned, there's a lot of factors to take into account.
  9. [quote author=Daniel0 link=topic=105646.msg878687#msg878687 date=1209589239] [quote author=448191 link=topic=105646.msg878654#msg878654 date=1209586220] [quote author=neylitalo link=topic=105646.msg878591#msg878591 date=1209580775] 947740, read the thread first. Thanks. [/quote] Yeah, and what's up with using 6 digits for a username? Lame... <balloon snap/> [/quote] Damn, now I can't refer to you as [tt]^\d{6}$[/tt] anymore... :( [/quote] Im just trying to work out just how lame it is that i actually laughed at that.
  10. Your only real options are links with GET or a form buttons using POST.
  11. The & operator is the reference operator. A reference is like an alias - if one variable is a reference to another, then a change to either will result in both changing: <?php $var = 'foobar'; $var2 = &$var; $var = 'test'; echo $var2; ?>
  12. I suggest you take some lessons in typing then. As for your comments regarding people paying for social networking, its just rediculous. The only way these sites work is because of the sheer number of people using them. What would be the point in facebook if no-one you knew was using it! You're simply not going to get a few users wanting to pay to use it.
  13. Yes, you can rotate images using the GD library: imagerotate() Not entirely sure what you mean by 'displaying as a php file'. Do you mean that you want the file to be a .php file? If which case, yes thats fine. Thats how dynamic images work - you set a content type header to let the browser know what the file is. The example on the above page will show you what i mean.
  14. Well, you can read a .doc file and write a .pdf file. So in theory, yes, it is possible. Wether or not it would be practical is a different matter. See: http://drewd.com/2007/01/25/reading-from-a-word-document-with-com-in-php And: http://www.php.net/pdf
  15. So you need a row count using mysqli ? I believe you have to use the SQL COUNT() function: SELECT COUNT(*) FROM tbl WHERE....
  16. Why save it as a static page? Wouldn't it be better to just store the relevant information and place it dynamically? It would allow the user to make changes easily if you did. But yes, it is possible to save a static copy. Just use the filesystem functions to save an HTML file with the information inserted into it. See fwrite()
  17. Not sure you'd have an awful lot of luck charging people for things on a social networking site.
  18. Well im guessing you want this to show monday at any time over the weekend too? Try: <?php $x=0; $day = date('N'); $hour = date('G'); if($day == 5 && $hour >= 18){//after 6 on friday $x = 3; }elseif($day == 6){//saturday $x = 2; }elseif($day == 7){//sunday $x=1; }elseif($hour >= 18){//any other day of the week $x=1; } echo date('l dS F',time()+60*60*24*$x); ?>
  19. You close your while loop after setting the variables $title,$city and $state, but before doing anything with them - hence why it doesn't loop in the way you would want. I expect fenway was referring to: http://code.google.com/apis/maps/
  20. Beat me to it fenway, but thats the query i had too: SELECT COUNT(*) as cnt,sum(rf) FROM (SELECT rf FROM mlb_teamgbg WHERE stc= 22 ORDER BY datestamp DESC LIMIT 5) as subquery
  21. Well, the 3rd edition covers PHP and MySQL 5 so it's still up to date.
  22. If you wanted to do this 'behind the scenes' i.e. without a page reload, you'd need to use some AJAX.
  23. How about narrowing down the problem a bit? What does the above code do? What doesn't it do? Are there any errors? If so, where do they come from? Which bit of it do you need help with?
  24. Not sure that's possible with a usort function. My approach would be to cycle though the array, and calculate a distance from the centre and store this in an array. Associatively sort this array, then cycle through this array using the keys to put a new array in order: <?php $array = array(0.5,0.7,0.4,0.45,0.1,0.99); foreach($array as $k=>$v){ $temp[$k] = abs(0.5-$v); } asort($temp); foreach($temp as $k=>$v){ $sorted[] = $array[$k]; } echo '<pre>'.print_r($sorted,1).'</pre>'; ?>
  25. Sounds like you want something along the lines of: <?php //connect to database $sql = "SELECT c.coursename,i.total FROM tblcourses AS c,tblinquiries AS i WHERE c.coursename=i.course and i.inq_date='4/21/2008'"; $result = mysql_query($sql) or die(mysql_error()); while(list($name,$total) = mysql_fetch_row($result)){ echo '<br />Course: '.$name.' - total: '.$total; } ?> That's untested, but should work. One thing i see is that you're storing your dates in the format DD/MM/YYYY. This isn't the format of a mysql DATE field, so i can only assume you're using a varchar/text field. You might want to consider changing to an appropriate date type in case you need to do any future sorting.
×
×
  • 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.