php

include/echo output of PHP

I got two projects running, both written in PHP. Now I want to merge these two projects. The first project is a CMS and on a specific page i will display the contents of the other project / application. I don't want the first project to know about, or get access to, the variables and functions in the other and vice versa. So i just want ...

Add products to UberCart Cart with Javascript

Drupal's UberCart is a solution, where you select some product manually and then click "Add to Cart" button. But here goal is a bit different, I may have a custom javascript where user plays with catalog and attributes and selects product with properties in this window. What would be the technological path to return selected products wi...

php / ajax REMOTE_ADDR set to IP of bogus network adapter

Hi %, today I came a across a pretty strange behaviour of an php based application of mine. In a certain part of the system there's an UI making use of AJAX-calls to fill list boxes with content from the backend. Now, the AJAX listener performs a security check on all incoming requests, making sure that only valid client IPs get respon...

code for take the link contained in the email

I wrote a code for fetching mail from the inbox in php. It is working well . But actually i need to take the link contained in the message.. I want to take the link address which are came in the message part. Can you help me for doing this.. ...

Help with XML, PHP and CDATA

Hi, I have the following contents in my XML file: <items> <item id="1"><content><![CDATA[<p>string</p>]]></content></item> </items> I have HTML inside the content, so, I used CDATA. However, when I'm trying to display the content as HTML on the web page: $item_content = $xpath2->query("/bulletin/item[@id='$item_id']/content"); forea...

Passing additional parameters to the Zend partialLoop View Helper

In a Zend view I can apply a partial template to an iterable element as follows: $this->partialLoop('template.phtml', $iterable); However inside the template, only the elements of the $iterable are available, is there another way of passing extra data to the partial? ...

Image size reduction in PHP

In cases such as this error: Fatal error: Out of memory (allocated 31981568) (tried to allocate 3264 bytes) Can I use the GD lib to reduce its file size first before getting to this stage? ...

how to stop further php parsing, but continue page load

I have an image upload page (single page). When submitted it check filesize and type, exiting on each if they violate the rules. Problem is the entire page stops. How can i stop the remainder of the php (or break out of current <? ?>) from being processed and just load the rest of the page? ...

[PHP]: Why "\" gives error while storing it in string?

My string looks like: $fullPath = $dirName . "/" . $file; If I replace / with \, it gives error: "Expecting identifier or variable". I want to store in the latter way itself. How to override anything coming in between? ...

Sending variables to php from Cocoa Touch on iPhone sdk

Hi am trying to pass variables to php from inside an app. <?php // get email address $email = $_GET['email']; // get character name $character = $_GET['character']; // get password $charname = $_GET['charname']; // set up variables $id = 0; $idtest="no"; // set up database connection $link = mysql_connect("localhost", "xxx username xx",...

Sort array by value alphabetically php.

As the title suggests i want to sort an array by value alphabetically in php. $arr = array( 'k' => 'pig', 'e' => 'dog' ) would become $arr = array( 'e' => 'dog', 'k' => 'pig' ) Any ideas? EDIT: Here's the actual array i want to sort. Array ( [0] => Newtown [1] => Montgomery [2] => Welshpool [6] => Llanfyllin [7] =...

PHP File Upload

Hi , If I want to change my filename before it goes to the Server for its permanent location not its temporary Location how could I do this. The code is as fellowed: <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <inp...

Break - wrong place?

Hello all, I have just come across this code: function test(){ //... if ( $profilerule == "profile" and $operator != "=" ) { verbatimlogit('false'); break; } //... } Is it just me or will that break not work there?! There isn't even a loop. A continue work either, right? I just want a confirmation here as I am pret...

PHP referring to object data with numerical key

I have converted an array to object data like this: <?php $myobject->data = (object)Array('zero','one','two); print_r($myobject); ?> And the output is: stdClass Object ( [data] => stdClass Object ( [0] => zero [1] => one [2] => two ) ) So far so good. But if I try to refer to the numerical keys... <?php $myobject->data = (o...

disabling javascript codes using php?

is there a way to disable javascript codes in a particular page using certain php codes? I need to ensure that all the javascripts used in a page should not give any result (even errors) when run. ...

variable from javascript to php

here is the code : $('#sousmenu a').click (function (){ startSlideshow(<?php echo json_encode(glob("photos-" .$_GET["folder"]. "/*.jpg"));?>); return false; }); The question is i like the HREF to change and get cautch by php, now it dont do nothing, but writing the ?folder=portraits work here is the page ** simpl...

search string with preg_replace

$html = file_get_contents("1.html"); eval("print \"" . addcslashes(preg_replace("/(---(.+?)---)/", "\\2", $html), '"') . "\";"); This searches an string and replaces ---$variable--- with $variable. How can I rewrite the script so that it searches for ---$_SESSION['variable']--- and replaces with $_SESSION['variable']? ...

[PHP/JavaScript]: Call PHP file through JavaScript code with argument.

I want to call a PHP file but want to pass an argument to the PHP file. Not getting the correct approach, I am attempting to write a cookie and read that cookie when the PHP file loads. But this is also not working. I am using following code to write and read cookie. I just want to test the read cookie function of JavaScript here. I know...

php and webservices

I am new to php so please bare with me. I have a wsdl file and i am trying to call it from a php class. I am using the following code: <?php include ("dbconn.php"); class dataclass { function getCountries() { $connection = new dbconn(); $sql = "SELECT * FROM tblcountries"; $dataset = $connection -> connectSql($sql); retu...

Simple PHP echo help

Hi , How could I add an echo in here move_uploaded_file($_FILES["torrent"]["tmp_name"], "uploads/ (HERE) .torrent"); I have tried a few things with no luck. ...