php

How to make js code invisible?

I have a php page, where at the bottom of the page I have some javascript code. I use php inside the javascript code, like this: alert ("<?php echo $variable; ?>"); If I put this in a separate file, this wont work for some reason. Is there anyway to make it work from a separate file without too much difficulty? Or is there another w...

PHP Forums - how to cope with unread discussions / topics / posts

Hi, I know this question has been asked here a couple of times, but none of the answers had pleased me. This is because almost all of them involve a huge read / write process related with the database, which I'd like to avoid at all cost. About unread discussions / topics / posts, there's a lot to think of. Don't know how do forum sys...

facebook connect: thumbnail images broken up in FB.Connect.streamPublish pop-up prompt, and on wall for a few minutes

hi there! I'm using facebook connect so that users can publish comments they are leaving on my site on their facebook wall as well. It works as intended, except that in the confirmation pop up, the thumbnail image i provide is broken. Looking at the source, I can see that facebook prepended my image url like this: from: http://www.mys...

Are there any open source PHP classes to resize an image to a certain width and height?

I have one currently that simple does it by aspect ratio, however I need it to fill a 150 x 150 size, whereas mine would honour its ratio and do 150 x 120 for example. Ideally it would goto the centre of the image. Thanks ...

What is the difference between running a script from the command line and from exec() with PHP?

I'm trying to run a Python script using exec() from within PHP. My command works fine when I run it directly using a cmd window, but it produces an error when I run it from exec() in PHP. My Python script uses NTLK to find proper nouns. Example command: "C:\Python25\python.exe" "C:\wamp\projects\python\trunk\tests\find_proper_nouns.py"...

Sending (relatively) large volumes of html e-mail with php

What is the best way/class to send a lot of html e-mail? (Every mail needs to contain information (from a mysql database) that is linked to the address to which it's sent) ...

PHP - how can I show \n \0 \t \x0B \r

How can I show these characters on a webpage? ...

how can I tell if mysql_real_escape_string is working

Hi , As it says in the title , how can I tell if the mysql_real_escape_string is working how it should without waiting to be hacked ? ...

How to override default permissions for files stored by Apache/PHP in /tmp?

I am on Linux, obviously. PHP scripts seem to be running under 'www-data' user. I can also see that uploaded files end up in the default /tmp directory, each with a name prepended by "php". All standard, I guess. The permissions of all these files is -rw------- i.e. 600, user 'www-data', group 'www-data'. The problem is that I have a Pos...

Open new SQL Server connection in PHP

I have an open SQL Server connection and need to open and close another while maintaining the first connection. I CANNOT hold onto the resource ID for the original. Connection A (may or may not be open) Open connection B Perform a few queries using connection B Close connection B Continue working with connection A ...

Is this PHP code secure?

Just a quick question: is the following PHP code secure? Also is there anything you think I could or should add? $post = $_GET['post']; if(is_numeric($post)) { $post = mysql_real_escape_string($post); } else { die("NAUGHTY NAUGHTY"); } mysql_select_db("****", $*****); $content = mys...

Converting php array of arrays into single array

I have an array whose values are all arrays of a specific format that looks like this: Array ( [0] => Array ( [username] => John ) [1] => Array ( [username] => Joe ) [2] => Array ( [username] => Jake ) ) and I...

multiple wordpress installs, getting data from wp-2 while inside wp-1

I have a site with 4 wordpress installs, (no need for wp-MU) x4 databases, with each a unique username and pass... i will call these wp1=mainsite wp2=childsite wp3=childsite wp4=childsite In wp1, there is a page, with tabs, which should load recent posts from the wp2, wp3, wp4 installs, this page is using a custom template...

Dynamic array key in while loop

Hi I'm trying to get this working: I have an array that gets "deeper" every loop. I need to add a new array to the deepest "children" key there is. while($row = mysql_fetch_assoc($res)) { array_push($json["children"], array( "id" => "$x", "name" => "S...

Obtaining POST variables in a template of eZ Publish

Hi, I have a form in a template (not a eZ generated form) which posts to another eZ page. How do I get the POST variables within the template? Thanks. ...

Alter MySQL column with values to auto increment

Hi all, I had a hard time with the title, so let me explain. What I'm doing is using the jQuery UI to create sortable list elements on a page. Once the order is submitted, php assigns an incrementing value to the list elements based on their order, drops the existing id column, creates a new id column and inserts each list elements valu...

Is there a benefit to using Julian Dates in code?

I maintain a PHP/Flash app that uses Julian dates within the code and only converts to Gregorian for display. Before I replace the integer Julian dates with a Date data-type I was wondering if there was a benefit to using the Julian? Should this even be changed? One of the problems is being able to quickly look at dates in the database....

How can I digitally sign PDFs created dynamically in PHP?

I need to take a PDF, add some dynamically generated license text to it, and digitally sign the document before emailing it to the intended recipient. What's the best way to do this in PHP? My understanding of digital signage is that the content of the PDF is converted into a hash, and some property of the document is set to this value...

Google Chrome Cookies - HTTP & HTTPS

I have a site that uses www.example.com for standard pages and secure.example.com for HTTPS. I am trying to set a cookie when user logs in that will be valid on both the HTTP & HTTPS versions of the site. I am doing this by setting path to "/" and domain to ".example.com". This works fine in Firefox and Internet Explorer, but in Chrome ...

Drupal search module has suddenly stopped working, how do I fix this problem?

Drupal 6.15 search has stopped working. how can I fix it? I've run the cron and re-indexed, but it still does nothing when searching. Any ideas? I can see the tables that the items have been indexed, but search results show a blank white page. ...