php

To know the time POST data is stored in one session

How long is the POST data from forms stored in a session such that you can access it by the following command in PHP? $_POST['email'] I have 777 forms and each give me data in the POST -form. Each name of the input is unique. I would like to know where is limit about the POST -data. ...

Find length of initial segment matching mask on Arrays

Given an array with n values, for example: $arr[] = 'ABCDEFABC'; $arr[] = 'ABCDEFDEF'; $arr[] = 'ABCDEFGHI'; $arr[] = 'ABCDEFJKL'; how can I find the initial segment that matches all (or most, in the example bellow) values, in this case ABCDEF? EDIT 2: NOT SOLVED, SEE ANSWER. Even worse, given the following array: $arr[] = 'ABCDEFA...

PHP: Where should validation functions be stored?

I'm using a PHP MVC Framework, and I've been just lumping all my validation functions in a helper class which get called when I need them. However, isn't the Model for logic about working with data, not exclusively databases? Would it make more sense to put the validation functions in one of my models? Thanks ...

To manipulate URL based on coming URL by PHP

How can you manipulate the destination URL by the name of the starting url? My URL is www.example.com/index.php?ask_question I do the following manipulation in the destination URL if ($_GET['ask_question']) { // Problem HERE, since if -clause is always false if ( $login_cookie_original...

Searching Twitter

How can I make a simple search on Twitter through PHP, Java, or CURL JSON? ...

To make a login cookie by POST data by PHP

How can you make a login cookie of the POST -data by PHP? My code registration.php global $login_cookie = $_POST['email'] . ',' . md5($_POST['password']); // this does not work: Parse error: syntax error, unexpected '=', expecting ',' or ';' setcookie("login_cookie", $login_cookie); // this is empty because of ...

How to keep track of login status by PHP?

How can you keep track of login status by PHP? I include the following page to each my page to check the login status. I try to identify the user after he logs in by the cookie. However, I have not managed to read my login_cookie or use it in any way. The code *handle_login_status.php* where I manipulate the login status <?php $...

show message when no rows selected mysql php

My code looks like this: $result = mysql_query("SELECT * FROM `picdb` WHERE `picid` = '$picid' ") or trigger_error(mysql_error()); while($row = mysql_fetch_array($result)){ foreach($row AS $key => $value) { $row[$key] = stripslashes($value); } Problem is that when there is no row to select, nothing happens, my $row array is empty. ...

Problem of choosing comet server

I want to write a php site which uses the comet technology for real time update. I have a few questions: Is it better to use a comet server? Which comet server is good? For comet server (e.g. orbited), I have to first install the python based orbited server and then write php file to create socket to connect to the comet server. Right...

Need a good jQuery/AJAX tutorial (form upload related)

I've recently started using jQuery with php. On the application I'm currently making I have a form which inserts various text data along with an image file upload. What I want is a good jQuery/AJAX tutorial on submitting this form, having it upload the file (maybe with some kind of loading image/message) then after its finished doing it...

Can't get cookies with php curl from www.dramexchange.com

I can get cookie from the others but not from this site www.dramexchange.com? Anybody know why? Maybe someone can do it with php and curl? :> $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookieFileName"); curl_setopt($ch, CURLOPT_URL,"http://www.dramexchange.com"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); ob_start(); ...

How to make sure a human doesn't view the results from a PHP script URL?

How to make sure a human doesn't view the results from a PHP script URL? Recently when viewing the source of a site that was making an AJAX call, I tried to follow the link in the browser www.site.com/script.php?query=value Instead of getting the result I expected to see, I saw a message stating only scripts should view that page. H...

like query doesn't work exact

hey guys, I'm building a little search application (I know I can use match against). But now is the problem: If I'm search after a piece of a word, I'm finding the match, but if I do an exact match, it doesn't work... My mysql code: SELECT * FROM Dames WHERE naam LIKE "%alessia%" LIMIT 0,28 $link->Stuk(1) is just a parameter and ...

Do all browsers support PHP's $_SERVER['HTTP_X_REQUESTED_WITH']?

Do all browsers support PHP's $_SERVER['HTTP_X_REQUESTED_WITH']? Do you know of any browsers or times where $_SERVER['HTTP_X_REQUESTED_WITH'] would not work? ...

Redirect while clearing referrer. php if possible

I have a php script that check if the referrer has been cleared after a short process, if it is it forwards to the destination, if it isn't blanked, the process I used for clearing the referrer restarts. It works so far, this is the code I used: <?php $referer = $_SERVER['HTTP_REFERER']; if($referer == "") { echo "<meta http-equiv=\"ref...

MySQL query based on 3 tables

Hello. I work with PHP. I have a table named books. In table books I have the book_name with the name of the book, book_publisher with the publisher's ID and book_author with the author's ID. Besides the books table I have the books_author table with the authors names and IDs and books_publisher with the books publishers names and IDs. ...

Maximum server file access frequency

I'm trying to create a AJAX push implementation in PHP using a Comet long-polling method. My code involves using file_get_contents() to read a file repeatedly to check for any messages to send to the user. To reduce server load, I'm using two text files; one containing the actual command and one acting as a "change notifier", which eithe...

One big DAO or multiple smaller ones?

If I have to save an object to the database which has a relationships, do I have that dao do all the saving itself, or to delegate to other DAO's. If it should delegate to other DAOs, should that be done in the DAO itself, or in a layer above (like a service layer)? I would use an ORM for this, except that in PHP, nothing good exists yet...

Beautiful way to remove GET-variables with PHP?

I have a string with a full URL including GET variables. Which is the best way to remove the GET variables? Is there a nice way to remove just one of them? This is a code that works but is not very beautiful (I think): $current_url = explode('?', $current_url); echo $current_url[0]; The code above just removes all the GET variables. ...

Cocoa Core Data to PHP: Converting date

I have dates that are being stored in a database by core data. I then am using php to print out this date information but the date is coming out wrong. When I store Aug 2, 2009 in core data it comes out in the php as Fri, August 4, 1978. How do I fix the conversion? ...