I'm wanting to store items in my database with a DATE value for a certain day. I don't know how to get the current Monday, or Tuesday, etc. from the current week. Here is my current database setup.
menuentry
id int(10) PK
menu_item_id int(10) FK
day_of_week date
message varchar(255)
So I have a class setup that holds all the info then I was…
I'm building a little script that will connect to an IMAP account and grab the content of the email and also the attachments. It works well for the most part, but when a really large file comes in, it causes the script to time out. Is there any way that I can check the file size before trying to grab it? I think that would be the simplest…
hi,
i have access to the zone file for a tld. How can I extract just the domain names in the fastest possible way?
Any suggestions on how to store them in a database/file? There are millions of them.
I have to use redirects a lot in my scripts, for example after a user logs in I need to redirect them to the admin area, etc. But I find it inconvenient to always have to have the header function at the very top. So if I use the meta refresh tags for my redirects, is that something that would be frowned upon according to best practices or is…
I am trying to test if the uploaded file is the image type I want. If it isn't a gif,jpeg, png, it should echo "Problem". But when I execute this code, it always says there's a problem. What's wrong with my if statement?
$uploadfile_type=$_FILES['userfile']['type'];
if ( ($uploadfile_type !='image/gif') || ($uploadfile_type…
I am getting this error when I pass an invalid SQL string... I spent the last hour trying to find the problem assuming - It's not my SQL it must be the db handle... ANyway, I've now figured out that it was bad SQL...
What I want to do is test the result of the mysql_query() for a valid resultset.
I am simply using…
I have an array of data that looks like this:
2008, Honda, Accord, Used, Car
And I'm trying to figure a way to make a number of sub strings from each item in the array. For example, I would like to loop each item and create the following substrings:
2008
2008 Honda
2008 Accord
2008 Used
2008 Car
2008 Honda…
I'm thinking about putting every class into a separate file and doing the static initialization outside of the class definition.
The problem with this is the fact that the initialization will happen before the said class is actually needed (it will happen when the file which contains the class is included for…
I am working on a old code base, where programmers assumed that register_globals will always be on. Hence variables are used without $_GET or $_POST prefix, pretty much in every page (the code base is huge, hundreds of scripts). I tried turning it off, but the very first script (login script) goes on an…
Examples of the translations I need to do:
$stringDate = "November 2009"; $output = "11/09";
$stringDate = "October 1 2010"; $output = "10/01/2010";
$stringDate = "January 2010"; $output = "01/10";
$stringDate = "January 9 2010"; $output = "01/09/2010";
Note that I do not know which format the…
Is there a catchall function somewhere that works well for sanitizing user input for sql injection and XSS attacks, while still allowing certain types of html tags?
So, I've got this huge XML file (10MB and up) that I want to parse and I figured instead of using SimpleXML, I'd better use XMLReader. Since the performance should be way better, right? But since XMLReader doesn't work with XPath...
The xml is like this:
<root name="bookmarks">
*…
i have this function here that i have in a class
function enable_ssl() {
if ($_SERVER[HTTPS]!="on") {
$domain = "https://".$_SERVER['HTTP_HOST']."/".$_SERVER['SCRIPT_NAME'];
header("Location: {$domain}");
}
}
but the problem is when the server doesnt have ssl…
I don't want anything incredibly complicated. I am working on a client outside the US, and I just want a basic check to see if someone is accessing his page from the US or not. After that, I am going to default the language in either English or Spanish, after determining where the…
Hi,
I have searched but havent been able to find my answer.
It follows like:
I would like to replace all URL in a string to links except the URLs within img src tag.
I have a regular expression for replacing all the URLs to links, but would like it to NOT replace the URLs within…
I am going to be implementing a small custom CMS for a website. I was wondering if there are any more popular methods for implementing pagination using OOP. Thanks!
Hi,
I have an object $rows
If I use echo $rows the content is displayed in my html page, however I would like to select only some parts of the content but I cannot see inside the variable how it is structured...
thanks