php

Protecting an ASX file in PHP

I have a members only area on my site where users can login and view Windows Media streaming content. I have created a PHP script to serve the ASX file however I cannot validate this with session information. I think this is because the WMP is making the request and not a php page. Can anyone suggest an elegant way to protect ASX file...

How to incorporate information from one site to another?

Hi, Lets say I have two sites www.a.com and www.b.com. There is a newsletter subscription form on site www.a.com and i need to incorporate that submitted information to site www.b.com and information will be name, address,newsletter format and email id of the subscriber. Is there any way to do so. I am using PHP. Thanks in advance ...

Php, should i use sha1 or others version of sha? Whats are the differences?

Hi, I am going to generate a random password for my users. Probably I will use salt and sha1 method. But I found that there are other version of sha1, like sha256, sha512 etc. What is the differences between the sha versions? Which one better, more secure, and faster (performances)? Which one should I use?? EDIT: I am php user, thank...

Difference between getmypid() and posix_getpid()

What's the difference between the getmypid() and the posix_getpid() functions? I turned to getmypid() because my script has to run both on Windows and on Linux. ...

How to model a many to many relationship?

With only a bit of previous experience with databases and no formal education with them, I'm a bit stuck as to how to model this (and retrieve the data I require from it in PHP). This is what I'm trying to model: For each item on my site, it is allowed to have multiple tags such as file, upload, php, recursive etc. However the tags are ...

[Eclipse PHP IDE 3.5] "No completions available" on var_

hi all, i have againg a problem with completition. now i can't get any suggestion. Sure i can type var_dump, but it is more comfortable with autocompletion. I'm using Eclipse PHP Ide 3.5 with PDT 2.1. ...

PDO Insert Help

Hello all, I'm having a bit of trouble inserting into a sqlite3 database with pdo. You'll have to excuse my ignorance with PDO, it seems so foreign coming from Python's database interface. So here's my problem. I have a simple insert: $dbh = new PDO('sqlite:vets.db'); $count = $dbh->exec("INSERT INTO vets(name,email,clinic,streetna...

change default character set of PHP functions like "htmlspecialchars"

I am using PHP 5.2.6 and my app's character set is UTF-8. Now, how should I change PHP's default character set? NOT the one which specifies output's mime time and character set. But which will change for all the PHP function like htmlspecialchars, htmlentities, etc. I know, there is a parameter in those functions which takes the char...

Count line breaks in a field and order by

I have a field in a table recipes that has been inserted using mysql_real_escape_string, I want to count the number of line breaks in that field and order the records using this number. p.s. the field is called Ingredients. Thanks everyone ...

Open source file upload with no timeout on IIS6 with ASP, ASP.NET 2.0 or PHP5

I'm after a cross-platform cross-browser way of uploading files such that there is no timeout. Uploads aren't necessarily huge -- some just take a long time to upload because of the uploader's slow connection -- but the server times out anyway. I hear that there are methods to upload files in chunks so that somehow the server decides no...

Limit execution time of an function or command PHP

Hi is there a possibility to set time limit only to a command or only to a function eg: function doSomething() { //..code here.. function1(); //.. some code here.. } I want to set time limit only to function1. There exits set_time_limit but I think this sets the time limit to whole script. Anybody any Idea? ...

To select the encrypted password from mysql

I need to select only the password from the table with the specific username entered through the log in form. I store the password in the encrypted form in the mysql table. So I need to compare the given password and stored password and have to print "logged in successfully". else password is incorrect. this is my code.Now I am getting t...

Optimizing php command line scripts to process large flat files

I have a large flat file that I need to process in php. I convert the flat file into a normalized database in mysql. There are several million lines in the flat file. I originally tried to use an ORM system while importing the flat file. There was a massive php memory leak problem with that design even with careful freeing of objects. E...

Echo Warning or Confirmation on Condition [PHP]

What I expect on execution: The function Email() will be called each time the page loads. If $Valid exists Email() should return either true or false. If $Valid does not exist Email() checks the Postback() (example: has the page been submitted and we're seeing it for the second time?) and if true Validate()s the form fields and either s...

php crawler detection

Hiya, I'm trying to write a sitemap.php which acts differently depending on who is looking. I want to redirect crawlers to my sitemap.xml, as that will be the most updated page and will contain all the info they need, but I want my regular readers to be show a html sitemap on the php page. This will all be controlled from within the ph...

facebook quiz development

hi i want to make a quiz application on facebook using php ( the concept is after every question there is a next button by we reach to the next question ) how can i applied any transition effect (like in jquery) ...

PHP: How to remove all non printable characters in a string?

I imagine I need to remove chars 0-31 and 127, Is there a function or piece of code to do this efficiently. ...

hide javascript from showing up in browser

I have some javascripts that I am using in my files. But when we view the source code it shows our javascript as it is. Is there any way with which we can hide our javascript from showing up in the browser using php. ...

How should I start with OAuth server at PHP

Have found the following example of OAuth server http://oauth.googlecode.com/svn/code/php/OAuth_TestServer.php But it is unclear for me 1. How I should generate certificates How I should specify access token/access token secret/request token/request token secret, should they stored in database? Should it regenerated for each request...

Shell Script Segmentation Fault

Hi I have a shell script which should run based on the return of php code: x=1 while [[ "$x" != 5 ]] do echo "Welcome $x" php test.php x=$? done And the php code echo "Testdfdf test".PHP_EOL; exit(4); So I want whenever I get 5 from php to quit the loop. But I get sometimes: ./myshell: line 7: 20529 Segmentation fault ...