php

PHP Form checkbox question

Hello, I have a form that takes the following inputs: Name: IBM Surface(in m^2): 9 Floor: (Checkbox1) Phone: (Checkbox2) Network: (Checkbox3) Button to send to a next php page. All those values above are represented in a table when i press the submit button. The first two (name and surname) are properly displayed in the tabl...

PHP-based Crossword Creator code

Possible Duplicate: PHP: Script for generating Crossword game? Does anyone know any PHP-based simple Crossword Creator API? Thanks in advance. ...

Is any otherway to run .htaccess file in local server?

Is anyway to run .htaccess file in local server without using online? ...

404 Not Found When Requesting URI With Encoded Patameters

I am pretty sure this is some problem with the Apache configuration because it used to work on the previous hosting provider with the same PHP/MySQL configuration. In my application, users are able to delete photos by going to URIs like this: http://example.com/my-account/remove-media/id/9/ret/my-account%252Fedit-album%252Fid%252F1 Th...

How do I apply a string function to a table column?

As part of a query result, a column with names is returned. I want to apply a function so that the order of first and last name is flipped in my $db results. What is the most efficient way to accomplish this? There answer probably lies in using either the foreach function, array_walk or array_map but I don't know the proper syntax. ...

formatting an array of mobile numbers

Hi, I am creating a SMS app the following code is supposed to: check if the mobile/cell number is 11 characters long. check if the number starts with 07. If neither of these conditions are met, it should remove the number from the array. So the following numbers would be valid: 07123456789,07123456790,07123456791,07123456792,07123...

CodeIgniter: Where should a particular functionality go ?

Here is a quick overview of the controllers functionality in most of the application: controller loads a specific model, gets data from it, formats the data and passes the formatted data to the view. Now there is a search page, which needs to do a search query over entire database (all models). It needs to show each type of data in i...

String to image only produces black background

Hi im really having a problem find how to fix this. $string = "foo"; $font = 4; $width = ImageFontWidth($font) * strlen($string); $height = ImageFontHeight($font); $im = @imagecreatetruecolor ($width,$height); $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 0); imagestring($im, 5, 0, 0, $string...

XSS prevention in PHP

Possible Duplicate: What are the best practices for avoid xss attacks in a PHP site I need to prevent XSS attacks in PHP code, is there nay good and easy library for this? ...

Can str_replace be safely used on a UTF-8 encoded string if it's only given valid UTF-8 encoded strings as arguments?

PHP's str_replace() was intended only for ANSI strings and as such can mangle UTF-8 strings. However, given that it's binary-safe would it work properly if it was only given valid UTF-8 strings as arguments? Edit: I'm not looking for a replacement function, I would just like to know if this hypothesis is correct. ...

Sign Up/Login system for multi-domain/multi-server

I'm thinking about a good solution for implementing a sign up/login system that works across different domains and servers. A working example is Olx (you can register in one domain, and your login will work on the rest of domains). The scenario is that every domain (one per country) has its own database. And there will be 2 servers (for...

Do all databases use the USE statement to switch databases?

MySQL uses the USE database_name to change the active database. Does that work on all databases? EDIT: By databases I mean DBMS. Thanks for bringing it to my attention. ...

how to figure out if the present node is the last child of the parent's node

Hello, I'm trying to figure out how to know if a node is the last child of another, or not. I know how to retrieve the parent's lastChild name ($node->parentNode->lastChild->nodeName), but as sometimes there's many same node names within the same parent, the name is definitly not the way to find the last child. I'm looking for some kin...

Find and replace braced tags within a MySQL table

I have about 40000 records in that table that contains plain text and within the plain text, contains that kind of tags which its only characteristic is that they are braced between [ ] [caption id="attachment_2948" align="alignnone" width="480" caption="the caption goes here"] How could I remove those? (replace by nothing) I could ...

require_once in php

I have a php file which has a require_once Statement (?) this file is then in included in 2 other php files, one php file is in a sub directory so the layout is like this ("file1" and "file2" include the file "included" which require_onces the "required")# L--subfolder1 | L--file1 L--subfolder2 | L--required L--file2 L--included...

MySQL Connection Error in PHP

I have set the password for root and grant all privileges for root. Why does it say it is denied? ****mysql_query() [function.mysql-query]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\photo_gallery\includes\database.php on line 56 Warning: mysql_query() [function.mysql-query]: A link to the server ...

Resetting passwords without emailing the user

We need to provide a way to reset password for users who are using our website. The typical way is to send email to the user and ask to click on the link to reset. The issue is that we don't want to run a mail server just for the purpose of resetting password. Is there other clever way of reseting password without having to mail the us...

Add properties to stdClass object from another object

I would like to be able to do the following: $obj = new stdClass; $obj->status = "success"; $obj2 = new stdClass; $obj2->message = "OK"; How can I extend $obj so that it contains the properties of $obj2, eg: $obj->status //"success" $obj->message // "OK" I know I could use an array, add all properties to the array and then cast t...

Sort files (strings) over 4 arrays

Hi there, I am after a function which will let me sort a bunch of filenames over 4 arrays. However, the a file must always end up in the same array - even if the number of files change. Eg if I have files myfile.html anotherfile.html morefiles.html test.html and my arrays array1, array2, array3, array4 If I run this function then ar...

url rewriting index.php

i have urls like http://mysite.com/index.php?p=resources http://mysite.com/index.php?p=resources&s=view&id=938 but i want urls like http://mysite.com/resources http://mysite.com/resources/view/938 instead of making hundreds of rewrite rules i wonder if it would be possible to just have one? Ive head this is possible by "get...