php

map based on users ip

hi, how to create a users location map based on the ip address. i collect the ip address of users coming to the site and i want to show a map with their location based on the ipaddress that I collected. Is there any map service which is available to use, i am fine if we need to pay anything to have more queries. thanks. ...

Help with Regular expression (PHP, preg_replace)

I need to do a preg_replace on all of the PHP tags in a string, as well as any characters sitting between the PHP tags. Eg, if the file contents was: Hey there! <?php some_stuff() ?> Woohoo! All that should be left is: Hey there! Woohoo! Here's my code: $file_contents = file_get_contents('somefilename.php'); $regex = '#([<?php](....

Why mail() PHP function does not work with WAMP default installation ?

I have a default installation of WAMP Server 2.0. I'm trying to send email using this simple script: <?php if (mail('[email protected]', 'My Title', 'Some Text')) { echo "OK"; } else { echo "Why ??"; } ?> Unfortunately, I get the following warning: Warning: mail() [function.mail]: Failed to connect to mailserver at "local...

Secure inserting value of $_POST['textarea'] into <textarea> HTML tag using PHP only.

Is there any way to insert $_POST['textarea'] into <textarea> without escaping shell special chars? I do sth. like : <textarea> <?php echo escapeshellcmd($_POST['textarea_field']) ; ?> </textarea> and I have a problem with \ chars. I do not wont them in <textarea> but without escapeshellcmd(); function it ...

How to manage user and group using DB and PHP?

Hi, We've Web site for software repository for internal team to access it. Currently there are many users and divided into various groups. To manage them, we're using string like binary nos., like '000101' and do check 1's and its position, based on that, we decide user belongs which group(s)... For example, '01111' => group 'test1' ...

Set background color in PHP ?

What is the easiest way to set background color in PHP ? ...

tcpdf joomla output in wrong on live server.

Hi Guyz, I am working with joomla and have tcpdf for pdf, print article when i test on local server it shows me the right results on both but on live server only the print page works fine and pdf did not render perfectly, it show some machine specific code. thanks in advance. Farrukh ...

PHP MYSQL order by day and month...HELP please..

Hi i have my mysql $query = mysql_query('SELECT * from rbf_edades_news order by month DESC '.$limit.''); month and day are in different fields, any idea?" is this possible $query = mysql_query('SELECT * from rbf_edades_news order by month and DESC '.$limit.''); Thanks! ...

CakePHP use 3 models with saveAll

I have following situation: I'm developing an address-application to store the details of our clients. I've got the following db-structure: Clients hasMany Addresses Addresses belongsTo Client Addresses hasMany AddressEmails and AddressPhones If someone now adds a new client, his primary address with 1 email and 1 phonenumber should...

WebOS development requirement

Hello All, I have this increasing interest in web OS. I want to start building my own. But I am at absolute zero position. I went to websites of XIN, EyeOS, YouOS to gain some initial idea. Still exploring... Can someone tell me about how can I do scratch start. Like system requirements, technologies one should be using, some referenc...

How to display post pagination in wordpress (if possible without a plugin)

Hi all, My blog that runs on Wordpress has several pages of posts. I have the page navigation set up (so I have a link for "Older Entries" and "Newer Entries"). I was wondering if it's possible to do something like this: 1 | 2 | 3 | 4 ... 32 | Last Page EDIT: Thanks to Adam, I replaced the wp_list_pages with the wp_link_pages functio...

Remote download script needed

Im looking for a script where the server will allow the user to download a file from a mirror but through the servers IP. ...

PHP hidden trick or a supported feature?

Hi, I know that to concatenate strings in php, a dot should be used: echo 'hello' . ' world'; // hello world But incidentally i typed this: echo 'hello' , ' world'; and the result was still hello world without any errors. Why is it so? Can we also concatenate using comma? ...

Sending a large email mailout through Gmail or maybe even Google App Engine?

I have a client that I'm wanting to move to a virtual private server. I'm trying to keep his server as simple as possible, not even having an email server on there (or at least that is the plan). The reason being I've read that email servers are complex to setup and take up alot of resources. I'm not sure what to do here. He has a newsl...

Is there a way to check if a user is logged in using JQuery?

I want to be able to display a message if a user is not logged in if they try rating a user by clicking a rating. Is there a way to add it to my JQuery code below or can I pass it to my PHP script? I'm using PHP Here is the JQuery code. $('#rate li a').click(function(){ $.ajax({ type: "GET", url: "http://localhost/...

How to rediect if the header is been sent ?

i have situation where i create solution. I use wordpress and unfortunetly, i have to work behind the backend. I need to print message about user action while the CMS header have been sent. Is there any alternative then using javascript : echo '<script type="text/javascript">/* <![CDATA[ */'; echo 'window.location.href = "'. $redirect_...

A trick to find unused PHP files (Drupal template files)

I am looking for a trick to find included files that are not in use. Preferrably not by going trough them by hand. This project has over 400 of such files, 100 are probably unused by now. They are Drupal template files (tpl.php) and were placed in the theme/template during development and -as always- were never removed when obsoleted. ...

how to extract the field type of a mysql column without using mysql_field_type

I am writing a code where I extract information from tables by entering the query in a php page. So if i write a sql statement in the search box, it would give me the result. The problem: The mysql statement could be anything that the user enters as explained above. There are a few columns that repeat across tables like that of entered...

How we can retrieve user information from Active Directory?

For now, I would like to know how we can retrieve user information from Active Directiory by using PHP Command. Can you give some example or any suggestion ? ...

Link to php script

I have a script which I can run from windows console writing "php backup.php". How to create a link to run it directly from desctop? ...