I made a website that depends on PHP, AJAX and Javascript.
The problem here is that the website is unstable which means sometimes the validation is working and some times it is not working at all.
The validation code is written in JavaScript. Does this mean that we need more special conditions?
The code for validation:
<script langua...
I have no idea what I'm doing wrong. I just need to be able to encrypt and decrypt without getting weird characters or warnings. It says I'm supposed to be using an IV of length 16 and that I'm using a length of 9 but "0123456789abcdef" is 16 characters.
Warning: mcrypt_generic_init() [function.mcrypt-generic-init]: Iv size incorre...
I'm, generating a SQL query like this in PHP:
$sql = sprintf("UPDATE %s SET %s = %s WHERE %s = %s", ...);
Since almost every part of this query is dynamic I need a way to determine the table's primary key dynamically, so that I'd have a query like this:
$sql = sprintf("UPDATE %s SET %s=%s WHERE PRIMARY_KEY = %s", ...);
Is there a M...
This working code seems to be the typical solution to this problem.
It takes a multi-dimensional array that holds categories and their subcategories (with no implied limitation on how many levels deep it goes) and creates an HTML unordered list from it, echoing it out onto the page from inside a recursive function.
Sub-levels are trave...
Hi, i have a wordpress blog and several authors. i want to auto remove some website urls from my blog content. For example i don't want ANY myspace urls in post content, not only myspace.com than myspace.com/whatever or myspace.com/faq.html...
Is that possible to do that with some php codes or adding some codes to .htaccess file ?
Than...
I am trying here to basically find users that do have sports & regions targeted by an activity. In the acces [users] table there is around 17K users. Each can have a certain number of sport interests and one region.
There query here look for each users that have one sport & one region at least that are targeted via the activities. Spor...
SOLVED:
I wrote and tested a PHP script on the local server. (Nothing fancy, just 2 consecutive SQL inserts in the same database, but different tables).
Both servers run PHP5 & MYSQL 5.
On the local server, both queries are processed correctly.
On the live server, only the first query works, but not the second and I can't figure out ...
I'm trying to connect to a RESTful web service, but I'm having some troubles, especially when sending data over PUT and DELETE. With cURL, PUT requires a file to send, and DELETE is just weird. I'm perfectly capable of writing a client using PHP's socket support and writing the HTTP headers myself, but I wanted to know whether you guys h...
I'm using NetBeans for my PHP programming. Most often it's pretty clever in finding class declarations, especially if they are found in the same project. But sometimes it just refuses to find a class' definition, like a PEAR library's class. Is there a way for me to show NetBeans where a certain class is defined, manually, and enjoy the ...
How can I run several PHP scripts from within another PHP script, like a batch file? I don't think include will work, if I understand what include is doing; because each of the files I'm running will redeclare some of the same functions, etc. What I want is to execute each new PHP script like it's in a clean, fresh stack, with no knowl...
There is a project written in PHP that is just simply all procedural ... step by step calling DB functions, processing, and printing out the output. And then it is changed to totally object oriented -- there is a singleton for the App object, and various functions are invoked through the App object.
Someone claims that the memory usage...
Hello!
In PHP, I have the following code for calculating the distance between two locations:
<?php
function distance($lat1, $long1, $lat2, $long2) {
// DEGREE TO RADIAN
$latitude1 = $lat1/180*pi();
$longitude1 = $long1/180*pi();
$latitude2 = $lat2/180*pi();
$longitude2 = $long2/180*pi();
// FORMULA: e = ARCCOS (...
Is it possible to sanitize all input sent by one method in PHP by simply doing
$var = mysql_real_escape_string($_POST);
and then access elements of $var as I would have of $_POST ?
...
So $array is an array of which all elements are references.
I want to append this array to another array called $results (in a loop), but since they are references, PHP copies the references and $results is full of identical elements.
So far, the best working solution is:
$results[] = unserialize(serialize($array));
which I fear t...
I am converting a script from PHP to ASP.net C#. In PHP, i could use something like:
header('Content-type: text/json');
header('Content-type: application/json');
How can I tell my aspx page to declare in the header that it is printing a JSON file?
...
I'm trying to do a usort in PHP, but I can't access global variables inside a usort function.
I've simplified my code down to bare bones to show what I mean:
$testglobal = 1;
function cmp($a, $b) {
global $testglobal;
echo 'hi' . $testglobal;
}
usort($topics, "cmp");
Assuming the usort runs twice, my expectations is this will...
Hey all,
I have the following rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
and my url is as follows:
http://www.mydomain.com/189-9544737-0616922?%5Fencoding=UTF8&node=10
On myphp.php
var_dump($_GET): array(3)...
i have large form that i want to send in mail using php, although i can send it with request['name'] i have to write it more than 50 times in message variable, what i want to do how i can add the keys and values to message variable with some filteration that i want to omit submit request variable
...
function t1()
{
echo 1;
}
function t2()
{
echo 2;
}
$funcs = array(t1,t2);
$length = count($funcs);
for($i=0;$i<$length;$i++)
{
$funcs[$i]();
}
when I execute this tiny php file:
PHP Notice: Use of undefined constant t1 - assumed 't1' in D:\jobirn\test\str.php on line 11
PHP Notice: Use of undefined constant t2 - assumed 't2...
Hi
I want to give the user the ability to import a csv file into my php/mysql system, but ran into some problems with encoding when the language is russian which excel only can store in UTF-16 tab-coded tab files.
Right now my database is in latin1, but I will change that to utf-8 as described in question "a-script-to-change-all-tables...