php

preg_match not splitting one result

Hi this code SHOULD put all segments into an array. $dir = "../www.cms.actwebdesigns.co.uk2/logged.php"; #$dir = "../../logged.php"; $str = base64_encode(htmlspecialchars(preg_replace("#(?:\s\s+)|(?:\n)|(?:\t)|(?:\r)#", " ", file_get_contents($dir)))); $dataToAdd = array(); for($x=0; true; $x++) { if(preg_match("#(".base64_en...

Add strings to array PHP

Hello I have $string1, Array[] and $string2. I want to create a Arraynew[] such that Arraynew[0]=$string1 Arraynew[1]=Array[0] . . . Arraynew[n-1]=Array[n] Arraynew[n]=$string2 The problem being that I don't know how many elements are in Array[] since it's from parsed data that changes and also I don't know how to formulate the above ...

How To ? Form Post to Multiple Locations

I have a form which I need to POST to multiple scripts. How can I do this the simplest way? I know it could be done with Javascript, Curl or Snoopy class, but really which is the most simplest and best way to do this. One of the scripts sends email and it's a php file, the other is hosted elsewhere. Need to collect data on both script...

mod_rewrite rewrite all but index.php

In my htaccess i have RewriteRule ^([^/]+)/?$ cms.php?seotitle=$1 [L] The idea is that index.html will load fine and then anything requested at domain.com/anythinghere.html will use the rule of grabbing the file from cms.php. However its not working - any clues? Really need this sorted asap. ...

Is Zend Framework a total waste of my time?

Ok, I'm about 50% done with the "30 minute" quickstart guide from Zend. I must be missing something, because this seems like a total waste of time. The point of this quickguide is to create a guestbook, something I could do in 5 minutes with regular naked non-framework php. Here's my path to zend framework: c:/program files/wamp/www/_z...

Sitemap for dynamic PHP website ... the "lastmod" field is needed?

Hello, I've a really small website, so I usually update the sitemap by hand! In each "url" element there are the fields: loc, lastmod, changefreq and priority. The "lastmod" field is setup to the date in witch I update the content of the related PHP page or the content that is loaded dynamically in the related PHP page! I've tried to...

Best SEO method to translate a website page with google translate

So must of us have a lot of content on our sites in one language or another. Since we are web professionals we spent all that time we could have been learning human languages - instead learning computer languages. So we need someway to translate our content. Google provides a translation service (among others) and so given their massive...

Inserting php array data into mysql isn't working

Hello I have an array $name[] that I am trying to insert into the second field of my table but it's not working (table remains completely blank). I cannot find the error in my code what am I doing wrong? $username="us"; $password="pw"; $database="db"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "err...

Help with regular expressions (php)

Hello there! Could you please point me to the mistake in my regular expression? /[\x{4e00}-\x{9fa5}]*[.\s]*\[\/m\][\x{4e00}-\x{9fa5}]/u My string starts with chinese character ([\x{4e00}-\x{9fa5}]), which is followed by any character and ends with '[/m]' and another chinese character. So the string possibly could look like: 我... some...

Proper way to pass along many variables in an OOP design (PHP)

How would I properly pass along data to a class being referenced in this structure: -Head Index - PageBuilder - PageSection -Body -Foot I want to send lots of data to head, for example, but I would like to avoid this: new PageSection('head','how to cook',$keywords,$...

PHP, Python, Ruby application with multiple RDBMS

I start feeling old fashioned when I see all these SQL generating database abstraction layers and all those ORMs out there, although I am far from being old. I understand the need for them, but their use spreads to places they normally don't belong to. I firmly believe that using database abstraction layers for SQL generation is not the...

mod_rewrite needed

lets says I have a domain example.com and I have wildcards dns switched on. on example.com a user can signup with username and password. once registration is done, username.example.com starts redirecting to example.com/script/script.php?user=username. address bar would still show username.example.com what would be the contents of the .h...

WebDAV/ftp/etc custom solution

Hi! We have a project (Web/PHP) where we would like users to access their files, used in our application, using some kind of standardized protocol e.g. FTP or WebDAV. This would make it easier for our users to access their files, which mainly consists of templates and images. The thing is, the directory that the users would be browsing...

Getting product details using Amazon API

Hi, I've got the following code to output a list of items from amazon, but I not sure how to access specific products (with Summery, reviews, etc). Any help would be appreciated. <?php function makeAWSUrl($parameters, $associate_tag, $access_key, $secret_key, $aws_version = '2009-06-01') { $host = 'ecs.amazonaws.com'; ...

MySQL Select Statement, WHERE 'IN' Clause

Hello, I currently have the following row in my table: course_data: user_id days <-- This is a varchar column. 405 1,3,5 and I am trying to implement the following SELECT statement: SELECT usrID, usrFirst, usrLast, usrEmail FROM tblUsers WHERE usrID NOT IN ( ...

Convert Bitmap Files into JPEG using the GD library in PHP

I have been trying to figure out a way to convert bitmap files into a JPEG using the GD library in PHP. I have tried numerous implementations but nothing seems to work. I have tried to tell my client that they should not use Bitmap files but he insists and quite frankly does not comprehend enough about computers to convert them to JPG ...

can $_FILES superglobal be accessible in class

Hello, Does anyone have experience with this I wanted to use $_files in my class like $Uploadfile= $_FILES['file']; but then the script errors I thought superglobals were acccessible anywhere thanks, Richard ...

Is ASCII "../" the only byte sequence that indicates a directory traversal in PHP?

I have a PHP app that uses a $_GET parameter to select JS/CSS files on the filesystem. If I deny all requests in which the input string contains ./, \ or a byte outside the visible 7-bit ASCII range, is this sufficient to prevent parent directory traversals when the path is passed to PHP's underlying (C-based) file functions? I'm aware...

some kind off variable problem within php class

Hello, I have this in my class When the second function is called php errors with wrong datatype and only variables can be past by reference. I don't know what they mean by that This code comes from php.net If the same code is outside the class it executes fine What am I doing wrong here, if I am working within a class? $extensiesA...

php timestamp time function. 2008 is larger number then 2009

I don't get it I want to calculate something I want to check if the time out of the database is before or after this time so I made this. $qVraagCodeOp = "SELECT * FROM `code` WHERE `Code_Code` = '$value'"; $rVraagCodeOp = mysql_query($qVraagCodeOp); $aVraagCodeOp = mysql_fetch_assoc($rVraagCodeOp); $oldTime = mktime($aVraag...