Lately I've been using client-side jQuery scripts to fill in forms when users edit records in a custom CMS I've built. Server side script is PHP.
How to do it isn't my issue. My question to you is opinion seeking. My clients have to have javascript turned on to use my CMS which so far hasn't been a problem as most users don't take i...
I have a small website that works like below
1) User goes to the login page and enters the credentials (call it page1)
2) The form gets posted to page2, which authenticates the user, calls
session_start and then sets a session variable with $_SESSION['somevar'] and
redirects to the page3
3) On page3 , I check if the $_SESSION['...
Pretty simple question: which one of these two PHP (version 5+) header call is the "best"?
header('Not Modified', true, 304);
header('HTTP/1.1 304 Not Modified');
I'm pretty sure the first one is the most polyvalent one, but just curious if PHP would "fix" the second one if under HTTP 1.0...
Thanks!
Edit: One of these header crashes...
Hello!
I have a string like "Welcome to McDonalds®: I'm loving it™"... I want to get rid of ":", "'", ® and ™ symbols, so I do the following:
$string = "Welcome to McDonalds®: I'm loving it™";
$string = preg_replace('/[^a-zA-Z0-9 -]/', '', $string);
BUT on the output I receive:
"Welcome to McDonaldsreg Im loving ittrade"... so preg...
Hello!
I already posted a similar problem and it was resolved, but now I'm trying to work with array of objects and I'm not sure how to resolve this:
So, I have an array similar to this:
array(10) {
[0]=>
object(VO)#6 (35) {
["eventID"]=>
string(1) "1"
["eventTitle"]=>
string(7) "EVENT 1"
["artistID"]=>
st...
Hi,
I am trying to create authentication for my php website. I am using the codeigniter framework. I will have to validate the session in all the pages of my website. So to avoid the code repetition, i am planning to do it in a helper function. Now that my user credentials are
in my database i would like to access the model to query th...
I have a (php/html/jquery/css) page where i'm displaying tags at the top (e.g. green, white, fruit, vegetable)
On the page I have divs marked appropriately with classes:
<div class="green fruit">apple</div>
<div class="green vegetable">broccoli</div>
etc.
I'd like to show/hide divs based on which tags have been toggled show/hide.
B...
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40000 bytes) in /mounted-storage/home20a/sub001/sc20063-GJYD/[...] on line 62
It looks like the PHP-script only allowes me to allocate 32 MB to the memory? This was with an example image to test what would happen if a user tries to upload a huge picture.
My...
i am using following code to insert data into mysql database
<?php
$refselect = $_POST['refselect'];
$refname = $_POST['refname'];
$refemail = $_POST['refemail'];
$refcnt = $_POST['refcnt'];
$refdes = $_POST['refdes'];
$referror = $cberror = "<h1>Data not Added</h1><br/><br/><h3>Please Follow The Instructions</h3>";
$ure...
hi.
i have a form which allows the user to upload some files to a folder.
i've edit the .htaccess file in that directory to protect this folder from allowing the unwanted visitors to download the contents manually by typing the full url
ex:
http://www.bkabkabka.com/a/b/c/document.pdf
and this is the .htaccess data
Options All -Indexe...
Do you know any strictly equivalent implementation of the PHP similar_text function in Java?
...
All,
I was wondering if you have any suggestions for the best graphing library available for PHP. I plan to accomplish the following things:
It should be scalable to support complex graphing plotting.
It should support forecasting of data.
It should be easy to implement and should be flexible to extend feature set.
It should be option...
Hello,
I just wondered if there were an native PHP function that would replicate the following snippet?
<?php
$array = array(0 => 'element1', 1 => 'element2');
$element1 = $array[0];
unset($array[0]);
?>
Basically, I wish to grab an array element but unset that particular key at the same time. Is this possible?
...
Creating simple php login scripts is easy, with simple one table mysql integration. I was wondering how i could you the rather snazzy HTTP Authentication that is available in HT Access and PHP, but the users are checked against a mysql database?
I am sure this is possible, but i have no idea how :/
...
I'm writing a custom plugin thing which needs to search the product catalog. Based on some sample code I saw somewhere (possibly this site), I came up with this working prototype:
$searcher = Mage::getSingleton('catalogsearch/advanced')
-> addFilters(array('name' => $_REQUEST['name']))
-> addFilters(array('sku' => $_REQUEST['sku'...
I have an iPhone app with an array of objects that I want to send to a PHP script and have them be stored in a mySQL database. The objects in the array contain only floating points and strings, nothing special.
From what I understand the best way to send the array to the php script is to convert the array into an JSON, send it to the ...
I wasn't able to find an overview of the types which can be hinted with PHPDoc. I know array or string, but is there also bool? Like:
/**
* @param bool loadLazy
* @return array Array with objects
*/
public function getObjects($loadLazy=false) {
...
I have cacheable dynamic content made in PHP 5.1.0+. I already send the correct headers (including Last-Modified and ETag) to clients.
I now want my script to be able to answer $_SERVER['HTTP_IF_MODIFIED_SINCE'] and $_SERVER['HTTP_IF_NONE_MATCH'] when present. When the conditions matches, I want to answer a HTTP 304 "Not Modified" to cl...
i am using following code to insert data into mysql database
<?php
$refselect = $_POST['refselect'];
$refname = $_POST['refname'];
$refemail = $_POST['refemail'];
$refcnt = $_POST['refcnt'];
$refdes = $_POST['refdes'];
$referror = $cberror = "<h1>Data not Added</h1><br/><br/><h3>Please Follow The Instructions</h3>";
$ure...
I have implemented the Data Mapper pattern with the Identity Map pattern. In short: When I want to have 2000 objects from the database, the mapper checks the result set against an hash map which contains references to already created objects. If an id is already in the hash map, the old object is added to the return array instead. Otherw...