php

What are the right ways to call shell commands (incl. those requiring root rights) from PHP/Java/Python web applications?

I am looking forward to develop a remote system management web application (like Webmin is, for example). Obviously I am going to need to call shell commands to be executed as issued by root or another specific non-nobody user. What are general guidelines for this task? The only solution coming into my mind now is running the web serve...

How to pass multiple dynamic url parameters to my pagination pages when a user searches the site using PHP & MySQL

I was wondering how can I pass multiple dynamic url parameters to my pagination pages when a user searches the site using PHP & MySQL in order to display their results? Here is the HTML form. <form action="search.php" method="post"> <input type="text" name="search" /> <input type="submit" name="submit" value="Search" /> </form>...

PHP: How to send email with attachment using smtp settings?

I am sending emails successfully using following code. But now I want to attach a text file (example: test.txt) with email. Any Idea? require_once "Mail.php"; $from = "Usman <[email protected]>"; $to = "Naveed <[email protected]>"; $subject = "subject"; $body = ""; $host = "smtp.gmail.com"; $username = "username"; $password = "password"; ...

Facebook application - basic database design

My User table (mysql db on a other server) has a FaceBookId Column. How do i filter it by friends? I mean Select * from User where FacebookId in SomeTypeOfGetFriends(of me ... the logged in user) what's the best way? should I first get the friends in an array, then do a FacebookId IN (array) ? OR: For every user that logs on, I co...

is there a native php function to compare characters held in an array with a string?

i am searchgin for a function in php, or a very lightweight and short/easy way to find out if a set (array) of characters appear in a given array if(chars_in_string(array("x","d","9", "ü"), $anystring) ) do_something() while x,d,9, ü are just as an example ... hmmm maybe i can solve this with regular expressions? ...

include path and the __autoload function in php

Hey everyone, I am trying to convert several php scripts to use the __autoload function. Right now I can use the include and require functions like this: require_once('path/to/script.php'); But inside of the __autoload function, I can't use the line above. I have to use this: require_once('absolute/path/to/script.php'); Why does...

WordPress - How do I display the total number of comments from an entry?

I am displaying WordPress content on a static HTML page, which is outside of the WordPress content. It is working very nicely and I just need one more element to complete the set. I am using this code: <?php while (have_posts()): the_post(); ?> <h5><?php the_title(); ?></h5> <p class="blog-info"><?php the_time('m'); ?>.<?php the_ti...

How can you pass multiple search parameters a user enters through the query string when generating pagination links using PHP & MySQL?

How can you pass multiple search parameters a user enters through the query string when generating pagination links using PHP & MySQL? Here is the HTML form. <form action="search.php" method="post"> <input type="text" name="search" /> <input type="submit" name="submit" value="Search" /> </form> ...

php, data from object

Hi, how get information from Object? $cars = new Cars($car_color, $car_id, $car_speed); CAR_class::cars($cars, $car_speed); Thanks ...

PHP find words which are not in regex

I have written following regular expression /^[A-Za-z0-9-_\s]*$/ in PHP which allows numbers, letters, spaces, hyphen and underscore. I want to display those matches which are not valid against the regex i.e "My Name is Blahblah!!!" should give me "!!!" output. ...

Store files in MySQL database from HTML form.

Hey Guys, I've got the following HTML form. As you can see it's saving a file. <form enctype="multipart/form-data" action="welcome.php" method="post "onsubmit="return validateFormOnSubmit(this)"> <b>Name</b><br/> <input type="text" name="fname" /> <br/> <b>Description</b><br/> <TEXTAREA NAME="description" COLS=40 ROWS=6></TEXTAREA...

convert any date string to timestamp without timezone

I'm getting xml and rss feeds and putting the data into a database. I've run into two different date formats so far... Wed, 21 Jul 2010 00:28:50 GMT And 2010-07-20T17:33:19Z I'm sure there will be more. My postgresql database for the date is timestamp without time zone. Is there an existing function in php or is there a procedure t...

Multidimensional Array based Elements

Using Zend_Form, how would I create form elements like this <input type="text" name="element[1]" value=""/> <input type="text" name="element[2]" value=""/> ...

Is there any 'virtual browser' in PHP?

HI, I want to extract data from a website but it uses some strange javascript so I can't get the job done with cURL. I want to know is there anything like virtual browser which opens up the page and I can initiate click on some buttons? If not is there any executable program to achieve this task via command line? ...

mysql_insert_id doesn't return anything

$sql="INSERT INTO wp_comments (comment_post_ID, comment_author, comment_date, comment_content, user_id) VALUES ('$qID', '$author', '$dro', '$content', '$_SESSION[user_id]')"; $result = mysql_query($sql); die(last_insert_id()); When I run this code I see white screen only, so last_...

C#: How can I send a PHP session variable to a WebBrowser control?

Okay, I am using the following code to navigate to a page in my WebBrowser control based on information entered in a login form: private string currentUser = usernameTextbox.Text; private string currentPasswd = passwordTextbox.Password; public static byte[] StrToByteArray(string str) { System.Text.ASCIIEncoding encoding = new Syste...

recursive function category database

hello i hoping to create a recursive function which i don't have an idea yet this is my code to fetch category from database <?php $sql = mysql_query("SELECT * FROM categories WHERE category_parent = '1' ORDER BY lft ASC"); while($row = mysql_fetch_array($sql)) { echo "<li><a href='/{$row['category_safe_name']}/'>{$row['catego...

Need to intergate IDX MLS into a website

Are there any free IDX or MLS integration scripts available? I want to do a website in which I can integrate the MLS data into the site database but I have no idea how to go about it without seeing some type of working script. Any help or direction would be greatly appreciated. ...

php load page page into div ,java script not working

hey there i am using ajax to load pages into a div the page is loading fine but i cant run the php and javascript in that loaded page in server i am loading the page like this file_get_contents('../' . $PAGE_URL); in the browser i am setting the content of the div using eval("var r = " + response.responseText); and setting ...

Apache is lagging or something else is bad

Hi! I have a website. It's my first website with Zend Framework but I think it's written good. Generatiom time is about 0.9s now. I'll do it something like 0.2 but leave it now. When you press any link on the website it tooks about 1,5-2s before web browser is loading page. Then it tooks 0.15s to show it. So if execution time is 0.9 wher...