php

In PHP :how can I use include() Function which parameter is variable ?

Hi.. I need to use include Function with variable. but,when I try to do it I faced some errors . Code : $year=$_POST['year']; $month=$_POST['month']; $day=$_POST['day']; include "Event.php?year=".$year."&month=".$month."&day=".$day; so,can U help me ? : ) ...

Download prompt for ftp_get

Hi, I am currently implementing a system for users to download files from the ftp without the actual need of a ftp client. I have already developed a login system and have successfully managed to list out the files from the folder. However, I intend to make the download process using ftp_get with a "save as" prompt. I have referred to h...

SQL return error within PHP

I use GET to get the id of a result. $id = $_GET['id']; I then use the following code: <? $q = $database->friendlyDetails($id); while( $row=mysql_fetch_assoc($q) ) { $hu = $row['home_user']; $ht = $row['home_team']; $hs = $row['home_score']; $au = $row['away_user']; $at = $r...

Array in element of object

Why in example 'mytest' isn't an array? class myclass { public $mytest = array(); } $insert = new myclass; $insert -> mytest = Array (15, 50); ...

Is is possible to parse a web page from the client side for a large number of words and if so, how?

I have a list of keywords, about 25,000 of them. I would like people who add a certain < script> tag on their web page to have these keywords transformed into links. What would be the best way to go and achieve this? I have tried the simple javascript approach (an array with lots of elements and regexping/replacing each) and it obviousl...

How to combine two arrays of same length to one array with two fields (not append/merge)

Say, I have an array with months $months = array('Jan', 'Feb', 'Mar'...'Dec'); And another, with days (say, for year 2010) $mdays = array(31, 28, 31...31); I want to merge/combine these two arrays, into an array like this: $monthdetails[0] = ('month' => 'Jan', 'days' => 31) $monthdetails[1] = ('month' => 'Feb', 'days' => 28) ......

MySQLi String comparisons using keys

I have a table with lets say 2 columns. id number, and value. Value is a string (var char). Lets say i have a number x, and a list of numbers a1, a2, a3, a4, a5..... where x is not in the list. All of these numbers correspond to a unique row in the table. I want to know if the string value for x in the table is contained in one of the s...

How to build array of 'bad' values

I am processing a form and in turn, receiving a response code based on the information submitted. I have a list of approximately 40 response codes (and their meaning) in my hands and am trying to build an 'if' statement that checks against a predefined array and returns a specific value. Just not sure how to do this First pass conceptu...

Check if string is serialized in PHP

Hi everyone, I am in the middle of building a cache layer for the Redis DB to my application and I have come to the point where's it's about to take care of arrays. I wonder if there's any good (high performance!) way of controlling an string to be serialized or not with PHP? Thanks a lot! ...

Creating non-framework classes in CakePHP

I'm making a tournament manager in CakePHP 1.3 and I have a tournament controller which is fine but I want to implement a interface that can be used to define how a tournament runs. the controller needs to load a concrete class that implements the TournamentStyle interface that defines how the tournament works. At the end of a round the...

mysql: select ... where id = any value. is it possible?

look at this table please table |id| |name| |order| i must get the rows, where name = something and order = somevalue so i write select `id` from `table` where `name` = 'something' and `order` = 'somevalue' but depend on php logic, sometimes i need to get all rows, where name = somethimg, independently of order value. i don't w...

PHP and Apache block while i'm sending a email using smtp

Hi. i'm using php 5.3 apache 2.2 and phpmailer library to send mails using smtp and the process is ok. the problem is that send a email using smtp require some time to occurs and while this happen, the apache doesn't process any other request. how can i fix it? ...

Generate UUID for transactions - keeps giving wrong input

I am creating an online enrollment form. When a user advances to page 2, I generate a 'unique' ID for that user with the following PHP command: $_SESSION['ConfirmationNo'] = rand(100000000, 999999999); however, later in the process, when a user can actually view their confirm number, they can simply 'refresh' the page once and a new c...

Why do I get "Access denied for user 'root'@'myhostname" when connecting to my database in PHP?

I have set up an Apache server on mandriva linux 2010.1. But the problem is whenever I'm trying to connect with the database, it's giving me the following error: Error:Database error: SQLSTATE[28000] [1045] Access denied for user 'root'@'myhostname' (using password: YES) Can anyone help in this regard please? Thanks. ...

purpose of 3rd party mvc ?

ive seen many third party mvcs or frameworks such as codeignitor , cakephp, and so on. what i want to know is what are their purposes? ive created my own framework call it an mvc or framework (in my opinion their all the same). in my framework i have all the classes in one folder called classes and all functions in another. its all organ...

Optimizing near-duplicate value search

I'm trying to find near duplicate values in a set of fields in order to allow an administrator to clean them up. There are two criteria that I am matching on One string is wholly contained within the other, and is at least 1/4 of its length The strings have an edit distance less than 5% of the total length of the two strings The Pse...

wordpress adnimistration page

anyone know of a site that explains how wordpress created its appearances in wordpress (on the backend) i like how the navigation was created and i am trying to drill down to see what makes it tick but its a heck of a mess of code. has anyone launched anything online that you know of explaining how these peices were made? maybe something...

php mail send form question?

Wondering if anyone know how to automatically send the user an email after he/she fills out a form. I have the form emailed to me after it gets submitted, but I can't figure out how to capture the user's email from the form field and have it send it to them automatically??? Here is some code that I use to send the mail: //mail the me...

PHP/GnuPG Decryption -- Syntax error?

I'm using php to invoke gpg, but I'm getting a pipe error. I thought that if I read in the password from a file, I could then pipe it to the command itself? But, I keep getting: Syntax error: "|" unexpected Here's the code: (Note: The files are being iterated over in a foreach loop...) foreach($files as $k => $v) { $encrypted = ...

Switching languages on a website with PHP

Hello everybody, I'm just looking for some advice. I'm creating a website that offers (at least) 2 languages. The way I'm setting it up is by using XML files for the language, PHP to retrieve the values in the XML nodes. Say you have any XML file, being loaded as follows: <?php $lang = "en"; $xmlFile = simplexml_load_file("$lang/main....