php

url rewriting problem

in my .htaccess file i have the following Options -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/(.*)$ index.php?lang=$1&id=$2 [L] so when i wrote http://mydomain.com/am/home it will be redirected to http://mydomain.com?lang=am&id=home but i have a cms folder, and i need to go to http://my...

Read/write data from command line using PHP

Hey everybody, I have a server (debian lenny), spectral analyzer and I have downloaded collection of source codes from Steve Sharples's site. With these s. coudes I am able to connect to spectral analyzer - type command and get the responce. For example: my-atom:~/vxi11# ./vxi11_cmd 135.123.106.59 Input command or query ('q' to exit):...

mysql statement that skips the table if a feild doesnt exist

i have an array of all the tables in my database and i need to go in a delete the record if the applicationid=123 or familyid=123. but some tables dont have any of those feilds is there a way i can just skip the table if that is the case? instead of it erroring. $query2="DELETE FROM "$table[$x]" WHERE applicationid = '517f20805d9bd0961...

find string match

I need to check a variable to see if the string starts with http:// or https:// if it exists do something else do another. How would I go about doing that? ...

problems generating "checked" checkboxes from a MySQL generated list of checkboxes.

I am generating a group of check-boxes from a MySQL database with this code. $connection=mysql_connect ("localhost", "foo", "bar") or die ("I cannot connect to the database."); $db=mysql_select_db ("database", $connection) or die (mysql_error()); $query = "SELECT type FROM typelist ORDER BY type ASC"; $sql_result = mysql_query($query, ...

Running 100+ MySQL Update Queries. Optimization Tips Please :)

I'm working on this game titled "Fortress", located at http://www.joemajewski.com/fortress. Anyways, it's one of those browser-based role-playing games where players build an army and upgrade their stats to get a high ranking on the leaderboard. Every 30 minutes a cron job is going to execute, which makes some updates. It loops through ...

Login systems: Why are sessions needed?

I was creating a login system with PHP and I wondered: Why are sessions needed? If I store a cookie with the userid and the sessionid doesn't it pose the exact same security risks to storing a cookie with userid and password hash (given that the password hash is strong enough)? Yeah, someone could potentially steal the cookie, but isn't...

PHP to send mail using Gmail

Hey guys, I am trying to send email using my gmail account, and I'm getting an error for some reason. Would anyone know why it would give me this error? The script: <?php set_include_path("/usr/share/php"); include("Mail.php"); $from = "...

Is is possible to perform operations on a Sharepoint server file store from an external server?

I need to organise a bunch of files being stored on a Sharepoint server. I have a login to Sharepoint and privileges to modify files, but no access to any scripting or admin settings. The quickest way to make these changes currently is to "Open with windows explorer" - some kind of windows file server thingy, and that's very slow. I wan...

fsockopen() from 127.0.0.1 is not working

I'm trying to connect to an SMTP server from my local machine (127.0.0.1). I'm able to connect to other SMTP servers, but this one in particular will not connect from my local machine, it will connect however from 4 other remote servers I have tested on. I receive the following error trying to connect from my local machine: Message...

How to display number of posts for a given time frame in wordpress

Hello guys, I was hoping to get some ideas as how I can get a number of posts that have been posted on our blog BUT within a certain date range. I know how to get total number but need this extra functionality. This is what I have for getting total number of posts: $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE po...

Problem with using curl on another server

I am having a problem with PHP's curl. So I have a file on an ubuntu server that is called: example.php this file has the following code: <?php $url = "some url that returns xml"; $curl = @curl_init ($url); @curl_setopt ($curl, CURLOPT_HEADER, FALSE); @curl_setopt ($curl, CURLOPT_RETURNTRANSFER, TRUE); @curl_setopt ($curl, CURLOPT_...

php cURL , fill a remote form

Hi, is it possible to fill a remote form with the desired data ? Remote form <input type=text name=uploads[0] id=attachId0 size=30 onchange="checkUploadFile(this);"><input type=button value="del" id=idAttachOper0 onclick="return delInput('idfilespan','0')"><br id=idAttachBr0> ...

How to specify class dynamically in PHP?

So normal class methods and object creation goes like this... $obj = new Class(); $obj2 = Class::someMethod(); Can I instantiate "class" dynamically? How? I want to do something like... $class = "Class"; $obj = new $class?; $obj2 = $class?::someMethod(); ...

Does anyone know of any web interfaces for svn that have 'update' function?

We are in the process of installing svn as our version control and it works great. However, we previously used Contribute Deployer to push files to the production site. Everyone is kind of used to the web interface it uses and I am looking to see if anyone knows of any SVN Repo browsers (web based) that also offer update functionality?...

How to configure the Zend autoloader to load a custom path for resources before the default path

Separate but related to http://stackoverflow.com/questions/3363764/how-to-dynamically-override-forms-and-or-views-using-zend. I want Zend to try to load custom forms/views before loading a set of default forms for a web application to let clients create custom forms for their application. How do you configure the autoloader to load a d...

php and database question

I've been working on a website on my own xampp server on my computer with my own database and everything and so far it's been pretty smooth, surprisingly. Now I want to upload it to a host, and I found a free web host and I was able to upload the site through dreamweaver/ftp. I exported my DB into an SQL query and than ran that query o...

In mysql has the same effect in speed terms using a UNIQUE key than a NORMAL key?

For example, I'm doing the next action: SELECT COUNT(id) FROM users WHERE unique_name = 'Wiliam' // if Wiliam don't exists then... INSERT INTO users SET unique_name = 'Wiliam' The question is, I'm doing the SELECT COUNT(id) check every time I insert a new user, despite of using an unique key or not, so... if "unique_name" h...

I want to increment a value from outside a php block

Basically its a web page where someone would press a button to increment the $selection variable. Globals and statics do not seem to work. Code looks like this: <?php if(isset($_POST['next'])) { displaynext(); } else { global $image_folder = "/images/"; echo "global declared"; glo...

how to convert ereg_replace in clean MS Word function to preg_replace?

I found this function to clean MS Word markup: $html = ereg_replace("<(/)?(font|span|del|ins)[^>]*>","",$html); $html = ereg_replace("<([^>]*)(class|lang|style|size|face)=(\"[^\"]*\"|'[^']*'|[^>]+)([^>]*)>","<\\1>",$html); $html = ereg_replace("<([^>]*)(class|lang|style|size|face)=(\"[^\"]*\"|'[^']*'|[^>]+)([^>]*)>","<\\1>",$html); an...