Jump to content

wiggst3r

Members
  • Posts

    94
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wiggst3r's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi I'm running a Ubuntu webserver, which has several services running. As the server is quite well used and has several sites hosted on it, I was wondering If anyone could help me with some code/script that will restart any service that goes down or stops. I'm looking to restart the following, If they ever stop: Apache Mongrel MySQL Cron Postfix I'm sure there could be an init script that could be run and will restart any of these services If they ever stop. Thanks
  2. Hi I have just converted an old site and alot of users still type in the URLs of the old site (or have them bookmarked etc) As some of the pages are simply folders, I'm looking to redirect the folder to another folder. I've used the following, which doesn't work. RewriteRule ^/home-insurance/.*$ /insurance/home-insurance/ [R=301] Any ideas what I need to change? Thanks
  3. All I'd like to do is make sure that the file uploaded is either a word doc, jpg, gif, png or pdf. It can simply be a PDF or .doc file really, not fussed about the image files. I'm still not sure how I'd send the file as an attachment as I'm aware of mime-type issues and setting the right mime-type depending on the file uploaded. All help will be welcomed.
  4. I use Frog CMS http://www.madebyfrog.com/ It's small and easy to use.
  5. Hi Thanks for the replies. How could I check (uing the if/switch) in my code: <?php function is_valid_email($email) { $result = TRUE; if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) { $result = FALSE; } return $result; } if(isset($_POST['submit'])) { $error = ''; $name = mysql_real_escape_string($_POST['name']); $email = mysql_real_escape_string($_POST['email']); $attached = $_POST['attached']; if(trim($name) == '') { echo '<p>Please enter your name</p>'; } if(trim($email) == '' || !is_valid_email($email)) { echo '<p>Please enter a valid email address</p>'; } else { $target_path = "temp/"; $target_path = $target_path . basename( $_FILES['attached']['name']); $target_path = $target_path . basename( $_FILES['attached']['type']); $target_path = "temp/"; $target_path = $target_path . basename( $_FILES['attached']['name']); if(move_uploaded_file($_FILES['attached']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['attached']['name']). " has been uploaded"; } else { echo "There was an error uploading the file, please try again!"; } $mime_type = "application/msword"; //Begin the message. Be sure to change this how you want it. $message = "Please find my CV attached"; $headers = "From: $email"; $to = "example@gmail.com"; $subject = "Job Application"; $from = $email; mail($to,$subject,$message,$headers); echo "<p>Thank you for submitting your details.</p>"; } } ?>
  6. Is there an easy way to prevent certain files form being uploaded? I'd only like users to be able to upload jpeg/png/gif, .doc, docx and pdf's Thanks.
  7. Hi I have a form, which when users fill out the results are sent to me in an email. I'm wanting to add a filed whereby someone can add a file when they fill out the form and this file will be sent along with the email as an attachment. Does anyone know how I can do this? Any examples of code that people have used before? Thanks
  8. Hi I'm trying to setup a redirect so when users go to my site by typing in either www.example.com or simply example.com they are always redirected to www.example.com My current virtual host is: <VirtualHost xx.xx.xx.xx:80> ServerAdmin test@exmple.com ServerName www.exmple.com ServerAlias exmple.com DocumentRoot /var/www/example/current/ ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On </VirtualHost> What do I need to cgane to achieve this? Thanks
  9. Yes I meant port as in NIC. Currently eh0 is the port in which users are going to connect via samba (windows) and SSH via Mac OS. (192.168.100.7) I wanted it so If I have one LAN/NIC port configured for all the internal connections via samba and ssh, then the second LAN/NIC could be used for internet traffic. This NIC is currently configured to get an IP address via DHCP, but this will change to a static one once I have chance to. The reason for this as the current fileserver has alot of large files which are transferred around the office. If I could simply use one NIC for this traffic and another NIC for internet, it may help. Would having both ports deal with intranet and internet traffic together be better than using one for intranet and one for internet? Thanks
  10. Hi I have a dual port motherboard (IN9 32X MAX) and I'd like to run a machine running Ubuntu server to utilise both ports. Currently I have of of them eth0, running on the IP of 192.168.100.7 which is static and the other IP (eth1) is by DHCP. The server is going to be a file server, with a static IP. Does this mean that both IP addresses for the NICs need to be the same? Also is there anyway in which you can specify which ports should use internet traffic and the other port just to focus on internal network traffic? Thank you
  11. Hi I have a large database of approx 50,000 records. There's two fields that are datetime fields. What I've done so far is to get the time between each date into days format and print them to the screen, e.g. In db: 2009-04-03 00:00:00 2009-04-04 00:00:00 2009-04-04 00:00:00 2009-04-05 00:00:00 2009-04-05 00:00:00 2009-04-06 00:00:00 In browser: 1 1 1 What I want to do is find an average based on the results. So it would do: 1 + 1 + 1 / 3 (loop through each row and add it together -> store in variable and then count how many records there are and divide total difference in days by the total days) So running the script will output: Average time in days is: 1 My code is as follows: <?php require_once('config.php'); global $db; $result = $db->db_query(" SELECT * FROM messages where server_time between '2008-07-23 00:00:00' and '2008-07-27 00:00:00' and entered_at IS NOT NULL "); $output = $db->db_fetch($result); $array = array(); while($one_row = $db->db_fetch($result)) { $date_redeemed = strtotime($one_row['entered_at']); $time_of_record = strtotime($one_row['server_time']); $difference_in_seconds = $date_redeemed - $time_of_record; $difference_in_days = $difference_in_seconds / 86400; echo round($difference_in_days) . '<br/>'; } ?> Thanks
  12. Hi I have a large site going live in about 3 weeks. During the testing process, I'd like to be able to test the site with fake users. I'm aware of such programs like ApacheBench, but these only test the HTTP header information. I'm looking for a tool, where the whole site content, including headers, images, html, css etc will be downloaded. Hopefully I can set the user number of users viewing pages at the same time (i.e. 5000 -10,000) and check If the server can handle this. I want to know If the server will handle the usual traffic I am expected to receive (large finance site) which will be quite high and therefore simply testing for HTTP requests isn't enough to guarantee the site will cope with heavy traffic. Thanks
  13. That seems quite complicated for someone who is new to building servers in linux. Is there an easier way I could what I'm looking to do? Thanks
  14. Hi I've currently got a server acting as a file server running Ubuntu 7.1. The server has 6 HDDs, 2 are the OS drives and 4 are in RAID 5. I'm looking to move the current setup to a new machine and I was wondering what the best steps would be? Could I create a disk image of the current server and copy that over to the new one and then just plug in the hard drives and RAID card? Thanks
×
×
  • 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.