Hi,
I'm creating a used cars website (written in PHP), and I'm stuck on sending advanced search options from form. I have more than 30 of them and I wonder if it's possible, and how, to send them in one variable (for example &options=1,2,3,5,6,10 or some other way..). Also I've heard that this is possible with "bitwise" but I don't have ...
Question
What is the fastest way to find if an IP address exists in a file that contains IP addresses sorted as:
219.93.88.62
219.94.181.87
219.94.193.96
220.1.72.201
220.110.162.50
220.126.52.187
220.126.52.247
Constraints
No database (e.g., MySQL, PostgreSQL, Oracle, etc.)
Infrequent pre-processing is allowed (see possibilities...
Before I dive into the disscusion part a quick question; Is there a method to determine if a variable is a reference to another variable/object? (Just want to check I am passing references around correctly and not make duplicate versions of my objects). For example
$foo = 'Hello World';
$bar = &$foo;
echo (is_reference($bar) ? 'Is refe...
I am currently developing a PHP MVC Framework for a personal project. While I am developing the framework I am interested to see any notable performance by implementing different techniques for optimization. I have implemented a crude BenchMark class that logs mircotime.
The problem is I have no frame of reference for execution times....
I'm working on a new project http://www.hotwirerevealed.com which reveals / identifies hotels on hotwire.com. After inputting a state and a destination I have a javascript functions that uses jquery's .post method to post. The post request goes to an php page which outputs html, I se jquery's html method to place the content on the page....
What PHP script technique runs the fastest in detecting if a remote image does not exist before I include the image? I mean, I don't want to download all the bytes of the remote image -- just enough to detect if it exists.
And while on the subject but with just a slight deviation, I'd like to download just enough bytes to determine a JP...
I recently started using gzip on my site and it worked like a charm on all browsers except Opera which gives an error saying it can not decompress the content due to damaged data. From what I can gather from testing and googling it might be a problem with using both gzip and chunked transfer encoding. The fact that there is no error when...
I'm trying to parse BBcodes in php but i don't think my code is safe at all.
$Text = preg_replace("(\[color=(.+?)\](.+?)\[\/color\])is","<span style=\"color: $1\">$2</span>",$Text);
I think you can pass an injection like this and it will work:
[color=<script>alert('gotcha');</script>]...[/color]
How to improve my regex to only cap...
I am sorry about the amount of code here. I have tried to show enough for understanding while avoiding confusion (I hope). I have included a second copy of the code at Pastebin. (The code does execute without error/notice/warning.)
I am currently creating a Content Management System while trying to implement the idea of Model View Co...
I have some PHP code which stores whatever is typed in a textbox in the databse. If I type in bob's apples, it gets stored in the database as bob's apples.
What can be the problem?
The table storing this has the collation of latin1_swedish_ci.
...
'SOUP.IO' is not providing any api. So Iam trying to use 'PHP Curl' to login and submit data through PHP.
Iam able to login the website successfully(through cUrl), but when I try to submit data through cUrl, it gives me error of 'invalid user'.
When I tried to analysed the code and website, I came to know that cUrl is getting values of...
phpdelicious (http://www.phpdelicious.com/) is a wrapper class for pulling in your delicious bookmarks using php.
But I can't get it to work. Here's my code - my index.php:
<?php
require('php-delicious.inc.php');
define('DELICIOUS_USER', 'my-user-name-here');
define('DELICIOUS_PASS', 'my-password-here');
$oDelicious = new PhpDelicious(...
I am trying to create a new db called testDB2, below is my code.
Once running the script all I am getting an error on line 7
Fatal error: Call to undefined function mysqlquery() in /home/admin/domains/domain.com.au/public_html/db_createdb.php on line 7
This is my code
<?
$sql = "CREATE database testDB2";
$connection = mysql_connect...
I have a problem to fix the URL on my website at http://www.abelputra.com
I need a solution:
I want to change www.abelputra.com/software.php into www.abelputra.com/software
I have read a tutorial like this:
For .htaccess:
RewriteEngine On
RewriteRule ^ ([a-zA-Z0-9_-] +) $ index.php? Key = $ 1
RewriteRule ^ ([a-zA-Z0-9_-]+)/$ index.php...
I need some PHP classes that deal with image processing in a good manner. I have made a thumbnail creator myself but the end result quality is just horrible.
Is it also possible to let PHP convert and save all images to one type. For example take an image(jpg,png,gif), compress it, resize it, and save as png.
Can anyone recommend some ...
<tr id='ieconn3' >
<td><table width='100%'><tr><td valign='top'><table width='100%'><tr><td>aaaaa
<br> </td></tr><tr><td>
I want to get the aaaaa part till <br> or </td>. I tried lots of patterns but didnt work. any help?
...
In PHP, what's the best way to copy an array and keep the keys with empty values?
array1 = array("apple" => "green", "banana" => "yellow);
I want to copy array1 to array2 and keep only the keys...
array2 = array("apple" => "", "banana" => "");
...
$i=0000;
while($i<=1231)
{
print "$i";
$i++;
}
I want it to display 0001,
0002,
0003,
0004,
but instead it prints:
0,
1,
2
Does anyone know why this isn't working?
Thank you in advance.
...
I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this approach before and I'm trying to figure something out:
Normally, I always just display the posted form again when there are validation errors and display POST values in the form (sticky form). However, with the PRG pattern, the form is displayed after a red...
Here is a validation script from a book I am learning, Why is escaping the quotation marks necassery? e.g. <option value=\"char\">char</option>
<?php
//validate important input
if ((!$_POST[table_name]) || (!$_POST[num_fields])) {
header( "location: show_createtable.html");
exit;
}
//begin creating form for display
$form...