php

Drupal menu_primary_links() not returning primary links menu on some pages

Hi, I am using Drupal 6.8 and I noticed on some pages menu_primary_links() is returning a empty array on some pages. Is there a setting I have overlooked? Thanks. ...

imagecreatetruecolor fails with 1536X1962 but not smaller diminsions

I have narrowed down my problem to show the size of the file matters. I don't know when the file is to big however. How can I catch the error. A 1.1mg file causes imagecreatetruecolor to bail but it chuggs along just fine when processing a 688k file. Thanks ...

How do I get these two functions to work with Ajax, and how to I rewrite it in Jquery?

Hey everyone, function ajaxFunction(phpFunction){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); ...

Convert String To date in PHP

How can I convert this string 05/Feb/2010:14:00:01 to unixtime ? ...

PHP Multiple Dropdown Box Form Submit To MySQL (Part 2)

This is a continuation of the discussion at http://stackoverflow.com/questions/944158/php-multiple-dropdown-box-form-submit-to-mysql which ended with the words: "Once you have the variables, it is trivial to create new rows." No doubt that's generally true, but apparently not for this learner... :-D Given the following form: <f...

How to get rid of string elements in php ?

Customer id literal has customer_id+Domain_details, eg.: 998787+nl and now I just want to have 998787 and not +nl, how can this be acheived this in php Question: I have number like 9843324+nl and now I want to get rid of all elements including + and afterwards at the end and only have 9843324 and so how should I do this in php ? Right...

saving hebrew utf8 to database with php

when saving hebrew to a mysql database (utf-8) i am getting it converted to something like this: &times;&uml;&times; editing content directly in the database works and it outputs on the page fine too. sorry forgot to ask a question... what am i doing wrong!? ...

Idiot-proof, cross-browser force download in PHP

Hello, I'm using forced download to download mostly zips and mp3s on site i did (http://pr1pad.kissyour.net) - to track downloads in google analytics, in database and to hide real download path: It's this: extending CI model ... - bunch of code function _fullread ($sd, $len) { $ret = ''; $read = 0; while ($read < $len && ($buf = ...

Checking MySQL Logs for Possibility of Performance Issues/DOS attack

Hello, We write a most of our websites in PHP and use MySQL database connections routinely. We are currently encountering a major performance issue on our dedicated server. When accessing our server it loads webpages very slowly and SSH'ing into the machine takes forever. We have restarted it a few times and after a few minutes that pro...

How do I send automated emails in php?

Hey all, I have a form that I type a message in, then I click submit and it sends to all the users that are signed up for a messaging service. What I am trying to do is make it so that every day this form submits on its own without me having to press a button. I have been told that in linux you can create a script in cron, but my server...

Crop image into circle and add border

I'm trying to crop a circle image and adding a border around it. Below is my code to crop a circle image. <?php $img1 = imagecreateFromjpeg("./a.jpg"); $x=imagesx($img1)-$width ; $y=imagesy($img1)-$height; $img2 = imagecreatetruecolor($x, $y); $bg = imagecolorallocate($img2, 255, 255, 255); imagefill($img2, 0, 0, $bg); $e = imagecol...

Paypal + PHP: how to receive a value on success sale

I have a paypal button on my site in a form. The form has an additional input called ID, where the user must enter a specific value. After the sale is complete, Paypal returns the user to domain.com/credits?done How can i receive the original ID value entered by the user in /credits?done ? need it to modify his database record automati...

PHP Grab HTML Tag Rows/Heirarchy

So I wanted to know if there was a way to grab a specific HTML tag's information using PHP. Let's say we had this code: <ul> <li>First List</li> <li>Second List</li> <li>Third List</li> </ul> How could I search the HTML and pull the third list item's value into a variable? Or is there a way you could pull the entire unordered list in...

Find last element of an array with a certain property in smarty

I am looping through a nested array in smarty, and each element has a status of 'active' or 'inactive'. How can I detect the last element in the array that is set to active? example code: {foreach from=$steps item=step name=step} {if $step.status == 'active' && ????? } {/if} {/foreach} ...

store mutiple values in php session

I am writing a script in php, which is quite similar to a shopping cart. what i want to do is when a users adds a certain product i need to add the productid to a session variable,without storing in a database. so each time the user adds a product the productid needs to be stored in a session variable. and when the user checkouts i need...

What is a platform independent way to access SBO?

So, is there any direct way to do that (without using a proxy)? ...

regular expressions with php

I am trying to write a regular expression to capture this string: <td style="white-space:nowrap;">###.##</td> I can't even match it if include the string as it is in the regex pattern! I am using preg_match_all(), however, I am not finding the correct pattern. I am thinking that "white-space:nowrap;" is throwing off the matching in so...

Magento: Loading attributes per store

I have a custom module that exports data to our fulfillment system when the user checks out. Before export I need to run the address through a verification service. Since we are charged for this service, I need to configure the user name and password for the service per store. I have added the attributes I need, however I cannot figur...

Facebook; posting a link to a fanpage

Hello, I have a web application that allows a user to publish a small blurb when one of their articles goes live on their site. Right now I am able to post to the user's wall using a session_key I saved in a table but I can't publish the same link on a fan page (I have the rights and IDs of the pages I need). Essentially I want the fun...

Web-dev/design template implementation and creation?

I've been trying out loads of different way to make the most effecient "template" for a site. The site consists of 'Sections', 'Menus' and 'SubMenus'. So to the question; what would be the most efficient and "slick" way of making a "template" for it? I've tried including headers and footers (Making all "head" items in the "header.php" an...