Jump to content

onlyican

Members
  • Posts

    921
  • Joined

  • Last visited

About onlyican

  • Birthday 07/28/1986

Contact Methods

  • MSN
    ur_a_renegade@hotmail.com
  • Website URL
    http://www.clubfeet.net

Profile Information

  • Gender
    Male
  • Location
    Hants - UK

onlyican's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. You mis-understand switches Its not as simply as a group of IFs Its like running IF X == Y OR X == Z or X == X example switch ($current_weather) { case 'sunny': echo 'HAPPY, it is sunny'; break; case' rain': echo 'Another wet day here in the UK'; break; // We can do multiples case 'snow': case 'ice': echo 'Damn it is cold'; break; //finally a catch all default: echo 'The weather could be worse but its OK'; } OR the IF way if ($current_weather === 'sunny') { echo 'HAPPY, it is sunny'; } elseif ($current_weather === 'rain') { echo 'Another wet day here in the UK';} elseif ($current_weather == 'snow' || $current_weather == 'ice') {echo 'Damn it is cold';} else {echo 'The weather could be worse but its OK';}
  2. First, think if a re-code (this is VERY poor code and has left you open to serious problems) Second To achieve what you want, we need more information. My understanding, if I search for "Water" you will show me a banner related to water Does this mean you will have banners for EVERY word in the dictionary? How will these banners be generated?
  3. Hi All I am having some issues with Timezones. Basically I have an internal application where someone can go on and log date / time start and finish. It is stored in my DB as 2013-06-02 09:51:00 2013-06-02 12:01:00 I then have a report to show these times I have set date_default_timezone_set('UTC'); And I loop through the hours and give a total hours worked that day $shift_hours = strtotime($logoff) - strtotime($logon) echo date('H:i', $shift_hours); Works fine. With the above example, it says I done 2 hours 10 minutes. But My Issue: I want a total hours worked. Locally, this works fine but on my server its way out. I simply add the total hours up $total_hours = $total_hours + $shift_hours; Now working this out, I have an issue I have a small function [php $total_num_hours = floor($total_hours / (60*60)); $total_num_hours_in_mins = $total_num_hours * (60*60); $total_mins = ($total_hours - $total_num_hours_in_mins) / 60; return array($total_num_hours, $total_mins); [/php] As I said, locally this works fine, I done 45 Hours on my example data, live i have worked 470 odd hours. (Although that seems nice and makes me look good, Im sure people will moan) I cant do a simply echo date('H:i'... as if they have worked 25 hours, that will display 1 (as it counts as one day) I dont really want to calculate the number of days worked, the number of months worked to make hours. Is there an easier / better way Cheers
  4. A: Without touchpad, then no mouse as wireless mouse broke and i am away so using laptop not desktop B:ACL is what I am building from scratch, this is a custom script. options: A: MESSY!!!! Have a link table for each user2user (positive, allows team leaders / boss to view users assigned to someone NOT below them without seeing them all) NEGATIVE, Multiple Rows for user. so user X to TM, User X to Area manager, user X to BOSS) B: Load concern One single look up table. Users assigned to Team, Then if logged in as area manager, read all TMs and get users assigbned to TEAM user, so and managers (THE HEAVY BIT), load all Area Managers, to load ALL team leaders to then load ALL users; C: YOUR OPTIONS
  5. Hi All. I have a methodological question (not How to code it) I have an internal application. The application allows users to record Hours and Jobs I want to allow certain users to view basic users hours / jobs I have a user Structure BOSS MAN Area Manager Team Leader Basic User So a basic user can view their OWN hours A Team Leader can view the users assigned to their own A Area manager can view the users assigned to a Team Leader A BOSS MAN can view all users assigned to an Area Manager (which is assigned to a Team Leader) Best methods of DB query methods? Excuse typos, FING touchpad moving my cursor every second.
  6. Hi all I have a ubuntu box at home which I use as a mini home server (with capabilities to Remote SSH) Recently my hard drive failed so I am in the process of rebuilding the box and I thought instead of just having a dev LAMP box, why not set up for testing as well, such as Selenium, PHPUnit ect My question is what tools do you all suggest I have on the box to fully utilize my mini server. Here are the things I plan to install so far The obvious Apache 2 PHP MySql OpenSSH The "Would be handy" GIT Server Testing options PHPUnit (well duh) Selenium Bamboo (or equivalent) PHP code Sniffer Ant Deploy scripting Any suggestions / other options would be much appreciated (basing some apps based on previous companies usage)
  7. Done it Code example # Change :false to true to put in maintenance mode RewriteRule .* - [E=MAINTENANCE:false] RewriteEngine on # Redirect to maintenance file if in maintenance mode. RewriteCond %{ENV:MAINTENANCE} ^true$ RewriteCond %{REQUEST_URI} !/maintenance.html$ RewriteCond %{REQUEST_URI} !/css/ RewriteCond %{REQUEST_URI} !/img/ RewriteRule $ /maintenance.html [L,R=302] # Redirect away from Maintenance file is not in maintenance mode. RewriteCond %{ENV:MAINTENANCE} !^true$ RewriteRule ^maintenance.html /index.php [L,R=301]
  8. Hi I am trying to build a conditional statement into a htaccess file for maintenance mode. Basically, I have a set of rules to check if the URI is not the maintenance file, or the img dir or css dir or a group of IPs, then put show maintenance file But Instead of having to comment out the block (as in htaccess its hashing out per line) I wanted a var and conditional within the htaccess file Something like MAINTENANCE_MODE = false if (MAINTENANCE_MODE) { RewriteCond %{REMOTE_HOST} !^192.168.1.1 RewriteRule $ /maintenance.html [L] } else { RewriteRule maintenance.html index.php [R=302] } Cheers in advance.
  9. Cheers Adam. I have to do this for thousands of image entries in the db We have approx 175000 entries per DAY. this is over at least 3 years of data. So I might use your option Adam simply to save one process on the rename (normally wouldn't bother but at this scale, i think I might)
  10. Cheers ignance I was going down that avenue. Forgot about the "rename()" function Was going to create a tmp file, use exif_imagetype then save image, delete tmp but your method seems, shall we say, less messy
  11. Hi Background: We have a large MySQL table which stores data and images as BLOBS (do not ask) My Task: To extract the images from the SQL and save them as image files Problem: to Calculate the image type from the blob itself. (if its jpg, png ect) I have heard that I can use a regex to work out if the image is jpg / png ect, but not sure what it is, could anyone advice?? Cheers
  12. I tend to use PHP insdie a tag, but I wouldn't escape out of PHP just for a slash <img src="/dir/<?php echo $id .'/'. $image[0];?>" />
  13. Fixed it. For some reason when I set the desc box to visible it was causing a scroll , thus pushing main down to float under sidebar, thus causing offset to be the height of the document. Resulting is height of document minus offset of map (being below doc height) total 0. but by the time the debug spat the code out, it was back to the top, thus showing incorrect figures in the console log (and not showing a scroll bar) Simple fix, set the width to 0 (so the scroll wont force the position below the page) at the start of the function and reset the width at the end
  14. hi all I am rebuilding a site. Basically I have a page which has 2 boxes on the right hand side which fill the screen On Load one big is hidden On click of a P tag, javascript runs, gets the available height (depending on the height of the window), divides by 2, then shows the 2nd div. Then you click an X image on the 2nd div, and that div hides again, then resizes the first div to full height. Works fine FIRST TIME BUT when I click the P tag the 2nd time (after hiding the div) it goes weird Close the div, try third time, works perfect Try fourth time, goes weird again Example link http://help.rideandtag.co.uk/main.php Theres no PHP coding, so all can be seen via source code. TRY it 1) Click "Show listing Demo" on the left hand side. 2) Blue box appears 3) Click the X on the top right of the BLUE box 4) Blue box goes 5) Click Show Listing Demo on left hand side again 6) WTF!!!! 7) Click the X again in the blue box) Repeat from 1 and get same results EDIT:// Console.log has some debug, shows the height being set to 0. Dont know why the maths does not equal 0
×
×
  • 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.