php

Get String That Matches Wildcard in PHP

I need a very specific function in PHP. Basically, I have two strings as arguments, one of which is a pattern that contains wildcards of variable length (*), and one of which is a string that matches that pattern. I need to get an array of the strings from the latter string that fill in the wildcards in the pattern. For example: Arg...

PHP COM failed on Windows 2008 Server

I use COM in PHP to manipulate MS Word 2003 with success in Windows server 2003, but the same code are broken in Windows 2008 server. I've changed the user to administrator but still the same error occurred. For the code below: <?php // starting word $word = new COM("word.application") or die("Unable to instantiate Word"); echo "Loaded...

[PHP] Can this recursive function go crazy?

function generate_session_id( &$db ) { $user_sess_id = md5( uniqid( mt_rand(), true ); try { $stmt = $db->prepare("SELECT COUNT(*) AS session_exists FROM sessions WHERE session_id = :session_id"); $stmt->bindParam(':session_id', $user_sess_id); $stmt->execute(); $result = $stmt->fetch( PDO::FE...

PHP and Concurrency

I've been doing some web development work in PHP recently which has led me to study up on the language in general. So far I have not needed to use it to interact with a database, but I know it provides a lot of convenient functions for doing so. Although I know basic SQL and have worked with basic manipulation of data in a database, I d...

Using codeigniter to send a digest mail, once a week, to members.

Hi all, I'm new to codeigniter, and I'm trying to figure out how to implement a weekly digest, sent to members. I currently have the email set up correctly, and now am trying to get the 'weekly' part down. I know how to use date / time functions to check if one week has elapsed, but how do I run something, say, 'every monday at 8pm'...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once './facebook-platform/php/facebook.php'; $facebook = new Facebook(my api keys go here); $fb_user = $facebook->require_login(); /*this is where i want it to go */ $facebook->api_client->stream_publish("test"); ...

How to include config.php efficiently?

I'm always interested in more efficient ways and learning new things. Right now, I am using the code <?php include('config.php'); ?> in each and every file. Depending on where the file is in my the folder structure, I would have <?php include('../config.php'); ?> or even <?php include('../../config.php'); ?>. How can I make it more effi...

set a default saving data in a selection box in HABTM model

here is my problem which in my system. my system allow user to add event, which include date, time, places. In the other hand, user are allow to choose the "Event sharing to" some of other user. So i successful to created and share to other user, when the user login which are being choose to share with the event, he is able to view for ...

Formatting text with PHP

Is there a way I can format a list so I can insert it via SQL? My current list format is test:test and I want to be able to format it so it will insert into my database. INSERT INTO `test` (`user`, `file`) VALUES ('test', 'test'), ('test2', 'test2'), ('[email protected]', 'test3'); Is this possible by any chance? <? if($_POST['oldlist'...

Focus on div element

Hi I have a web page. It has too much height; in that page I have a div in the bottom of the page. I want to display the div in the center portion of the page. It’s appearing in the center of the page at the bottom position as in a way i like , but scrolling is needed. Is it possible to set focus on that div without scrolling? Does any...

word and line count from file

hi frnds,i am having one table a which contails all doc files i want to count the words from that doc file while editing or after editing and saving...please anyone help me out ...

access global variable as static class variable

Let's say I have the following class: class SQLMapper{ static find_user_by_id($id){ //sql logic here, using the $_DATABASE global to make a connection } } I could simply call: global $_DATABASE; at the top of my function, but I don't want to do that for ALL of my static methods. Is there a way to get a static varia...

Can a PHP script fill a form behind a login page?

How can a PHP script complete a login form to enter the members area (I have a username and password), such that it can send POST data to complete another form only accessible if logged in? ...

How to config Apache & php run as superuser

i try to config apache & php for my project to create web-based for file config management to open vpn in bsd unix, but i can't run as superuser to start or stop service ...

PHP combining directions in switch to get diagonal text

[Disclaimer: I am new to PHP, and I am just learning, so please no flamers, it really hinders the learning process when one is trying to find solutions or information, thank you, and the code works fine in terms of the crossword puzzle, it's just really baffling me how one gets a diagonal orientation with the given information, or what I...

what is wrong in this code???

im having a variable that is containing some links. Now i want to check that which link is clicked and hae to remove its anchor tag so that people can come to know that which tab has been clicked. this is the example of the data :- <a href="#" onclick="sort_data('All','all')">All</a> | <a href="#" onclick="sort_data('Diversified','1')"...

PHP/JavaScript How to combine 2 page in one

Hi all... I need a reference on how to make 2 pages become one. Originally i have 2 php pages. View.php and comment.php The view.php will have a link to call comment.php. When click the 'comment' link, it will open comment.php like pop up. After fill in the comment, and click send, it will closed and return the view.php. The problem...

Need PhpMyAdmin download with PHP 5.2 +

Give me the download link for PhpMyAdmin. I uploaded into domain. But its required php 5.2 +. please give me the download link for PhpMyAdmin with PHP 5.2 + Thanks in advance. ...

Cake PHP pagination problem

I have a controller and view. In the view it will displays all the records from the database. Also there is a search by form in the top of that view page. If we specify a search term and submit the form, the view will only displays the records resulting from that search. The results are paginated. But the problem is when I perform a...

elapsed time finding

Hi,everyone while uploading the file i ll be getting upload time something and given the time duration 24hrs within that user need to download the file and edit.how i can find how much time still left to complete the task.please anyone help out..how i can give the time duration like 24hr using php/mysql ...