php

Proc_open() c++/python problem

Hey, everyone I'm trying to make a call for a c++ / python file with proc_open (bi-directional support needed). After doing some on-line research i found created this code:(I first tried it with c++, after failure i tried pyhton aswell) Php: <?php $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 =...

Is the following array well defined for binary search?

Hello, I have a file with consisted of int;int values in each line. Both columns are ascending, row by row. I plan to load that file into an array with following code: while( ! feof($f) ) { $line = fgets( $f, 32 ); $tmp = explode( ";", $line ); $elements[] = array( $tmp[0] => $tmp[1] ); } I intend to use this array to do ...

findBy relation field

class Profile { /** @OneToMany(targetEntity="Link", mappedBy="owner") */ private $links; } class Link { /** * @ManyToOne(targetEntity="Profile", inversedBy="links") * @JoinColumn(name="owner_id", referencedColumnName="id") */ public $owner; /** * @ManyToOne(targetEntity="Profile") * @JoinC...

how to separate data access layer in codeigniter

Hi, I used to write the data access functionalities in model itself. Now I want to separate data access from business logic. I am using codeigniter as framework. It seems that one way of doing it is use ORM, but it will have a performance penalty I guess. are there any general best practices? ...

Checking redirect in PHP before actioning.

Is there a way to check if the server responds with an error code before sending a user there? Currently, I am redirecting based on user editable input from the backend (client request, so they can print their own domain, but send people elsewhere), but I want to check if the URL will actually respond, and if not send them to our home p...

My classes and functions - is there a better way?

Just been looking at the way I am structuring my classes and wondering it there is a better way. I have forms which pass the information through to the process class. This class just forwards everything onto my main class which then does the work. When the work is done, it then passes the information through to the database class to car...

php - smtp server

Hi All, I am working on a project. For that i have downloaded smtp server on ubuntu. Could any one please tell me the command to check whether the smtp server install properly or not. because email is not getting generated. Below is the code for your reference <?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); inclu...

Variable I need to use in other classes

Hello all. The following code connects my database var $connection; function MySQLDB(){ $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $this->connection) or die(mysql_error()); etc etc This code is within a class called MySQLDB At the end $database = new MySQLDB;...

Problem Sending Mail through PHP

I have a contact form that is build in arabic language. When it is ever used, the received mail looks like this ... إسلام الإسم مهندس برمجيات المهنة 010 التليÙون email البريد الإلكترونى تجربة Ø§Ù„Ø¥Ø³ØªÙØ³Ø§Ø± I need to solve this issue as soon as possible as this page is a...

Does PHP have a visual Documentation just like Jquery?

For Starters, i would like to note, that this is my first post on Stackoverflow. However, during my web development career, i have used this site numerous times. And now i feel i need an assistance beyond just browsing though google. So my question is does PHP have visual Documentation just like http://visualjquery.com/? Because if no...

If user didn't come from HERE then do not process - How?

I tried to make use of $_SERVER, but it didn't work for me. What I need is: In order to access a page on my site, the user must come back from Paypal. If he isn't redirected from Paypal to my site, then don't execute the file but give the user an error instead. How can I do this? I tried the following: $url = 'paypal'; if(strstr($...

PHP disclaimer script

I was wondering: what is the PHP equivalent of this JavaScript code: window.onload = initAll; function initAll() { document.getElementById("redirect").onclick = clickHandler; } function clickHandler() { if(this.toString().indexOf("wapcreate") < 0){ window.location = "ex.html"; } return false; } I want to get all the ex...

printing to a dot matrix printer on a mac

So i am designing an art project that will print to a dot matrix printer the contents of my internet history. i have found info online to parse out a plist (what os x uses to store internet history) so im all set on that front but what i am looking to find out is how to send a request to the printer to print a new line, which would happe...

PHP MySQLi Stmt Prepare

How would I mysqli::stmt->bind_param something that's considered as NULL in mysql? I'm currently using $stmt->bind_param('s', 'NULL'); ...

PHP - Please help me to complete my project

How to link the code to smtp. And how to link smtp to my localhost. and how to substitute this with my ISP details and the email id to the email id which i use for sending. Below is the Code for your reference <?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); include('config.php'); // table name $tbl_name="temp_mem...

download limit of getting headers in php

Does php native function get_headers() downloads all the content, or stops downloading after getting header? ...

Looking for a free Comet (AJAX push) server

(OFFTOPIC: It seems, I got it wrong with my previous question about APE and chat. The problem is elsewhere) We are looking for a free Comet server which is also free for commercial use. The server must support the following: basic publish/subscribe functionality, no fancy features needed; supports publishing messages from any type of ...

eSELECTplus API integration issue

Hi, I am trying to integrate eSELECTplus (Moneris) with my application using PHP and I keep on running into weird error. Everything works fine as long as I am using the test api key and store id. When I switch to live API key and store id i start getting "SQL Problem" from the server.. that's the response that I get back from the serve...

My blog.php file in my admin section is not showing all of the posts in the database

I have a php file in the admin section of a website I built. The file pulls posts from a certain database and corresponding table spits them out onto the page with a Edit button link to edit that specific post. All of this is working properly. However at the moment the database says there are 15 entrys in the table, yet only 12 are viewa...

Connect to failover db in PHP.

In php is there a quick way to say if db1 is unavailable connect to db2 instead? Here is what I'm doing now: $username="XXXXXXXXX"; $password="XXXXXXXXX"; $database="XXXXXXXXX"; $hostname="XXXXXXXXX"; mysql_connect($hostname,$username,$password); @mysql_select_db($database) or die("unable to select database"); ...