php

Replace More Than 1 Instance with PHP

Say I have sometext-somemore--test---test2 how could I have it replace all instaces where there are more than 1 - and have it replace them with just 1 so it would look like this sometext-somemore-test-test2 ...

Is it possible to add custom 'actions' in SugarCRM?

There are number of actions defined for each category in database like add, list, delete etc. I was adding a new module in open source version of sugarcrm and was wondering is it possible to add a new 'action' like approve/request/verify etc. Has anyone tried doing it? Thanks. ...

How rar a folder with php ?

I simple want to rar a folder with the help of php, so there's 2 ways to do this one is via shell_exec or exec, which isnt working for me but shell_exec and exec is enabled on server and working for other commands other method is via .sh file, but i dont know how to use it properly :( i need some code which works properly for this i m...

random quote generator in php using mysql

i coded a random quote generator in php using mysql but also jquery. however when i try to integrate it with facebook, since i opted to use fbml, i could not use jquery. how do i get the quote to display randomly in php at say, 30 mins, without using jquery or javascript? ...

Proper way to use a config file?

I just started using a PHP framework, Kohana (V2.3.4) and I am trying to set up a config file for each of my controllers. I never used a framework before, so obviously Kohana is new to me. I was wondering how I should set up my controllers to read my config file. For example, I have an article controller and a config file for that co...

Building an *efficient* if/then interface for non-technical users to build flow-control in PHP

I am currently building an internal tool to be used by our management to control the flow of traffic. I have built an if/then interface allowing the user to set conditions for certain outcomes, however it is inefficient to use the switch statement to control the flow. How can I improve the efficiency of my code? Example of code: ...

Random avatar generator

Possible Duplicates: Auto Generated Avatars on Stack Overflow what is the algorithm used to generate those little gravatar identicon images? StackOverflow seems to have nice, randomly generated avatars for default users. How do I do that (preferably with PHP)? ...

WordPress deactivate a plugin via database?

I have a wordpress script, wp-supercache, that I need to disable (as its cached on a nasty error), however, the error is causing the wp-admin redirect to fail, which means I can't get into the site to disable the plugin. Any advice? I can access the database via cpanel. ...

Safe executing shell scripts; escaping vars before execution.

Hello, Let's imagine that we have a simple php script that should get ssh_host, ssh_username, ssh_port from $_GET array and try to connect using this parameters to SSH. $port = escapeshellcmd($_GET['ssh_port']); $host = escapeshellcmd($_GET['ssh_host']); $username = escapeshellcmd($_GET['ssh_username']); $answer = shell_exe...

Removing a Preceding Backslash from Apostrophes

Hello, When I add a comment using the variable below, apostrophes are printed with a backslash in front of them. How can I get rid of the backslashes? Thanks in advance, John Example of printed result: My roommate\'s brother\'s ex-girlfriend\'s aunt drive a Toyota. $comment = mysql_real_escape_string($_POST['comment']); ...

bytes convert to float (php)

How can I convert from bytes to float in php? Like in Java int i = (byte3 & 0xff) << 24 | (byte2 & 0xff) << 16 | (byte1 & 0xff) << 8 | byte0 & 0xff; Float.intBitsToFloat(i); ...

Cannot connect Linux XAMPP PHP to SQL Server database.

I've searched many sites without success. I'm using XAMPP 1.7.3a on Ubuntu 9.1. I have used the methods found at http://www.webcheatsheet.com/PHP/connect_mssql_database.php, they all fail. I am able to "connect" with a linked database through MS Access, however, that is not an acceptable solution as not all users will have Access. Th...

How know if an iframe content is empty or not?

I need know if this page returns something, because this page have a login in ASP and my server is a PHP. ...

Numerating Comments

The code below prints out all comments for a given "submissionid" in chronological order. How could I numerate these comments? (In other words, how do I print out a "1." next to the oldest comment, a "2." next to the second-oldest comment, etc.?) $submission = mysql_real_escape_string($_GET['submission']); $submissionid = mysql_real_e...

Having Uploadify e-mail a link to download the file

Uploadify is a jQuery plugin that allows the easy integration of a multiple (or single) file uploads on your website. It requires Flash and any backend development language. An array of options allow for full customization for advanced users, but basic implementation is so easy that even coding novices can do it. I wanted to ask if It...

Getting an Variable to Display at the top of an HTML Table Row

Hello, For the HTML table column below, the $count++ displays in the middle of the row. How can I get it to display at the top of the row? Thanks in advance, John Code: echo '<td class="commentnamecount">'.$count++.'.</td>'; CSS: .commentnamecount { width: 20px; overflow:hidden !important; color: #00000...

Determine if a PHP array uses keys or indices

How do I find out if a PHP array was built like this: array('First', 'Second', 'Third'); Or like this: array('first' => 'First', 'second' => 'Second', 'third' => 'Third'); ??? ...

Recommend a PHP framework for new PHP programmer

Hi All, I am fairly new to PHP but not programming in general. I was hoping I could get some suggestions on the best type of PHP framework to start with considering my basic experience with PHP. I have a .NET and ASP.NET background and I am familiar with the MVC design pattern. I would prefer to start with a framework that makes logical...

HTML Upload Form will only upload files found in the directory of the PHP file.

I have an image uploader that uses the imgur.com API and jQuery's .ajax() function to upload images to their servers. However, if I browse for an image using the <input type="file"/> element of the form, it will only be successful in uploading an image if the image file is found in the same directory as the page.php file that the form is...

Help - use PHP-broswer, or proxy or get_page_contents or include page, or something else ??

Hi, I am trying to develop a web application for which I need to capture a specific user-driven event (such as mouse dblclick) occurring on a different-website page loaded through my website. What I want to do is : User visits my website - hosted by me. There, user types in any website URL (e.g.: http://www.example.com) That URL page...