php

Passing a url as a variable into thumbalizr php

I am using the Thumbalizr API for capturing website screenshots. I am trying to pass a url from a variable into the script below where it currently says "www.google.com". When I try and do $url = "www.google.com"; and pass that to $image->request($url); it seems to fail and retrieves a screenshot but one that suggests the url was unrea...

It wont set the session?

Hi SO. I have this php login system, I had it working great on localhost, I bought a webhotel and now it doesn't work no longer, and i can't find where it goes wrong. I get no errors. The login page is in index.php, and when you sign in, and if everythings ok (no errors/wrong pw etc.) then you will be redirected to home.php. This is ...

Allow anonymous users to edit their content? Drupal module, ideas

I have a custom content type in drupal that I'm allowing even anonymous users to create. I would like to also give them the ability to come back and edit their creations after they've first published it, but that's the challenge. Since they are "anonymous", I would guess there's no way for the drupal permissions system to tie the conten...

PHP with SQL Server: strtotime() with SQL Server DATETIME column

So I have SQL Server datetime field, and in PHP I want to use this as a UNIX TIMESTAMP, because I want to use it with strtotime, in order to add 14 days into it. Eg. If it is stored in the SQL Server database as: 2010-07-27 13:12:22.040 I want to add 14 days into it to become 2010-08-10 13:12:22.040 How would I do that using PHP wi...

Twitter disabling basic authentication - what does this mean?

According to apiwiki.twitter.com: "Basic authentication removal is going to occur on August 16, 2010" and their OAuth API will be the new method of authentication. I'm new to the Twitter API and I'm very unclear as to what this applies to. I'm trying to create a simple app to post to Twitter via a HTML form - do I have to use the OAuth ...

MySQL connection limit and PHP MySQL connections

Hi Everyone, I am having a frustrating issue. My web service has an email to php module. Briefly, once my user sends an email to his dedicated email address, my mail server captures the email, pipes it to a PHP script running on my server. This PHP script opens a MySQL connection and saves the email content to the database. So far so g...

Why are warning messages generated about duplicate IDs when there are none?

Hi, all! The following is an unexpected warning message the server is giving me: Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: ID page3 already defined in Entity, line: 25 in C:\Program Files\Zend\Apache2\htdocs\joom\templates\valueTemplate\updateRecord.php on line 74 . . The above warning message is generated upon executi...

has anyone comes with new solution for codeigniter and uploadify session problem

Hello i know that this is a famous question and have been asked many times. but i want to ask if there is any new solution for uplodify and codeigniter problem when we use codeigniter session library. i know that flash doesn't forward browser cookies with its request. and i saw many solutions to send the session data as a parameter wit...

sorting array of names in php

I have an array of people's names: Array ( [1] => A. Aitken [2] => A. C. Skinner [3] => A. Chen [4] => R. Baxter ) What's the quickest way to sort the array in (alphabetical) order of the surname in php? i.e. to give Array ( [1] => A. Aitken [4] => R. Baxter [3] => A. Chen [2] => A. C. Skinner ) ...

Web directory structure problem

This is my directory structure: -st.ambulance ---public_html ---resources My document root is public_html. I have a script in resources that I need to execute securely (meaning: normal users shouldn't be able to execute it). How would I do this? ...

stuck in a rut, need help breaking through to the next level

I'm working on a humble website with my mediocre, self-taught PHP skills, and the current interface structure is like this: <?php if (A) { $output = someFunc(A); } else if (B) { $output = anotherFunc(B); } else if (C) { $output = yetAnotherFunc(C); } else { $output = 'default stuff'; } ?> <html template top hal...

PayPal IPN returning a shopping cart or order ID for post-processing

I have successfully posted my custom shopping cart to PayPal -- it processes the order just beautifully, and when the payment is received, it posts data back to the URL I specified in the config. The code is based on the library found here: http://www.phpfour.com/blog/2009/02/php-payment-gateway-library-for-paypal-authorizenet-and-2chec...

General utility to remove/strip all comments from source code in various languages?

I am looking for a command-line tool that removes all comments from an input file and returns the stripped output. It'd be nice it supports popular programming languages like c, c++, python, php, javascript, html, css, etc. It has to be syntax-aware as opposed to regexp-based, since the latter will catch the pattern in source code strin...

Script to download and extract zip files returns errors

Hey everyone, I have written a script that downloads a zip file from a remote source, and then is supposed to extract the zip file to a directory. Below is the script: <?php $url = "http://example.com/some_file.zip"; download($url,'file.zip'); function download($url,$file_name = NULL){ if($file_nam...

Save OAuth WRAP access tokens directly on client machine in a cookie?

Hi, I'm planning to setup a website that would access an oauth wrap framework. I was thinking of storing the access token on the client machine as it is. I do NOT want to maintain a database of temporary tokens, etc on the server. Should I be doing do? Or should I encrypt it? ...

php replacement for safe_mode

i am new to learning PHP and so I've installed the latest version (5.3.3) and am writing some code. i have run across this error: PHP Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in C:\Rush\dev\personal\Numina.Framework\Development\PHP L...

Tools/Techniques for Debugging Memory Leaks/Usage Bugs in PHP

I've got a command line script that is running an array() of files through a loop, and using the file name as an argument to call a method on a helper object. Each run through the script, PHP's memory_get_usage reports a larger and larger number 53294264 57019624 61374624 65699176 70230600 75157152 79900392 84630472 89359264 94300016 1...

Using a smarty foreach variable within php tags

Hi, I have the following smarty code: {foreach from=$additional_fields item=v} {if $v.fieldid eq 5} {php} // several pounds of php code here $myfieldid = {$v.fieldid}; // this is wrong {/php} {/if} {/foreach} I'm trying to grab the current field id with my custom php code, in other words {$v...

C#-like extension methods in PHP?

I like the way in C# where you can write an extension method, and then do things like this: string ourString = "hello"; ourString.MyExtension("another"); or even "hello".MyExtention("another"); Is there a way to have similar behavior in PHP? ...

Python - PHP Shared MySQL server connection info?

I have some MySQL database server information that needs to be shared between a Python backend and a PHP frontend. What is the best way to go about storing the information in a manner wherein it can be read easily by Python and PHP? I can always brute force it with a bunch of str.replace() calls in Python and hope it works if nobody ha...