Illegal Offset Type?

Jul 15, 2005

I am getting the following warning:

Warning: Illegal offset type in C:path on line 17

there is nothing on line 17, so I started looking back... everything lools fine. What am I missing? Code:


SimpleXMLElement And Warning: Illegal Offset Type?

Mar 2, 2011

Warning: Illegal offset type i have this var from an xml output

its give me
object(SimpleXMLElement)#11 (1) { [0]=> string(5) "Cairo" }

now i want make "Cairo" as a key to get its value like

$lang[] = array('Cairo' = "Cairo city");

the error appear when do this

echo $lang[$key];

and its give me the "Warning: Illegal offset type" because of the key is SimpleXMLElementhow i can make it normal var?

View 1 Replies View Related

Illegal Offset Type For Array. Object To Integer Convertion

Jul 27, 2006

The code is as ...

$folderlistfile = $path."xmlfile.xml";


<details id="2">
<details id="1003">


$list = simplexml_load_file($folderlistfile);

foreach($list as $sno=>$details) {
if($details->isdeletable) {
if($details->mainid) {

echo "<br /mainid = ".$details->mainid." : id =
".$details['id']." ";
$mainid = $details->mainid;
settype($mainid, "integer");

// I want to save the details in an array
//$listarr[$mainid][] = $details['id']; //Warning: Illegal offset
//$listarr[$details->mainid][] = $details['id']; //Warning: Illegal
offset type

echo, var_dump will output as follow ...

mainid = 0 : id = 2
object(SimpleXMLElement)#5 (1) { [0]= string(1) "0" }

mainid = 0 : id = 1003
object(SimpleXMLElement)#4 (1) { [0]= string(1) "0" }

Both of this generate the error : Warning: Illegal offset type

$listarr[$mainid][] = $details['id']; //Warning: Illegal offset type
$listarr[$details->mainid][] = $details['id']; //Warning: Illegal
offset type

and page doesn't execute furthur of this line.

I suppose it is because the array key is an object. How do I convert it
to integer.

print_r($details->mainid) displays SimpleXMLElement Object ( [0] =0
print_r($mainid) : nothing is displyed. even mainid = 0 : id = 2 is
not displayed.

System: free bsd, php 5

As is mentioned in the code, I want to craete an array as

$listarr[$mainid][] = $details['id']; //Warning: Illegal
offset type
$listarr[$details->mainid][] = $details['id']; //Warning:
Illegal offset type

View 1 Replies View Related

Warning: "Illegal Offset Type In <file Location>example.php"

Dec 17, 2010

I've been having considerable trouble trying to figure out why my arrays weren't working as expected. I was using code functionally the same as the code below, but it was silently failing on me in my program, so I wrote an isolated test case using the same types of data and syntax and got the errors about illegal offset types.

Warning: Illegal offset type in <file location>example.php on line 12
Warning: Illegal offset type in <file location>example.php on line 16

Those refer to the two lines containing the reference to "$questions[$question]" specifically.


I think I'm just beyond my skill level here, because while I can see the warning on [URL] that states "Arrays and objects can not be used as keys. Doing so will result in a warning: Illegal offset type.", I cannot see how what I'm doing is any different than Example #7 on that very page.

View 3 Replies View Related

Illegal Offset

Mar 8, 2007

I want to pass a class into an array, but I seem to be doing something illegal. here is the details

$characterListing = array($me=>$me->GetIsPlayer(), $him=>$him->GetIsPlayer());
error message: Warning: Illegal offset type in c:InetpubwwwrootMyProjectsSecondOfferinghtmlFns.php on line 133

How can I get around this?

View 5 Replies View Related

Illegal Offset Using Dynamic Variable?

Apr 3, 2011

I dont unserstand why do i get such errors:

Warning: Illegal offset type in
index.php on line 10 USD 1.4141
Warning: Illegal offset type in
index.php on line 10 JPY 118.56

Here's my code:

$xml = simplexml_load_file("eurofxref-daily.xml");
foreach ($xml->children() as $cubeMain) {


View 1 Replies View Related

Warning: Pack() [function.pack]: Type H: Illegal Hex Digit G In /code?

Jan 19, 2011

i am having some problems using pack() in php

$currencypair = "EUR/USD";
$buy_sell = "buy";
$alert_device_token =array("a","a","b");[code]...

Now sometimes i get following warnings running the same code -

Warning: pack() [function.pack]: Type H: illegal hex digit g in /code/FR2BVl

the illegal hex digit keeps varying though.

View 1 Replies View Related

Socket Server "Undefined Offset" And Wrong Resource Type E?

Apr 25, 2010

This is a continuation of the same script, but I have come upon a new error.If I have a client leave the server, the socket server goes crazy and starts looping extremely rapidly after firing off a series of errors about attempting to close the socket.If another client tries to join after this, then the "Undefined offset" error starts recurring again and again.

#!/usr/local/bin/php -q

View 1 Replies View Related

Change Current User Timezone Based On Server UTC Offset And User UTC Offset?

Apr 12, 2011

im writing a twitter web service in php. When a user signs in, i receive this node:


I have to change the script's timezone so that it adapts to the user's real timezone. The only php function i have found for this is: date_default_timezone_set($timezone_identifier) but it won't let me use -18000 as a the $timezone_identifier parameter.So, how can i change the current user timezone based on two values: Server UTC offset and User UTC offsetBTW, this is how i'm getting the server UTC offset value:

$this_tz_str = date_default_timezone_get();

View 2 Replies View Related

Illegal Offest

Aug 28, 2001

I have recently been writing a script which was running on a server with PHP3 installed. I finished the script and also decided I would use it with my other web site which has PHP 4 installed.

To make the change all I needed to do was update all references from .php3 and change them to .php including the name of the file. However when running the file I get the following errors.

Warning: Illegal offset type in /usr/local/etc/httpd/htdocs/testing/install.php on line 264

Warning: fopen("","w") - Undefined error: 0 in /usr/local/etc/httpd/htdocs/testing/install.php on line 265

Warning: Supplied argument is not a valid File-Handle resource in /usr/local/etc/httpd/htdocs/testing/install.php on line 267

Warning: Supplied argument is not a valid File-Handle resource in /usr/local/etc/httpd/htdocs/testing/install.php on line 268

The offending code is as follows:

View 10 Replies View Related

Illegal Characters

Jan 9, 2007

How do I check if a user has entered an apostrophe or other illegal characters in a form field? Below is my code... PHP Code:

if(!$field || $field == ''')
  $error_message['field'] = 'Please Remove Backslash or Apostrophe'

View 3 Replies View Related

Illegal Query

Jul 16, 2005

I'm kind of new to mySQL but more used to Sybase/PHP. What is illegal about this query or can i not use combined query's in mySQL?

DELETE FROM manufacturers
WHERE manufacturers_id NOT IN ( SELECT manufacturers_id
products )

View 1 Replies View Related

Removing Illegal Characters

Jul 17, 2005

I have an upload script for a photo and a caption. It all goes pear
shaped when I upload a character like ' " or / |
Is there anyway I can parse through the filename when submitting the
form and remove any illegal characters like this?

View 2 Replies View Related

Check For Illegal Letters

Jun 16, 2006

If user is asked for a username and password in a form. How would you do a check in PHP to make sure that username and password has no illegal characters such as, new line, tab, / or , *, -, ., ,,, ", ', so on.

View 8 Replies View Related

How To Prevent Illegal Distribution Of A PHP Script?

Sep 12, 2007

I wrote a script (payware) a few months ago and I discovered recently that there are a whole bunch of really bad people out there :) How can I prevent people from copying and distributing my script?

I had these ideas, but they all have a significant downsides:

1. Encrypt the php files

Pro :: This will secure the content of my files
Con :: A local component is needed on the server of the customer. I don't want to make the installation of the script more difficult so this is not an option for me.

2. Generate a unique key per customer and check the key on my server - Each script has a unique key and each time the script is executed, a check is performed on a database on my server.

Pro :: easy to implement
Con :: this could generate a lot of load on my server.

Are there any other options I missed? Who has experience with one of the above options?

View 1 Replies View Related

Illegal Characters In FDF File - Stream

Jun 13, 2007

I have been working on a php script lately that merges results from a db
and an xml source and then populates a PDF through FDF. I have gotten
nearly everything to work except multi line javascript. I have tried
both of the following attacks on the problem to no avail.

First I tried setting the set_on_import directly... then I tried to set
all the javascript in a function and then call the function on load...
both of them generate illegal characters in the stream.

Both of these examples are in a for each that contain a $counter:

$js = 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "";
$js .= 'this.getField("moveinready.' . $counter . '").display =
display.visible;' . "";



View 3 Replies View Related

Escape Illegal Chars In .ini-files?

Mar 29, 2010

The documentation on parse_ini_file states that you can't use these chars {}|&~![()^" in the value. Is there some way to escape these chars? I need to use them. Normal escaping with doesn't seem to work.

View 1 Replies View Related

Remove All Of The Illegal Characters Globally

Jun 2, 2010

I've recently written a javascript RegExp to cleanse my data at the front end, I now need to do exactly the same for my PHP back end but not having worked in PHP for a while I'm having trouble.

var illegalChars = /[()<>,;:.~@#$!\%^&*'?()+={}`\/"[]]/gi;
var siteSuggest = $(this).val().toUpperCase().split(' ').join('').replace(new RegExp(illegalChars), "");

So, in summary, I want to remove all of the illegal characters globally, remove spaces & capitalize the variable as the variable will be used to create a database or table in sql.

View 2 Replies View Related

Removing Illegal Characters From MySQL?

Jun 10, 2011

I use the following php to make sure people can't use illeagal characters in thier username.

PHP Code:

if(!ctype_alnum($username)) {

However, if users have already added non numerical characters including spaces in thier username how would i remove them via PHP or MySQL command. This is rather than doing it manually as I have many members on my site and I don't feel like going through them all.

View 5 Replies View Related

Strip Illegal Characters RSS Feed?

Aug 18, 2010

I've generated an RSS Feed using PHP, but I need to strip all illegal characters.The strings will be in French, so minimum there are the accents. I could get rid of them by replacing the accented characters by non-accepted characters, but there may be others characters that I won't be testing for.

View 2 Replies View Related

Function To Escape Illegal Characters

Jun 27, 2007

I have a query that I am populating a drop-down menu with. I need to escape illegal characters, but I'd like to separate it out from the page. Code:

View 2 Replies View Related

Checking For Illegal Characters In An Input?

May 18, 2011

I am looking for the best way to ensure that any illegal characters are removed from an input.I have a user registration form and login page. What I want to do is prevent against sql injection and therefore should be limiting the characters that can be entered. For example I want a username to include only letters and numbers so I ideally want to strip out any white space, illegal characters such as " ' ( ) etc...My issue with this is with the password, I would ideally like the user to be able to put as complex a password as they would like, so how would i prevent against illegal characters in this instance??

View 6 Replies View Related

This Program Has Performed An Illegal Operation And Will Be Shut Down

Apr 25, 2003

I have installed an Apache web server on my Windows 98 desk top. I use this server to test PHP/MySql scripts. I access these scripts located on my C: drive with an alias defined in httpd.conf.

On my browser I use http://localhost/alias/..... or to serve my pages.

I have recently set up a router to share my internet connection between two computers. The other computer does not have Apache, PHP or MySql installed.

Last night I started getting the following error when accessing php scripts which appears randomly.

"PHP This program has performed an illegal operation and will be shut down"

I tried to call the scripts using my machines IP, disconnected the router and recreated the database but still get the error. I'm not sure if this is an Apache, Lan or PHP problem.

View 5 Replies View Related

PHP Input Checking - Checks For Illegal Characters

Apr 26, 2006

I have a HTML form where the user can type in certain values, but I
only want them to able able to submit integers (0-9). I post to a PHP
page with the following "snippit" of code (all the variables have been
properly assigned):

// Checks for illegal chars
$illegal_chars = array("`", "~", "!", "@", "#", "$", "%", "^", "&",
"*", "(", ")", "-", "_", "=", "+", "q", "w", "e", "r", "t", "y", "u",
"i", "o", "p", "[", "{", "]", "}", "", "|", "a", "s", "d", "f", "g",
"h", "j", "k", "l", ";", ":", "'", """, "z", "x", "c", "v", "b", "n",
"m", ",", "<", ".", ">", "/", "?");
foreach ($illegal_chars as $value) {
if (stripos($db_mysql, $value)) { $pass1 = "f"; }
elseif (stripos($db_postgre, $value)) { $pass2 = "f"; }
elseif (stripos($db_oracle, $value)) { $pass3 = "f"; }
elseif (stripos($email_basic, $value)) { $pass4 = "f"; }
elseif (stripos($email_exchange, $value)) { $pass5 = "f"; }
elseif (stripos($ftp_users, $value)) { $pass6 = "f"; }
elseif (stripos($domain_subdomains, $value)) { $pass7 = "f"; }
else {}

The code will not work, and I can't see why. The variables $pass1-pass7
aren't set after the foreach() loop, no matter what is in the input!

View 5 Replies View Related

File Uploading With Illegal Characters On The Filename

Sep 14, 2005

I'm creating a file uploading system for a project, and I came across this problem: whenever I upload a file that has a filename containing illegal characters, it truncates the filename from the instance of the illegal character onwards, so, in effect, the filename 'birdie's-heart.jpg' ends up as 's-heart.jpg' when it's uploaded.

Am I missing something?

View 14 Replies View Related

Sends The Email Successfully Even If There Is Illegal Charactors?

Aug 8, 2007

The remaining 2 problems are even though it validates the email address with preg_match and echos an error, it still sends the mail and it checks for invalid charactors but (you guessed it) it still send the mail.

The script works fine, it checks if email, name and subject are filled out and if not writes an advice on the page.

It also checks for illegal charactors and correctly formed email address and writes the error message correctly.

The problem is that it sends the email successfully even if there is illegal charactors and/or malformed email address, in other words it knows about the problems but doesn't prevent the email being sent. Code:

View 5 Replies View Related

Kohana V3, Automatically Escape Illegal Characters?

May 2, 2010

Quick question, does Kohana (version 3) automatically escape data that is passed into ORM::factory..... (and everywhere else that has to do with the database)?For example:

$thread = ORM::factory('thread', $this->request->param('id'));

Would the data passed in the second argument be auto-escaped before it goes in the SQL query or do I have to manually do it? Probably a stupid question and it's better to be safe than sorry, but yeah... I usually do manually escape the data, but I want to know if Kohana does this for me?

View 1 Replies View Related

Output Error Message For Illegal Values?

Oct 15, 2009

I want to make the database output an error message when a user puts a phone number in a form which is too long (>20 char) but its not working. This is my code:

Quote: <html>
<head><title>Sample Form Response</title></head>

View 3 Replies View Related

Protecting Input Fields From Illegal Characters?

Apr 3, 2011

I'm working on this site which I'll soon ask the guys in the testing forum to have a peek at.† It's essentially an online community that was a uni project that has spiraled and grown exponetially.I've spent many many hours in front of books and tutorals etc to put it together and as far as scripting goes, it seems to be fine.† The problem i'm having...The tut's that I read / watched were using eregi_replace to protect text fields and this is now unsuported.I want my site to be as secure as it can be, within reason.I've tried using preg_replace instead and have searched for the syntax but i keep getting strang results.I'm working on the "bio" field at the moment and then when that works I can move on and a-ply the same idea to the other fields.This si what I have and what I've changed.

if ($_POST['parse_var'] == "bio"){
$bio_body = $_POST['bio_body'];
//$bio_body = str_replace("'", "&#39;", $bio_body);† (WAS TESTING THIS BUT NO JOY)


View 7 Replies View Related

Illegal Command Error Code 127 In Exec Function

Jan 13, 2009

I am using this php code:

exec("unrar e file.rar",$ret,$code);

and getting an error code of illegal command ie 127 ... but when I am using this command through ssh its working ... because unrar is installed on the server ... so can anyone guess why exec is not doing the right stuff?

View 5 Replies View Related

Checking String For Illegal Characters Using Regular Expression?

May 18, 2009

I want to check a for any illegal character using the following regular expression in PHP. Essentially, I want to allow only alphanumeric and underscore (_). Unfortunately the follow piece of code does not seem to work properly. It should return true if there is any illegal character in the string $username. However, it still allows any character in the string.

if ( !preg_match("/^[-a-z0-9_]/i", $username) )
return true;

View 5 Replies View Related

Regular Expressions Error :: Illegal Mix Of Collations (utf8_general_ci,IMPLICIT)

Apr 23, 2005

Are mysql regular expressions supported in PHP 5.03? I've run the query via PHP and got an error, but the query works fine when put straight into mysql. I've not come across this error message before and don't know how to get around it, but I have heard about some incompatibility issues. Here's a sample query output from PHP:

SELECT prodName FROM tProducts WHERE `prodName` REGEXP '[[:<:]]chair[[:>:]]'

and the error:

Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'regexp'.

View 1 Replies View Related

Illegal Token Error While Decoding JSON On Zend Framework?

Oct 19, 2010

Im running this example given on zendcasts and i seem to be getting a "Illegal Token" error.


View 1 Replies View Related

#1267 - Illegal Mix Of Collations (latin1_swedish_ci,IMPLICIT) And (utf8_unicode_ci,COERCIBLE) For Operation 'like'

Jun 14, 2011

In my MySQL database I have encoded users in latin1_swedish_ci (bad idea). Now I connect my iPhone application to Facebook and retrieve the list of friend names, and I would like to see if I already have these friends in my application. Sadly when I try to do the query I get this error:

#1267 - Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_unicode_ci,COERCIBLE) for operation 'like'

I try to mix the Facebook friend's name (in utf8) with the names in my dabatase (latin1). I don't want to migrate the whole database to utf8, I just would like to know if it's possible in PHP to check if the name encoding is compatible with latin1, or at least if it's possible to encode all the names in latin1 and do the query, and if not just skip the name.

View 1 Replies View Related

Detected An Illegal Character In Input String When Reading Xls File And Converting It Into Csv?

Jul 13, 2011

I am getting error iconv() [function.iconv]: Detected an illegal character in input string when i am reading xls file and converting it into csv. I am using php-excel-library and i get this error in line:

case 'iconv' :
$result = iconv('UTF-16LE', $this->_defaultEncoding, $string);

View 1 Replies View Related

Make A Function That Returns True If The Supplied String Contains Illegal Characters?

Sep 23, 2010

Here's my code:

I'm trying to make a function that returns true if the supplied string contains illegal characters, or false otherwise.

I can't get it to work. Could someone please comment?
Code: [Select]<?php


View 3 Replies View Related

Spoof A Form Value In Drupal 6 From A Custom Module Without Throwing An Illegal Choice Error?

Jan 20, 2011

I have a website that uses a View with exposed filters and the Finder module to search for jobs. One of the criteria is salary range, which is displayed in British Pounds in a select box with 4 options. However, the client has asked for an option that allows the user to display a different currency.I have created a module that allows a user the select a different currency, which in turn sets a session variable containing a currency value. When the user views a page containing either the Finder search form or the Views exposed filter, Drupal adds some JQuery which changes the visible values of the select box based on the value of the session variable. However, it does not change the actual values of the select options - only what the user can see. Unfortunately this method throws the "illegal choice has been detected please contact the site administrator" error, obviously because the posted form array doesn't match the form array stored by Drupal. So the question is, how can I stop this error from occurring? I was thinking of the form values being reset by JQuery just before submit, although I'm not sure how I would change the values between the user clicking the submit button and the form actually being submitted. Another choice is perhaps hook_form_alter to change the form values, but I'm not exactly sure if this would work either.

View 1 Replies View Related

Require A From To Submit Input Type - Image For A JQuery Type Form Submission?

Feb 23, 2010

I have two images, that I am using their value to insert into a db table. Do I Require a form or can I do without one.

<form name="form1" id="form1" method="post" action="save.php"><input type="image" src="images/test.png" border="0" id="star_image" value="<? echo $some_value; ?>" /></form>
<form name="form2" id="form2" method="post" action="save.php"><input type="image" src="images/test1.png" border="0" id="star_image1" value="<? echo $some_value1; ?>1" /></form

Would the above trigger the below jQuery code



insert into table (field) values('value')

View 3 Replies View Related

Files Type Checking / Check The File Type And It Couldn't Pass Through?

Apr 10, 2011

Some weird case when I tried a simple php code to check the file type and it couldn't pass through. Any mistake from the below code ?

echo "File must be in format of jpeg,gif or png.";

View 4 Replies View Related

Determining A Local Files Mime Type (Content-type) ?

Mar 16, 2010

I am trying to determine a file's mime type. I've tried a few methods, but haven't come up with anything that gives consistent output. I've tried $mime = mime_content_type($file) and $mime = exec('file -bi ' . $file). I am serving up images, CSS, and JavaScript.

Example mime_content_type() output:

jquery.min.js - text/plain
editor.js - text/plain
admin.css - text/plain
controls.css - application/x-troff
logo.png - text/plain


View 1 Replies View Related

Form Type=submit Vs Type=image

Jan 28, 2000

I'm wanting to create a form with quite a few SUBMIT buttons that use an image rather then the stock (plain grey) button. Everything works fine when I use this line:

print "<INPUT TYPE="submit" NAME="editaction" VALUE=$id>";

I know which SUBMIT button was pressed by checking the value of $editaction in the receiving page. Now if I replace that line with this one:

print "<INPUT TYPE="image" SRC="icon.gif" NAME="editaction" VALUE=$id>";

I no longer get a value in $editaction. I know about $editaction_x and $editaction_y. Is there no way get to the 'VALUE' (from the VALUE=$id part) as well? Am I missing something? Has the variable name been modified to somthing like $editaction_value?

TIA for any light you can shed.

View 6 Replies View Related


Jul 16, 2006

When a search is performed on any query in my database the results show correctly to page limit and new offset, except when searching "country". It shows the first page correctly and the next page does not show newoffset, it shows entire content of "country" Code:

View 4 Replies View Related

Force Type And Content Type?

Oct 11, 2010

I have a folder with some sql files that I would like to be processed as PHP and I would like the output to be text/plain. I can force sql files to be processed by PHP like this:

<FilesMatch ".sql$">
ForceType application/x-httpd-php

Is there a way I can set the default content-type when these files are served to be text/plain? Or will I have to use the header thing in the files?

View 1 Replies View Related


Jun 1, 2010

I have noticed that when using a SUBMIT type its name attribute gets passed via POST , while an IMAGE type button do not have this data sent, can any one clear this up for me? In both instances the NAME attribute is present at HTML level, but only the SUMBIT type has the NAME sent via this right?

View 2 Replies View Related

Undefined Offset: 3

Aug 28, 2007

When I run the script below I get an "unefined offset" error, but nothing appears wrong with my code. Could there be something wrong with the way my PHP is setup? PHP Code:

View 9 Replies View Related