Jump to content

PaulRyan

Members
  • Posts

    876
  • Joined

  • Last visited

  • Days Won

    4

PaulRyan last won the day on September 5 2013

PaulRyan had the most liked content!

Profile Information

  • Gender
    Not Telling
  • Location
    UK
  • Age
    23

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

PaulRyan's Achievements

Member

Member (2/5)

25

Reputation

  1. @QuickOldCar, by refresh, I think he means the vote count is reset every day back to 0.
  2. The image rotation issue, is usually to do with photos taken on a mobile device (iPhones are the main culprit). I'm sure there is a way to detect if the image is rotated, let me get back to you on it.
  3. The forgot password function you are trying to implement isn't really viable. Anyone could go on to your website, enter someone elses username and then reset that persons password. The best method is to firstly, allow a person to enter their username. Send an e-amil to their e-mail address with a password reset link. The link will go to your website, and you will then send out a new password for them to log in with. The benefits of the above is that, if I went to your website and entered a username, the password wouldn't change, unless the user associated with that username clicked on the link sent to them.
  4. You could in fact use .htaccess to parse the .js file as PHP, so it will run the file and parse any variables etc. <Files ~ '^(global.js)> ForceType application/x-httpd-php </Files>
  5. Hello, I'm Paul Ryan. I am 23 years old and have around 8 years experience in programming with the following languages: - PHP - MySQLi - HTML - CSS - JavasScript (jQuery, AJAX) I have worked on many project over the years, including the following: - BoxSelect.com - Taccd.com - FTA.ie - BelfastCookerySchool.com - Dittnyebad.no - MassasjeShop.no - Project: Universe (Personal Project) I have worked on many other smaller jobs, updating outdated code, database and code optimizations etc. You can contact me via the following methods: - PHP Freaks Personal Message - Skype: paulryanmc91 - E-mail: paul.ryan.mclaughlin@gmail.com I am available to start work immediately whether the job be big or small, don't hesitate to contact me. Thanks for your time, look forward to hearing from you. Kind Regards, Paul Ryan
  6. Bar and is correct. You're current statement equates to, that if the user is not an admin or if the users cannot view users them the access is denied. If either one of those is false, then they don't get access. You need to change it to && not ||.
  7. This is quite simple, you should look at pow to complete this. See the following: <?PHP //### Start at 1 $currentNumber = 1; //### While true, continuos till break is hit while(true) { //### Multiply the number by itself $number = pow($currentNumber, 2); //### If the number is less than 20000 display it //### If the number is greater than 20000, break the while loop if($number < 20000) { echo $number .'<br>'; } else { break; } //### Add 1 to the current number $currentNumber++; } ?>
  8. I agree with Ch0cu3r, you have far too much repetition in your code. You have also miscalculated the amount on the pension, it is 2.5% not 25%. So the multiplier would be 0.025 not 0.25. I have restructured your code as follows, I haven't done anything. <?PHP //### Function to return tax amount function tax_amount($salary) { if($salary >= 500000) { return $salary*0.45; } else if($salary >= 300000) { return $salary*0.35; } else if($salary >= 200000) { return $salary*0.2; } else if($salary >= 100000) { return $salary*0.1; } else { return 0; } } //### Set pension contribution amount $pensionContribution = 0.025; //### Employee data in an array $employees = array(array('name' => 'Aron', 'gender' => 'm', 'dob' => '1930-01-25', 'position' => 'manager', 'start_date' => '1998-01-01', 'gross_salary' => 635000.00), array('name' => 'Britney', 'gender' => 'f', 'dob' => '2001-05-06', 'position' => 'researcher', 'start_date' => '2001-03-15', 'gross_salary' => 420000.00), array('name' => 'Daniel', 'gender' => 'm', 'dob' => '2003-01-15', 'position' => 'officer', 'start_date' => '2003-12-06', 'gross_salary' => 260000.00), array('name' => 'Jessica', 'gender' => 'f', 'dob' => '2002-11-21', 'position' => 'officer', 'start_date' => '2007-02-20', 'gross_salary' => 350000.00), array('name' => 'Peter', 'gender' => 'm', 'dob' => '1998-01-07', 'position' => 'assistant', 'start_date' => '2009-09-06', 'gross_salary' => 250000.00), array('name' => 'Keith', 'gender' => 'm', 'dob' => '2003-07-25', 'position' => 'intern', 'start_date' => '2012-06-27', 'gross_salary' => 90000.00) ); //### Iterate over employee data foreach($employees AS $employee) { //### Add tax amount, pension amount and net salary $employee['tax_amount'] = tax_amount($employee['gross_salary']); $employee['pension_amount'] = ($employee['gross_salary']*$pensionContribution); $employee['net_salary'] = (($employee['gross_salary']-$employee['pension_amount'])-$employee['tax_amount']); //### Display employee data echo '<pre>'; print_r($employee); echo '</pre>'; } ?> As you can see, it is a lot easier to read and see what data is where. I also created a function to return tax amount. I calculated the tax amount, pension amount and net salary during the while loop so it's less code to write.
  9. You should really being storing dates in the database as DATETIME. Which would look like '2013-09-29 15:04:00', which is human readable and also easier to work with as you can manipulate the value in the query quite easily, and also manipulate it in PHP just as easily too.
  10. Edit* - Thought it was wrong function, actually malformed time string. <?PHP $string = '2013-09-27 14:00:01'; $timestamp = strtotime($string); if($timestamp < ($_SERVER['REQUEST_TIME'] - (60*60*24))) { echo 'True'; } ?>
  11. You must be hitting the DDOS protection of CloudFlare, which means you or others are accessing the website too many times, so they are limiting your access.
  12. How about you give us the url to work with? Will help someone, to help you.
  13. @Denno - If the posts array does not equal a number that is divisible by 3, then your code will not close the final div. Try this instead. <?PHP //### How many per row $perRow = 3; //### Keep count of posts per row $perRowCount = 0; //### Start output $output = ''; //### Dummy data, replace with your own $posts = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'); //### Iterate over each post foreach($posts AS $post){ //### If there is no remainer from division, open container if($perRowCount%$perRow == 0) { $output .= '<div class="container">Container Start'.PHP_EOL; } //### Add the comment element with data $output .= '<div class="comment">'. $post .'</div>'.PHP_EOL; //### IF the remainer from the division is 2, close the container ready for opening another next time round if($perRowCount%$perRow == 2) { $output .= 'Container End</div>'.PHP_EOL; } //### Increase per row count $perRowCount++; } //### If the remainder from the division is not 0, then close the final open div if($perRowCount%$perRow != 0) { $output .= 'Container End</div>'.PHP_EOL; } //### Echo the output echo $output; ?>
  14. A possible cause which I myself encountered, is instead of using "localhost" as the host, use "127.0.0.1" as the host.
  15. Try this <?PHP $string = "abc 12,345 def"; $stringElements = explode(' ', $string); foreach($stringElements AS $key => $element) { if(preg_match('/[a-z]/', $element)) { $stringElements[$key] = strrev($element); } } echo implode(' ', $stringElements); ?>
×
×
  • 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.