Illegal Offset Type?

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:



ADVERTISEMENT

SimpleXMLElement And Warning: Illegal Offset Type?

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

var_dump($key);
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

The code is as ...

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

/*

<list>
<details id="2">
<name>Books</name>
<mainid>0</mainid>
</details>
<details id="1003">
<name>CDs</name>
<mainid>0</mainid>
</details>
</list>

*/

$list = simplexml_load_file($folderlistfile);

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

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

// I want to save the details in an array
//$listarr[$mainid][] = $details['id']; //Warning: Illegal offset
type
//$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" }
UNKNOWN:0

mainid = 0 : id = 1003
object(SimpleXMLElement)#4 (1) { [0]= string(1) "0" }
UNKNOWN: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

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

View 1 Replies View Related

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

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.

[Code.........]

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

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?

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:

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

[Code]...

View 1 Replies View Related

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

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?

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
<?php
error_reporting(E_ALL);
[code].......

View 1 Replies View Related

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

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

<utc_offset>-18000</utc_offset>

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();
[code]....

View 2 Replies View Related

Illegal Offest

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

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

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
FROM
products )

View 1 Replies View Related

Removing Illegal Characters

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

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?

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

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;' . "";
fdf_set_on_import_javascript($fdf,$js,true)

and

..........

View 3 Replies View Related

Escape Illegal Chars In .ini-files?

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

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?

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

PHP Code:

if(!ctype_alnum($username)) {
header("register.php?terms=accepted&error=usernamenotallowed");
}

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?

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

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?

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

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 http://127.0.0.1/alias/..... 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

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

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?

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?

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?

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>
<body>
[code]......

View 3 Replies View Related

Protecting Input Fields From Illegal Characters?

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)

[code]...

View 7 Replies View Related

Illegal Command Error Code 127 In Exec Function

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?

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







Copyrights 2005-15 www.BigResource.com, All rights reserved