php

Can i write prepared statements in procedural php?

The example from the PHP manual is using OOP. Is there a way to do it procedurally? ...

PHP detect if page is reloaded with PHP_SELF

I have a form that reloads the page with the updated data: <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> ... <input type="submit" name="Submit" value="Update data"> </form> When the page is updated I want to display a message "Data updated". There was something like this with Referer I beleve, b...

How do I use inverted commas in the echo function in PHP?

How do I use inverted commas in the echo function in PHP? echo "<script type="text/javascript">"; doesnt work well. Thank you! ...

Regex for url formatting (www.domain.tld to anchors)

Hi. I'm currently developing a little browser-based Twitter widget. Currently, I'm stuck with getting the URLs to work. I'm kinda newbie, when it comes to regex (I know, how to get parts of a string, but this one – tough one). So, I need a regex that would search/replace www.domain.tld -> <a href="http://www.domain.tld"&gt;http://www....

Regex to replace relative link with root relative link

I have a string of text that contains html with all different types of links (relative, absolute, root-relative). I need a regex that can be executed by PHP's preg_replace to replace all relative links with root-relative links, without touching any of the other links. I have the root path already. Replaced links: <tag ... href="path/to...

Connect PHP to SAP R/3 using SAPRFC - Unable to initialize module

Goal: use PHP 5.3 to connect to SAP ECC 6 Config: Windows XP desktop. Using SAPRFC PHP open source extension. Added php_saprfc_530.dll to the php ext directory and added extension to php.ini On restart of Apache, application event reported this error: PHP Startup: saprfc: Unable to initialize module Module compiled with build ID=API200...

Uploading multiple images through Tumblr API

I have about 300 images I want to upload to my new Tumblr account, becuase my old wordpress site got hacked and I no longer wish to use wordpress. I uploaded one image a day for 300 days, and I'd like to be able to take these images and upload them to my tumblr site using the api. The images are currently local, stored in /images/. T...

Problem with php GD image not creating

With the following code, my browser is returning 'image not created or saved'. I assure you the location of the image exists. So the line within the if statement is returning false for some reason, and yes GD is installed. Any ideas? if ($img = @imagecreatefromjpeg("/var/www/images/upload/1/1.jpg")) { die("image was creat...

Block specific IP block from my website in PHP

I'd like, for example, block every IP from base 89.95 (89.95..). I don't have .htaccess files on my server, so I'll have to do it with PHP. if ($_SERVER['REMOTE_ADDR'] == "89.95.25.37") die(); Would block specific IP. How can I block entire IP blocks? Thank you very much. ...

Load function in jquery

Hi, I am relatively new to jquery and would like to know why the below code wouldn't work. I am trying to access the content from a file residing on my site and not outside. Is it because I have the jquery lib loading from google and not my site? The error message that I get in IE browser is "Access Denied". I am confused why the access...

php help hiding navigation with cookie

I have these tabs on my navigation: <li<?php if ($thisPage=="Customers") echo " class=\"current\""; ?>><a href="/customers/">Customers</a></li> <li<?php if ($thisPage=="Trunks") echo " class=\"current\""; ?>><a href="/trunks/">Trunks</a></li> <li<?php if ($thisPage=="Settings") echo " class=\"current\""; ?>><a href="/settings/">Setti...

replacing variables in output in php

Right now I have this code. <?php error_reporting(E_ALL); require_once('content_config.php'); function callback($buffer) { // replace all the apples with oranges foreach ($config as $key => $value) { $buffer = str_replace($key, $value, $buffer); } return $buffer; ...

Open payment gateway libraries for Java, Python, Ruby, and PHP

I'm looking for generic and open source payment libraries that support many different payment processor APIs. In other words, I'd like to develop an application using a single payment processing API, but be able to easily switch between payment gateways, such as Authorize.Net, Payflow Pro, Braintree, PayPal, Google, Amazon, etc. This qu...

What is the best way to deal with address inputs that can be from multiple countries?

Most of my websites in the past have been rather limited to the United States when it came to displaying addresses. On a project I'm working on right now, however, users can add events from all over the world. My problem is how to go about dealing with the different way in which addresses are displayed across the world. For example, City...

increment date by one month

hi let i have a date like it: 2010-12-11(year-mon-day) Now in php i want to increment it by one month. but when the month will be incremented, it will be automatically adjust years if needed. pls help. regards ...

Jquery background overlay/alert without .onclick event - php responder?

Hi guys, I have no experience with jquery or javascript for that matter. I am trying to implement this technique to respond to users for errors or messages in general. lights-out-dimmingcovering-background-content-with-jquery This method uses the onclick event and that's not what im after, I have tried to replace .onclick with .load b...

Imagick: gifs, and background color

Hi, I have 2 questions about using the php imagick class that I can't get working properly... 1.) I tried resizing / cropping a gif, and treated it as a normal image. It seemed to work, except that a few frames in the middle of the animation contained a small patch of artifacts. Is there a setting that should be used when working with m...

Including a local file but not making it run with the main script?

I have one script that loads very quickly, but I have another script that I want to run with that script, but that scripts processes a LOT slower. The second script doesn't need to output anything to the user, it only needs to run. Is there a way I can include it locally, without making the user have to wait for it to load? EDIT: I'd re...

php - ftp all files in a directory?

Trying to use php to get all files in a directory and save them locally... It seems like I constantly need to specify a name? Is that right? function grabFiles() { $conn = ftp_connect(REMOTE); @ftp_login($conn, REMOTEUSER, REMOTEPASS); ftp_get($conn, '*', FTP_BINARY); } ...

PHP convert external relative path to absolute path

Hello, I am trying to figure out how to convert an "external relative path" to an absolute one: I'd really like a function that will do the following: $path = "/search?q=query"; $host = "http://google.com"; $abspath = reltoabs($host, $path); And have $abspath equal to "http://google.com/search?q=query" Another example: $path = "top.h...