I'm inserting some data into a database from a form. I'm using addslashes to escape the text (have also tried mysql_real_escape_string with the same result).
Regular quotes are escaped, but some other quotes are not. For example, the string:
Homer's blood becomes the secret ingredient in Moe’s new beer.
is converted to:
Homer\...
I'm doing a simple chat script and I have the killSession function which kills the current session and deletes the user from the DB. The problem is that after the name is set and verified the chat form doesn't load, it just kills the session and goes back to the loginForm(). Here's the script:
<?php
if (!isset($_SESSION['name'])) {
log...
I'm building a event calendar and pass a start time to PHP, in the format of 2009-09-25 15:00:00. A duration gets passed as well, that might be in the format of 60 minutes or 3 hours. Converting from hours to minutes isn't the problem. How do you add a length of time to an established starting point to correctly format the end time?
...
Hello i am having a issue with htaccess mod_rewrite, maybe someone here could point in the the right direction.
my site has 1 main file [index.php] all the navigation is done by passing vars in the url string eg
index.php?page=about
this is working ok with my .htaccess [below]
domain.com/about
some of the pages have a second variabl...
Am looking for a guide, or simple to understand method of designing a website.
I have a good idea of how to do various things in PHP anyways, basic knowledge of OOP, and functions and what not...
But I need some structure, to keep me on track and let me know what I should be doing.
Is there any websites, guides, or methods that can...
Hi,
I'm migrating a old (circa 2001) PHP 3 app to a new PHP5 server. 90% of the code worked right out of the box after migration and most of the remaining bit worked once I went through the old php.ini and changed settings in the new php.ini to match. Still there's one really annoying thing. One of the major things the app does is creat...
I've been struggling with getting a bunch of characters translated down to core utf-8 to store them in my database.
PHP iconv fails on many characters, so i've been forced to build my own 'solution', which really isn't a solution if it doesn't work, and it fails almost completely in windows, so developing with iconv is mostly fruitless...
Hi,
I'm new to php so I'm not sure why this is throwing an error. The class I'm working with asks for the following (I assume I should enter something in the blank areas):
var $headers = array(
"User-Agent"=>"SkipJack 1.0",
"Referer"=>"",
"Host"=>"",
"Acc...
Hello!
I was looking for a way to calculate dynamic market values in a soccer manager game. I asked this question here and got a very good answer from Alceu Costa.
I tried to code this algorithm (90 elements, 5 clustes) but it doesn't work correctly:
In the first iteration, a high percentage of the elements changes its cluster.
From ...
I noticed a few big sites use HTTP authentication.
Im wondering what the main difference is between this and session based logins are.
Any advantages or disadvantages.
Any explanation and or suggestions would be helpful as i'm trying to decide which login to use for my site.
thanks
...
I'm displaying a table of data:
[Name] [Tel] [Email] [checkbox]
Name 1 000 [email protected]
Name 2 000 [email protected] (checked)
Name 3 000 [email protected] (checked)
(BUTTON TO DOWNLOAD CHECKED IN XLS)
What I'm trying to achieve here is to create this button which will allow the user to download all checked entries in an XLS file?
...
I'm playing around with the IMAP protocol in PHP using fsockopen to send and receive commands. My preliminary experiments work but are insanely slow. It takes about 2 minutes for the simple function below to run. I've tried several different IMAP servers and have gotten the same result. Can anyone tell me why this code is so slow?
<?php...
Does the function add_new_user run the SQL INSERT query if it is inside the if clause?
I have the functions
function add_new_user ( $username, $email, $passhash_md5 )
{
-- cut: database INSERT queries
return 1;
}
I use the code abo...
Is it possible to view the PHP code of a live website ?
...
I'm pretty sure this is not possible in Zend Framework (I have searched the Web, the documentation and issue tracker) but I just want to make sure so I'm asking here.
$select = $this->select();
$select->union($select1, $select2);
That doesn't work of course. To explain what I need. I need to use UNION() to merge 2 tables in a SELECT q...
Hey,
How can I do this in PHP? e.g.
bit.ly/f00b4r ==> http://www.google.com/search?q=cute+kittens
In Java, the solution is this:
You should issue a HEAD request to
the url using a HttpWebRequest
instance. In the returned
HttpWebResponse, check the
ResponseUri.
Just make sure the AllowAutoRedirect
is set to true on t...
I'm trying to remove the the_guid() function that appears in feed-rss2.php. I've tried remove_action('rss2_item', 'the_guid') or remove_filter but nothing happens. I’ve also tried different hooks like the_content_rss...
The function appears on line 43 of feed-rss2.php, enclosed by <item></item>.
Update
With echo current_filter(), I fo...
I have a fairly large object-oriented php 5 project, and as part of a change impact analysis, I'd like to compile a report on the usage of each existing class throughout the project.
It would help me immensely if I could find an existing tool that will analyze all the files in my project and generate some sort of report that lists, for...
I have a table in MySQL That looks like the following:
date |storenum |views
-------------------------------
08/21/2009 |42 |3
-------------------------------
08/22/2009 |43 |1
-------------------------------
08/21/2009 |43 |4
-------------------------------
08/22/2009 |42 |22
------...
How can you get 1 as an output from #2?
#1
I ran this code
echo validate_email ( $email );
echo validate_password ( $password );
echo validate_username ( $username );
I get
111
which means that everything is ok.
#2
I run this code
function validate ( $email, $password, $username ) {
if ( (validate_email ( $email ) == 1)
...