1) Can anyone recommend any reliable and not too expensive UK based webhosting companies? (only hosting, no domain name registration needed)
Necessary features: - Linux/Apache server - at least 150MB webspace - bandwith/traffic on a normal scale, the more the better *g* - PHP (version 4 okay, 5 better) - at least one MySQL database - FTP access and several email accounts should be a given
A plus, but not really neccessary: - .htaccess - cgi/perl - shell access
2) DreamHost as a webhost for a small business website? I do have a DreamHost account, mostly for dabbling around and trying out stuff, and love all their features (and low prices). But although I've never had any problems so far, hearing every now and then about down times or bad customer service makes me a bit reluctant to recommend them to a client for hosting their small business website. Opinions, anyone?
Can anyone recommend any reliable and not too expensive UK based webhosting companies? (only hosting, no domain name registration needed) Necessary features: - Linux/Apache server - at least 150MB webspace - bandwith/traffic on a normal scale, the more the better *g* - PHP (version 4 okay, 5 better) - at least one MySQL database - FTP access and several email accounts should be a given
A plus, but not really neccessary: - .htaccess - cgi/perl - shell access
ETA: Is DreamHost a recommendable webhost for a small business website? I do have a DreamHost account, mostly for dabbling around and trying out stuff, and love all their features (and low prices). But although I've never had any problems so far, hearing every now and then about down times or bad customer service makes me a bit reluctant to recommend them to a client for hosting their small business website. Opinions, anyone?
Can anyone recommend any reliable and not too expensive UK based webhosting companies? (only hosting, no domain name registration needed) Necessary features: - Linux/Apache server - at least 150MB webspace - bandwith/traffic on a normal scale, the more the better *g* - PHP (version 4 okay, 5 better) - at least one MySQL database - FTP access and several email accounts should be a given
A plus, but not really neccessary: - .htaccess - cgi/perl - shell access
Addendum:I just saw that in this comm's user info DreamHost is recommended as a webhost. I do have a DreamHost account, mostly for dabbling around and trying out stuff, and love all their features (and low prices). But although I've never had any problems so far, hearing every now and then about down times or bad customer service makes me a bit reluctant to recommend them to a client for hosting their small business website. Opinions, anyone?
Okay, I'm new to php and am trying to set up a php/mysql calendar. I've got it all up and running but now I've got to tweek it based on my audience, so instead of it listing months and dates in English it needs to show them in both English AND Spanish, so I'm looking for some (hopefully) simple code help.
Here's a pic of part of my current code:
It's showing everything in Spanish perfectly, but I can't get it to show both. Basically what I want it to do is: if current month is 01 then current month is Enero - January
...but any time I add "- January" or just a space and then January my code errors out or just shows a 0. Is there anything special I need to do for it to show Enero - January or Enero January?
I'm sure it's something simple that I've overlooked or forgotten.
edit: solved. thanks for noticing my oversight... doh.
Thanks in advance for any help. This is a probably a simple one but here goes:
I have this part of a script that doesn't wish to behave:
the db connection is in place, and when i echo back the query to the web page and copy and paste it into phpMyAdmin, the query works fine and returns my result. There should only be one row of results, which there is when I run the query, but when I try to fetch the result and store it in the variable $prefix it doesn't work. I'm not getting any errors thrown, it's just not working. Any ideas? Sorry if it's totally obvious. I'm under a zillion deadlines and have spent too long swearing at the computer over this one.
I'm trying to create a super basic login page.. one that doesn't require a mysql database of usernames and passwords, which apparently is nearly impossible to find. I'm still relatively new to php.. bumbling along mostly. Anyway.. here's what I've got so far
In the first page of the protected section:
session_start(); if (isset($_POST['user'])) { $_SESSION['username'] = $_POST['user']; $_SESSION['password'] = $_POST['pass']; $_SESSION['authuser'] = 0; } //check username and password information if (($_SESSION['username'] == 'bob') and ($_SESSION['password'] == 'smith')) { $_SESSION['authuser'] = 1; } else { echo "Sorry, but you don't have permission to view this page, Try Again"; exit(); } ?>
What I'm trying to accomplish is being able to kill this information with a "Logout" button. I've attempted putting session_destroy() and session_unset(); in the header of that page.. tried resetting the $_POST['user'] to nothing or something other than 'bob' (and changing the isset part.)
Nothing works.. I'm still passing something that's allowing me to be logged in.
How can I code this so it's totally killed.. dead, gone.. when they hit a button that says logout ??
for the rest of the pages can I simply put in the header
session_start(); if ($_SESSION['authuser'] = 1) { ?>
html stuffs
else { echo "Sorry, but you don't have permission to view this page, Try Again"; exit(); } ?>
you guys are my last hope.. I'm about to toss the whole thing and resort to .htaccess .. please help!
ETA: Problem appears to be fixed.. thanks everyone!
I have two scripts: The first checks adirectory for data files several times an hour. If data files arefound, a second script is called to process each data file. The secondscript is time intensive and if there are multiple files to process I'msure to encounter timeout issues (and I don't want to increase my phptimeout to unreasonable levels)
(fwiw, the second script does not involve repeated MySQL queries (onlyone read per file), it's just text parsing but there is a LOT of text.Perl is not an option at this point. I'm using ereg instead of thebuilt-in php str functions to help ease the load on the cpu).
So -- is there a way to fork (or spawn) a new php process in a windows environment?
i have two tables, contacts and tasks. users create a contact and then create tasks for the contact. one contact can have many tasks. i want to retrieve the contacts and, if there are any active tasks, i want to retrieve only one. if there are no active tasks, i still want to get the contact. the idea is that users can see a list of contacts, and a little icon appears next to any that have pending task/s. i've been doing this (simplified a bit):
SELECT c.`id`,c.`name`, t.`id`, t.`task_type` FROM `contacts` AS `c` LEFT JOIN `tasks` AS `t` ON c.`id` = t.`contact_id` AND t.`done` = '0' WHERE 1 GROUP BY c.`id`
which was working, but lately is running very slow (mysql hangs for 2+ minutes at "copying to tmp table"). is there a more efficient way to do this? everything else i can come up with only returns contacts with active tasks. i had to toss that GROUP BY in there because otherwise i'd get a contact returned as many times as it had tasks, which is obviously not right and a bit hacky. so, i'm sure i'm doing something wrong here.
Recently I translated into English one of my old project, DbSimple (LGPL). It is a DB abstraction library for PHP which could work with MySQL, PostgreSQL, FireBird. The main idea is extremely simple interface: everything which may be done automatically is realized so in DbSimple, and code remains quite readable.
It would be great if your comment this library (and possibly try). For my projects this library simplifies the work very much, maybe it will be useful for others...
Some key features:
Conditional macro-blocks in SQL body ({}-blocks), which allow to dynamically generate even very complex queries without detriment to code readability.
Caching of query results (if necessary).
Different fetch methods (as column, as 2d array, as key-based multidimension array, as tree etc.).
Supports various placeholder (query arguments) types: list-based, associative, identifier-based etc.
Supports operation "select + count total number of resulting rows" (for data displayed page-by-page).
Functions for direct fetching: all result rows, one row, one column, one cell, associative array, multi-dimensional associative array, linked tree etc.
The most interesting synopse (macro-blocks, placeholders, select one page with total counting):
$rows = $DB->selectPage($totalNumberOfRows, ' SELECT * FROM goods WHERE category_id IN(?a) { AND activated_at > ? } LIMIT ?d, ?d ', $categoryIds, (empty($_POST['activated_at'])? DBSIMPLE_SKIP : $_POST['activated_at']), $pageOffset, $pageSize );
Достался один проектик, написанный румынским аутсорсерами для немцев.
В следующей процедуре румыны проверяют, дал ли пользователь допустимое имя таблице для MySQL (имя вводится в форму, по нему создается таблица):
Что делает этот кусочек кода? Определяет, есть ли в строке пробел. Для этого румынские умельцы определяют длину строки, удаляют из строки все пробелы, снова определяют длину и сравнивают два значения:
I try not to be authoritive on anything until I got documentation to back me up and at the last minute of work on Friday I ran into a problem. One of the core programmers in my team is a recovering .net/asp developer who is still getting upto speed on PHP. He's got the block and tackle idea's but of course you can't become a master at a new language until you've had atleast one or two nervous breakdowns because the new language isn't doing what the other languages did. thedailywtf.com also helps.
Anyway: to the point. My understanding of the mysql library in PHP core is that it tries it's best to recycle instances to the server between different instances. So if script A is run by 10+ different people, php mysql is going to try and share. Apparently this is not true in .net (version unknown). My coworker got called in to fix a wtf script that would slowly devour all available connections to the DB because the last developer didn't close the connections. So he wrote this really amazing and really elaborate wrapper class that I don't think is necessary but I am not completely sure.
Basically, on wrapper creation, it checks a flag for "in_use" and if true, creates a new mysql_connect resource handle. This scares me because if I really understand it... the wrapper could create a dozen handles to the DB in one cycle of script execution then multiply that by number of individual script executions and this could be bad? Or am I wrong. Is the php mysql_ smart enough not to shoot us in the foot?
The original plan was for the DB wrapper to be used like so.
FrameworkObject->getDb("db name");
this then skims through an array structured like:
$dbc['db name'] = array('info'=>'This is the general db connection', 'server'=>'my.server.com', 'account'=>'myUserName','password'=>'pw','flags'=>NULL,'INT'=>NULL);
The key is the $dbc['db name']['INT'] which would hold the resource handle to the wrapper. Voila, instant conservation of resource handles. Then the trick is just to put in the DB::__destruct() a mysql_close();
Or am I wrong as well? or are we both wrong in ways not understood just yet?
It's been a while since i posted in here, but last time i got a great response and was sorted out quickly, so fingers crossed someone can spot the mischievous bit of code that is causing me problems and help me out :)
I am populating a drop down menu from a DB. I have sub categories and articles within those Subcats. I want the drop down to list the sub categories, then if there is only ONE article attached to that Subcat then it ges to a paage to display that article. If there are more than one, then it goes to a page that lists the articles for the user to choose.
I had the code working fine to display when just one article is assigned to each subcat. It even works when there is more than one.
HOWEVER, the problem is that if there is more than one article per subcat, it repeats the subcat name in the drop down. So if there are two articles, it lists the subcat twice, three articles shows three subcats, etc.
anyone able to look through the code and see where i am going wrong? :) pretty please? :)
many thanks in advance!
---lots of other php stuff up here, including an if statement just before the cut off point---
$catid = $rowCat['cat_id']; } // end if isset
$subcatSQL = "SELECT DISTINCT c.cat_id, c.cat_title, c.cat_parentid, c.cat_type, c.cat_visible"; $subcatSQL .= " FROM tbl_cats c"; $subcatSQL .= " WHERE c.cat_visible=1 AND c.cat_parentid = '$catid'"; $subcatSQL .= " AND c.cat_type LIKE 'articles%'"; $subcatSQL .= " ORDER BY c.cat_id ASC"; $rsSubCat = mysql_query($subcatSQL, $conn) or die("Query failed : " . mysql_error()); while($rowSubCat = mysql_fetch_array($rsSubCat)){
$subcatid = $rowSubCat['cat_id'];
$artSQL = "SELECT a.art_id, a.art_title, a.art_visible, ac.artcat_artid, ac.artcat_catid"; $artSQL .= " FROM tbl_articles a, tbl_art_cats ac"; $artSQL .= " WHERE ac.artcat_catid = '$subcatid' AND ac.artcat_artid = a.art_id"; $artSQL .= " ORDER BY a.art_id ASC"; $rsArt = mysql_query($artSQL, $conn) or die("Query failed : " . mysql_error()); $num_rows = mysql_num_rows($rsArt);
while($rowArt = mysql_fetch_array($rsArt)){
if ($num_rows > 1) { ?>
} elseif ($num_rows = 1) { ?>
} //end of elseif
} // end rowart while } //end rowsubcat while } // end of rowcat while ?>
I want to find a list of hostnames that were logged in between a given time period (say, one hour). In this example, I want the 4 hostnames that were being used on 2007-01-25 between 09:00:00 and 09:59:59. What query would I use to pull out those four hostnames? I'm being thrown off by the hostname with tid=256, which was being used between 9 and 10 but it wasn't logged in or out during those times. Can I even capture the data I need with the current schema? If I need to change something, that's not a problem.
If y'all could help me out I'd appreciate it. Thanks!
Edit: A friend and I got it figured out:
select thostname from login where time(tlogintime) < time('09:59:59') AND time(tlogouttime) > time('09:00:00') AND date(tlogintime) = date('2007-01-25');
Pre-question: what's a good method for displaying a script in livejournal?
Real question: Below the cut is a very quick function I wrote up to query for the existence of a table in MySQL. I want to cut it down even further and I was thinking the logic :
start table exists query `SHOW TABLES LIKE 'myTable'; if result && result num_rows > 0 then table exists? return true else return false end table exists
would be faster because it wouldn't loop. My thought is, the only way the query could return true(1+ results) is if it matched that table exactly (lack of %'s in the query expression). Anyone disagree?
I hate to be a bit obtuse. However, I wanted to gather people's thoughts on using Linux as a web development/design platform.
Are there any users out there that have used Linux and/or Windows in this capacity?
If so, what web dev/design tools for Linux do you find helpful and/or comparable to Windows-based applications (outside of GIMP, Apache, MySQL, LDAP and PHP-Eclipse, of course)?
Finally, if your user requirements for a website gave you the choice of either Mono or PHP, which would you pick and why?
I have a puzzling problem. I have this function below, used to find an author's numeric id from the author's name. It makes several checks, changing to string for alternate spellings to find a match. The problem is that if it finds a match in the first pass, it returns the number, but if it finds a match in subsequent loops, it doesn't (I had it echoing the information to check) and I don't know why!
I call it with $author_id = get_author($author, 0);
function get_author($author, $loop) { global $authors_table; $max = 5;
switch($loop) { case 0: $search_author = $author; break; case 1: $search_author = ucfirst($author); break; case 2: $search_author = strtolower($author); break; case 3: $search_author = str_replace("-", " ", $author); break; }
$query_author = "SELECT id FROM $authors_table WHERE author = '$search_author'"; $result_author = mysql_query($query_author) or exit(mysql_error()); $count = mysql_num_rows($result_author);
I have a few small projects I work on in PHP--mostly personal things and occasionally a project or two for work.
The problem is that I often work on more than one machine: one for work and my laptop. The projects rarely mingle, but I frequently find the need to refer to my old projects.
I'm basically looking for a cvs-like system in PHP. Like a personal online code repository, if you will. I've been running a MediaWiki installation, but it's really not designed for this sort of thing.
Ideally, it would have basic change tracking, search, and syntax highlighting (although if it doesn't, I'm handy enough with highlight_string() to add it in :). Bonus points for built-in debugging (yeah right) and for other language support (Java/C/MATLAB/TeX a plus). I'm not concerned at all about collaboration features, but I wouldn't mind them.
Any suggestions? I have PHP5/Rails/Python/MySQL available. I would prefer something in PHP/MySQL as I'm more comfortable with that pairing, but the others definitely aren't foreign.
(I'd like to keep this web-based and leave command-line utilities (e.g. cvs and subversion) as last resorts.)
I suppose I could write my own, but I guess that kind of brings about the whole "chicken and egg" thing.
Thanks in advance, everyone. Have a great long weekend!
edit: a friend just told me about PEAR, and I'm looking into it. Opinions?
Schedge, an Austin based company, is reinventing scheduling.
We are looking for an experienced Lead PHP developer.
Have you developed enterprise scale PHP applications? Have you worked with technologies like AJAX and MVC?
Then this might be the position for you!
You'll be responsible for leading the development efforts of the core application. The position is contract-to-hire with the option of equity in the company.
Key Areas of Responsibility: * PHP Application and database development * Work with Designers and other Developers to build complex user interfaces and data interactions * Write/Update functional specs
Preferred additional experience: * Experience with the CakePHP (or similar) PHP framework * Flash or Action Scripting experience * MySQL clustering * Code development for Linux servers
You'll be a good fit if: * You “get the Web”, and understand it’s full potential. * Work efficiently and get it right, not just "good enough" * Can set and execute priorities individually and in a group * Effectively communicate to people of varying levels of technical expertise
Please note: Telecommuting is possible for this position but the ideal candidate will be located in Austin, TX and available for weekly meetings.
If you feel you are a good fit for this position please send your resume and rate per hour to jobs@schedge.com
[Cross-Posted to several list] My apologies if you see it multiple times.
Schedge, an Austin based company, is reinventing scheduling.
We are looking for an experienced Lead PHP developer.
Have you developed enterprise scale PHP applications? Have you worked with technologies like AJAX and MVC?
Then this might be the position for you!
You'll be responsible for leading the development efforts of the core application. The position is contract-to-hire with the option of equity in the company.
Key Areas of Responsibility: * PHP Application and database development * Work with Designers and other Developers to build complex user interfaces and data interactions * Write/Update functional specs
Preferred additional experience: * Experience with the CakePHP (or similar) PHP framework * Flash or Action Scripting experience * MySQL clustering * Code development for Linux servers
You'll be a good fit if: * You “get the Web”, and understand it’s full potential. * Work efficiently and get it right, not just "good enough" * Can set and execute priorities individually and in a group * Effectively communicate to people of varying levels of technical expertise
Please note: Telecommuting is possible for this position but the ideal candidate will be located in Austin, TX and available for weekly meetings.
If you feel you are a good fit for this position please send your resume and rate per hour to jobs@schedge.com
[Cross-Posted to several list] My apologies if you see it multiple times.