php

PHP: Its 20 minutes past midnight and somehow on refresh the php date doesnt change. Why is the php god angry on me?

As i said before, its 20 min past midnight, and when i do check the date using php as date("Y-m-d"); and date("Y-m-d",strtotime("now")); i still get the previous days' date. I expected a lot of things to go wrong while coding but definitely not this. I wouldnt even have it in the list of potential-things-that-could-go-wrong. I have ref...

How to return a value into webpage

Hello: I have a simple webpage that displays the credit balance for calling cards. So far without any problems, with HTML, PHP and mysql, I was able to retrieve the balance from a data base. But I have to display the result in ANOTHER PAGE, wich looks akward because the page must reload. Can I just load this value into a pre-drawed...

Why does this simple email address validation not work for me?

Here is my code; I got the reg ex from a PHP book. function is_email($email) { // Checks for proper email format if (! preg_match( '/^[A-Za-z0-9!#$%&\'*+-/=?^_`{|}~]+@[A-Za-z0-9-]+(\.[AZa-z0-9-]+)+[A-Za-z]$/', $email)) { return false; } else { return true; } } Now to test to see if the email is valid I am using: if (is_email(...

Experience with protecting PHP code

Hello, I am aware of that there are a number of code obfuscators/licensing programs for PHP. I wanted to know if anyone has actually used these and what their experience has been. Please note I do not want to know the solutions available. I want to know your experience using one of these solutions. Is it worth investing say 200$ purcha...

PHP - Is it dumb to load <head></head> data as an include

This might be a really dumb question, but is it dumb to load the data that is in between the tags in a file and load it via PHP include()? That way it would allow for easier editing. Thanks. ...

Dreamweaver Recordset Default Value (PHP) - How to Return All Records?

Greetings! Although I am working in Dreamweaver, this question may be general enough for PHP/MySQL experts to comment on. $colname_get_voice_search_men = "-1"; if (isset($_POST['search_type'])) { $colname_get_voice_search_men = $_POST['search_type']; } mysql_select_db($database_conn_talent, $conn_talent); $query_get_voice_search_men ...

Using an ajax reload with a Wordpress plugin

I am making a Wordpress plugin that provides updates in the widget section of the page - everything works fine. The one thing that doesn't is the ajax callback (using load with jquery). It appears that Wordpress is blocking direct access to the php file that I am trying to load (it is in /wp-content/plugins/myplugin). How should I be ...

Any existing php code out there for condorcet comparing?

I beleive the website 'whatsbetter.com' (defunct) used a Condorcet method for comparing two images such that they could join a list of ranked images, and also have data stored about their performance against each other over time. I would like to implement something like this myself. I don't want to over complicate it. My brain isn't g...

How Does Twitter's OAuth System Work?

I have got a demo script that lets me authorize with my app and sends back my token. But all this crap is confusing as hell. I have always used username and password in my CURL or simpleXML functions to authorize the API call. What the hell is going on with this oauth thing by comparison? I get that i will store the token, but what do ...

MySQL resultset display by group

I have a table that looks like: Client_ID | Order_ID | 10 | 1 | 10 | 2 | 10 | 3 | 14 | 6 | 14 | 7 | 14 | 9 | Is there an elegant way in PHP of printing out this result set putting in evidence the client_id groups instead of making a loop that remembe...

How to install mimetex on PHP/apache?

So I'm trying to use the LaTeX on my server but I need mimetex. I have no idea how to do this nor have I been able to find any tutorials. Basically all I know about servers is how to ssh into my server... and thats about it. I was hoping it would be as easy as doing something like apt-get {blah}... but I have no idea. Can anyone provide ...

PHP json_encode encoding numbers as strings

I am having one problem with the PHP json_encode function. It encodes numbers as strings (e.g. array('id' => 3 becomes "{ ["id": "3", ...) When js encounters these values, it interprets them as strings and numeric operations fail on them. Does anyone know some way to prevent json_encode from encoding numbers as strings? Thank you! ...

Rabin-Karp Algorithm in PHP

Hey people! I was wondering if anyone can share a source for Rabin-Karp algorithm? Thanks ...

Two-way encryption in PHP

My application (obviously) uses a unique ID to distinguish records. This UID is passed in URLs (e.g. ./examplepage.php?UID=$example_int), among other things. While I obviously have server-side validation in place to make sure clients don't access other clients' data, is there a two-way encryption method I can use in PHP to only pass en...

PHP: Is it possible to use for loop inside a switch?

I'm attempting something like the following: switch ($p) { foreach ($modules as $m) { case '"'.$mod.'"': include 'modules/'.$m.'/cases.php'; break; } } but can't get it to work. Is it possible to use a for loop in this manner, inside a switch? ...

$_SESSION variables being controlled by PHP configuration?

I commonly see people setting $_SESSION variables as $_SESSION['example']=$_REQUEST['something']; $example=$_SESSION['example']; is this redundant? I am currently working on a new server and $_SESSION['example']=$_REQUEST['something']; gives me access to $example without any extra code is this normal or a php configuration makin...

Getting Post Information Outside the Wordpress Loop

Hello, I know there are functions to like is_single() that will return data about the page, but I'm looking for a way to get the following information outside of the loop: The category of the single post. AND The title of the single post. All I would really need is the post ID in question and I could get all the other information. I...

dynamic stylesheet

Iam trying to retrieve data from mysql database into stylesheet.php but it is not working. main page: <link rel="stylesheet" href="includes/dynamicstyle.php" media="screen"> stylesheet.php <?php header("Content-type: text/css;"); ?> <?php require 'connect.php'; $userid = $_SESSION['uid']; $select_query = "SELECT * FROM theme where...

One cookie with many values or many cookies with one value?

I guess the title says it all. If I have many settings that I want to store in a cookie, should I create multiple cookies with one option each, or one big cookie with multiple options in a serialized array or something? Are there any pros/cons for either approach? What do most people do? ...

Unexpected behavior when calling a Ruby script via PHP's shell_exec()

I have a Ruby script that's being used to do some API calls/screen scraping, but our main app is in PHP. Our PHP app is using shell_exec() to call the Ruby script. The ruby script works great when called from the command line–but it will randomly exits early when called via PHP's shell exec. Here's an example of the Ruby script: #!/...