php

How to get file path from symlink?

How can i get information via php or bash to what file referencing a symlink in linux? ...

How to create an array from database?

Hi, Please help me to create an array from a field of my DB. That field has records separated by comma. Below is the illustration: ID | article_title_fld | article_tags_fld | ---------------------------------------------------------------------- 1 | Learn PHP | PHP, coding, scripting ...

How do I get this web-based word processor?

Hi I was wondering if I could get a web-based word processor just like the one here on stack overflow, that shows a view of what you are typing in. ...

Wordpress Post order

I wanted to re-arrange my recent post in wordpress so they go Ascending/Descending. Here is my code: <ul> <?php query_posts('cat=3,4,5&posts_per_page=5&order=ASC'); foreach ($post as $post) ?> <li> <span class="date"><?php the_time('M j') ?></span> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title()...

CodeIgniter: Sending params to a view?

Hello, My controls receives some params from the user, I would like to place them inside the view I'm calling, how should I do this without splitting the view into multiple parts? Thank you. ...

Using mcrypt to pass data across a webservice is failing

Hi I'm writing an error handler script which encrypts the error data (file, line, error, message etc) and passes the serialized array as a POST variable (using curl) to a script which then logs the error in a central db. I've tested my encrypt/decrypt functions in a single file and the data is encrypted and decrypted fine: define('KEY...

New user register, script auto create problems!

Hi, im currently trying to create a php script that when a new user register, a script (eg:wordpress,blog etc..) will install for them. I'm currently got the code below for just single setup, but how can i setup a form for multi user? which only allowing them to input the username (subdomain) and password. <?php class scriptname_Config...

Easy Regex question

Trying to replace the first 12 digits of credit card numbers with X's in a predictable blob of text that contains the string: Credit Card Number: 1234123412341234 Here's my PHP function: preg_replace('/Credit Card Number: ([0-9]{12})/','Credit Card Number: XXXXXXXXXXXX',$str); Help? ...

PHP Array logic re-factor

PHP Array logic re-factor I'm trying to re-factor my code... This is PHP ... I have the following: $totals[] = "Total"; $totals[] = $counts['hole'][1] + $counts['warn'][1] + $counts['info'][1] + $counts['crit'][1]; $totals[] = $counts['hole'][2] + $counts['warn'][2] + $counts['info'][2] + $counts['crit'][2]; $totals[] = $counts['hole'...

JQuery with SMARTY php

This might seem a very noob question but I haven't found the answer yet. I have a header.tpl file which contains xhtml code. I want to and some java script to it using jquery. But my problem is that it simple doesn't happen what I tell it to do. Because the page hoster comiples php with SMARTY I had to make a small change to the block s...

Combining Data from two MySQL tables.

I'm trying to combine data from two tables in MySQL with PHP. I want to select all the data (id, title, post_by, content and created_at) from the "posts" table. Then I would like to select the comment_id COUNT from the "comments" table IF the comment_id equals the posts id. Finally, I would like to echo/print something on this order...

How can I fake sql data while preserving statements without commenting my server-side code?

I have to use hardcoded values for certain fields because at this moment we don't have access to the real data. When we do get access, I don't want to go through a lot of work uncommenting. Is it possible to keep this statement the way it is, except use '25' as the alias for ratecode? IF(special.ratecode IS NULL, br.ratecode, speci...

Parse error: syntax error, unexpected ';'

I am migrating my site from PHP 4 to 5 I keep getting this error on the version 5 server: Parse error: syntax error, unexpected ';' in /var/www/vhosts/**.php on line 1688 I when I check the code its something like this: <?=#something here being commented out?> This worked fine in v4 but now its creating an Error. I really d...

PHP: Extract direct sub directory from path string

I need to extract the name of the direct sub directory from a full path string. For example, say we have: $str = "dir1/dir2/dir3/dir4/filename.ext"; $dir = "dir1/dir2"; Then the name of the sub-directory in the $str path relative to $dir would be "dir3". Note that $dir never has '/' at the ends. So the function should be: $subdir ...

Selecte and retrieve file path to image using dialog box

I'm expanding Wordpress to function more like a CMS. This includes relating image to a post. Currently I have a text field where I paste an image path. Now I want to click a button which opens a dialog box, then I navigate to the right folder and select a file to "open" (from server side). The file path is returned. How can I go about...

highlighting search results in php error

i'm trying to figure out what is wrong in this code. it either doesn't highlight the search result OR it outputs html tags surrounding the highlighted text. . $search_result = ""; $search_result = trim($search_result); $special_cases = array( '%', '_', '+' ); $search_result = str_replace( $special_cases, '', $_GET["q"] ); //Check if...

How to get redirecting url link with php from bit.ly

I'm trying to get url links to those bit.ly redirects. I've tried to open bit.ly links with file_get_contents but it already gets content from redirected site, but how to get its url? ...

Php, passing data between pages without using the url?

I have a php page that has a form that asks for an e-mail. When you press the send button, it gets to another php page, which gets the form data and does its stuff. I need to then be able to go back to the old page (the one that contained the form) and give it some data so that it will be able to change itself and say "You've sent your e...

facebook permission dialog php-sdk shaded inside iframe application

i'am having trouble with facebook php-sdk new api, permission window i am using facebook connect inside the facebook iframe application http://tinyurl.com/2aojf5l when i try to login with following url login windows laying out well inside facebook application but permission diolog is being overlayed by shaded screen what can cause th...

Why I have to call 'exit' after redirection through header('Location..') in PHP?

You know that if you want to redirect an user in PHP you can use the header function: header('Location: http://smowhere.com'); It is also well known that it is a good practice to put also an exit; after the header call, to prevent execution of other php code. So my question is: could the code after the header-location call be effectiv...