Is there a good method of form security that does not involve CAPTCHA? CAPTCHA is so annoying, but I need security because I am getting form spam. My form is PHP.
Hi, I am getting the error; Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Why do I get this error? The mysql_real_escape_string() works on all of my pages apart from one? Is it something to do with MySQL being on a different server to the PHP server - if so, how do I fix it?
Thanks Tom
Hi.
Tumblr and other blogging websites allows people to post embeded codes of videos from youtube and all video networks.
but how they filter only the flash object code and remove any other html or scripts? and even they have an automated code that informes you this is not a valid video code.
Is this done with REGEX expressions? And Is there a PHP code to do that?
Thanks
I've been trying to configure xdebug to work along with netbeans, my current configuration is
[xdebug]
zend_extension="C:\binaries\php\ext\php_xdebug-2.1.0RC1-5.3-vc6.dll"
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1 (also tried localhost)
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
I tried the test provided by a netbeans blog explaining how to test if the configuration works when binding it just outputs "unable to bind"
Any suggestions?
Ok, I'm about 50% done with the "30 minute" quickstart guide from Zend.
I must be missing something, because this seems like a total waste of time. The point of this quickguide is to create a guestbook, something I could do in 5 minutes with regular naked non-framework php.
Here's my path to zend framework:
c:/program files/wamp/www/_zend/
Here's my path to my quickstart project:
c:/program files/wamp/www/_zend/bin/quickstart/
I have a number of questions at this point:
http://framework.zend.com/docs/quickstart/create-a-model-and-database-table
1: I'm running the command line to run my database loading script. I get an error stating the it can't find the Zend/AutoLoader.php becuase my path to the zend library is wrong. I followed all of the steps. I defined the path to my zend library in the main config file, but for some reason, its defined again in my db loader. In all of these scripts that they have me load, it points the relative path to the zend library as being /../library
Problem is, there's nothing in that folder. To get to my actual zend folder, you'd need to be (relatively) /../../../../library
Which brings me to my 2nd question:
2: Where the #$#$ is the main Zend files supposed to be? The install directions were basically "put it wherever you want", when the real answer (after a bunch of errors and wasted time was) was "put it somewhere so that its really easy to type the full path a thousand times in command line" and "it also better be in a runnable place on your webserver since its going to create your quickstart application in a subdirectory within zend".
Which brings us to the third question
3: Am I supposed to have this libary in both the parent core Zend (wamp/_zend/library) AND my application (quickstart/library)?
4: If that is the case, it seems like a ton of wasted files to be uploading. I'd like to use Zend to create products that my customers will download. 5 megs of overhead seems like a bit much. Zend claims you can use these library components separately, but it looks to me like I'm going to have to upload them every time.
Which leads to the next question:
5: It appears that perhaps Zend is more for a single application that is not supposed to be distributed. Is this not the case?
6: According to their default file structure everything but my /public folder would be above public_html on my server if I wanted this to rest on my TLD. I would need to rename every reference of /public/ to /public_html/, or am I missing something else?
I try to send http request like:
..."POST http://api.facebook.com/restserver.php?method=facebook.users.setStatus&api_key=762ec91e7987aaeaee7e2cdfdfcb3c30&call_id=$call_id&sig=$s&v=1.0&uid=1533439618&status=44 HTTP/1.1";....
but I receive nothing...
in twitter I success:
..
"POST ht tp://twitter.com/statuses/update.xml?status=123123 HTTP/1.1"
...
Hello,
I am trying to create my own torrent tracker but dont know how to generate info_hash that is used xbtt to track torrents.
Is this possible with php?
I am using this function to bencode and decode http://paste.lisp.org/display/17178
Thank You.
Hello,
I'm kind of a website development nub so bear with me.
My problem is that the website php session doesn't seem to be set when I log in to my website. After ensuring that the username and password are correct, I have the following simple code:
$_SESSION['username'] = $myusername;
$_SESSION['password'] = $mypassword;
session_start();
Content that should display after logging in is not displayed.
Thanks in advance,
Matt
I am trying to run a script on my local machine, I am on MAC OSX leopard. I have PHP 5.2.x installed and Apache2. I am trying to test this script but I keep getting this error. I googled around a little and saw something where it said it might only be available on linux/unix machines but I find that hard to believe.
Is Magento usually so terrible slow?
This is my first experience with it and the admin panel simply takes ages to load and save changes. It is a default installation with the test data.
The server it is hosted on serves other non-Magento sites super fast. What is it about the PHP code that Magento uses that makes it so slow, and what can be done to fix it?
Im using the Twitter API to read the Favorites RSS, it generates the following output:
http://vl3.co.uk/favs/getfavs.php
I'm not sure why this file seems to be incorrect, doesnt come up in my RSS reader or render correctly in the browser. Can anyone shed any light on this?
If the output is not valid RSS how can I make it so?
Secondly I'd like to cache the RSS feed to then use something like Magpie RSS Parser.
Trying a bit of AJAX, and I find that much of my data is littered with underscores!
Documentation confirms that this is working as intended. Any way to pass my form information to PHP intact? I'm using CodeIgniter, so my pass looks like /controller/function/variable,
receiving controller:
controller{
function($v=0){#what once was hello world is now hello_world...}
}
I can't very well do an undo, data might contain an underscore.
Thanks,
Brandon
good morning programers,
I have this small code which content a news control panel and I made a submit button there to active or inactive the news row so if I click on this button it should change if it's active it will be inactive it worked but there's something wrong there when I click on item one it updates the last on the table not the first on as it should do.
here is the code that I use
<?php
$getNewsData="select * from news";
$QgetNewsData=$db->query($getNewsData)or die($db->error);
$count=mysqli_num_rows($QgetNewsData);
while($newsRow = mysqli_fetch_array($QgetNewsData)) {
$getActivityStatus=$newsRow['news_activity'];
switch($getActivityStatus){
case 1: echo"<input style='color:red; font-weight:bold; background:none; border:0;' name='inactive' type='submit' value='?????' /><input name='inActive' type='hidden' value='".$newsRow['news_id']."'/>";
break;
case 0: echo"<input style='color:green; font-weight:bold; background:none; border:0;' name='active' type='submit' value='?????' /><input name='Active' type='hidden' value='".$newsRow['news_id']."'/>"; break;}
}
if(isset($_POST['inactive'])){
$inActive=$_POST['inActive'];
echo $inActive;
$updateStatus="UPDATE news SET news_activity=0 WHERE news_id='".$inActive."' ";
$QupdateStatus=$db->query($updateStatus)or die($db->error);
if($QupdateStatus){
}
}
if(isset($_POST['active'])){
$Active=$_POST['Active'];
echo $Active;
$updateStatus="UPDATE news SET news_activity=1 WHERE news_id='".$Active."' ";
$QupdateStatus=$db->query($updateStatus)or die($db->error);
if($QupdateStatus){
header("Location:CpanelHome.php?id=7");
}
}
?>
please any idea to solve this problem.
Thanks,
regards
Hi,
I am (newbie) using Kohana V 3.0.3 and my directory structure is:
pojectsys (kohana's system directory) parallel to htdocs directory
C:\xampp\pojectsys
and my application directory is in htdocs
C:\xampp\htdocs\examples
Inside C:\xampp\htdocs\examples\index.php, following variables have been set:
$application = 'C:\xampp\htdocs\examples\application';
$system = 'C:\xampp\pojectsys';
Now when I am trying to execute http://lc.examples.com/ then Kohana returns error:
ErrorException [ Fatal Error ]: Class 'Controller' not found for line 3
class Controller_Welcome extends Controller {
Please help me to resolve this issue.
I'm using the David Walsh PHP calendar script and need to format my date arguments like this:
draw_calendar(7,2009);
I want to get today's Month and Year as well as the next month and the month after that (so current month, plus one, plus one). How can I call the function three times in succession to generate these three calendars only knowing today's Month and Year?
-Brandon
I have a script that is designed to parse XML postbacks from Ultracart, right now just dumps it into a MySQL table. The script works fine if I point it to a XML file on my localhost but using 'php://input' it doesn't seem to grabbing anything. My logs show apache returning 200 after the post so I have no idea what could be wrong or how to drill down the issue.. here's the code:
$doc = new DOMDocument();
$doc->loadXML($page);
$handle = fopen("test2/".time().".xml", "w+");
fwrite($handle,trim($page)); // it doesn't save this either :'(
fclose();
require_once('includes/database.php');
$db = new Database('localhost', 'user', 'password', 'db_name');
$data = array();
$exports = $doc->getElementsByTagName("export");
foreach ($exports as $export) {
$orders = $export->getElementsByTagName("order");
foreach($orders as $order) {
$data['order_id'] = $order->getElementsByTagName("order_id")->item(0)->nodeValue;
$data['payment_status'] = $order->getElementsByTagName("payment_status")->item(0)->nodeValue;
$date_array = explode(" ",$order->getElementsByTagName("payment_date_time")->item(0)->nodeValue);
if ($date_array[1] == 'JAN') { $date_array[1] = '01'; }
if ($date_array[1] == 'FEB') { $date_array[1] = '02'; }
if ($date_array[1] == 'MAR') { $date_array[1] = '03'; }
if ($date_array[1] == 'APR') { $date_array[1] = '04'; }
if ($date_array[1] == 'MAY') { $date_array[1] = '05'; } // converts Ultracart date to
if ($date_array[1] == 'JUN') { $date_array[1] = '06'; } // MySQL date
if ($date_array[1] == 'JUL') { $date_array[1] = '07'; }
if ($date_array[1] == 'AUG') { $date_array[1] = '08'; }
if ($date_array[1] == 'SEP') { $date_array[1] = '09'; }
if ($date_array[1] == 'OCT') { $date_array[1] = '10'; }
if ($date_array[1] == 'NOV') { $date_array[1] = '11'; }
if ($date_array[1] == 'DEC') { $date_array[1] = '12'; }
$data['payment_date'] = $date_array[2]."-".$date_array[1]."-".$date_array[0];
$data['payment_time'] = $date_array[3];
//... we'll skip this, there are 80 some elements
$data['discount'] = $order->getElementsByTagName("discount")->item(0)->nodeValue;
$data['distribution_center_code'] = $order->getElementsByTagName("distribution_center_code")->item(0)->nodeValue;
}
}
}
$db->insert('order_history',$data);
} else die('ERROR: Token Check Failed!');
Hi, I'd like to print a simple table in my page with 3 columns, building name, tags and architecture style. If I try to retrieve the list of building names and arch. styles there is no problem:
SELECT buildings.name, arch_styles.style_name
FROM buildings
INNER JOIN buildings_arch_styles
ON buildings.id = buildings_arch_styles.building_id
INNER JOIN arch_styles
ON arch_styles.id = buildings_arch_styles.arch_style_id
LIMIT 0, 10
My problem starts on retreaving the first 5 tags for every building of the query I've just wrote.
SELECT DISTINCT name
FROM tags
INNER JOIN buildings_tags
ON buildings_tags.tag_id = tags.id
AND buildings_tags.building_id = 123
LIMIT 0, 5
The query itself works perfectly, but not where I thought to use it:
<?php
// pdo connection allready active, i'm using mysql
$pdo_conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$sql = "SELECT buildings.name, buildings.id, arch_styles.style_name
FROM buildings
INNER JOIN buildings_arch_styles
ON buildings.id = buildings_arch_styles.building_id
INNER JOIN arch_styles
ON arch_styles.id = buildings_arch_styles.arch_style_id
LIMIT 0, 10";
$buildings_stmt = $pdo_conn->prepare ($sql);
$buildings_stmt->execute ();
$buildings = $buildings_stmt->fetchAll (PDO::FETCH_ASSOC);
$sql = "SELECT DISTINCT name
FROM tags
INNER JOIN buildings_tags
ON buildings_tags.tag_id = tags.id
AND buildings_tags.building_id = :building_id
LIMIT 0, 5";
$tags_stmt = $pdo_conn->prepare ($sql);
$html = "<table>"; // i'll use it to print my table
foreach ($buildings as $building) {
$name = $building["name"];
$style = $building["style_name"];
$id = $building["id"];
$tags_stmt->bindParam (":building_id", $id, PDO::PARAM_INT);
$tags_stmt->execute (); // the problem is HERE
$tags = $tags_stmt->fetchAll (PDO::FETCH_ASSOC);
$html .= "... $name ... $style";
foreach ($tags as $current_tag) {
$tag = $current_tag["name"];
$html .= "... $tag ..."; // let's suppose this is an area of the table where I print the first 5 tags per building
}
}
$html .= "...</table>";
print $html;
I'm not experienced on queries, so i though something like this, but it throws the error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.
What can I do to avoid this? Should I change all and search a different way to get this kind of queries?
Is it possible to read cookie expiration time with php ?
When I print_r($_COOKIE) it outputs:
Array
(
[PHPSESSID] => 0afef6bac83a7db8abd9f87b76838d7f
[userId] => 1232
[userEmail] => [email protected]
[firstName] => user
[lastName] => user
)
So I think $_COOKIE don't have the expiration time, is it possible with some other function?
I want to Zend_Auth and Zend_Session to save user sessions and logins information
whats the easy and best way for implements following items:
1-Disallow multiple concurrent logins for the specific user
2-List all of all user currently logged in
3-Admin could logout of specific user or destroy specific session
Is there any special ZF or PHP API or library that can do the above?
thanks
I have a facebook app that is displaying random quotes - it is written in php.
One quote in the database looks like this:
"There's only one rule in photography - never develop colour film in chicken noodle soup.
- Freeman Patterson"
When it is seen on facebook it looks like this:
"Thereu0027s only one rule in photography - never develop colour film in chicken noodle soup.
- Freeman Patterson"
How do I fix it?
Right, so if you have to decide on a server-side language for a distributed Linux-based server backend, would you choose:
PHP
Mono ASP.net
Java
As a C++ programmer, I'm thinking Java+Tomcat, but I'd love to hear experienced thoughts here, especially relating to debugging and IDE (likely Eclipse).
Also, please, it's not a flame question. I'm seeing excellent sites written in all, I'm just thinking about the compile/debug/release cycle.
Cheers,
Shane
I'm using PHP and I've never really done anything with Javascript or JQuery or AJAX. I'm just wondering if there are any available solutions to accomplish the same effect of auto-completion that SO uses for entering tags.
There are plugins which can handle one word but I haven't seen any that handles multiple words.
Also, I hear JQuery is hosted on google code. Is it a good or bad idea to link directly from that?
I have a pretty large insert statement something like
INSERT INTO multimedia (filename, regex, flag) VALUES (('adsfavr.jpg', '<div id="title">', 0), (...), (...));
How do I prepare the query for MySQL.It's too long to do it manually. It includes double quotes so I can't use the php function mysql_real_escape_string()
Wordpress ships with the wpdb class which handles CRUD operations. The two methods of this class that I'm interested in are the insert() (the C in CRUD) and update() (the U in CRUD).
A problem arises when I want to insert a NULL into a mysql database column - the wpdb class escapes PHP null variables to empty strings. How can I tell Wordpress to use an actual MySQL NULL instead of a MySQL string?