PHP - Invalid State Error
I have a class (P3TElement) that extends the DOMElement class in PHP. In there i have a public variable "attributes" which is an array, and an method named add_attribute($attr), the argument is a different class (P3TAttribute). However I am getting an error when trying to use it.
The exact error is: Warning: P3TElement::add_attribute() [p3telement.add-attribute]: Invalid State Error in D:\www\p3textract\extract.php on line 110 Please see the code: http://pastebin.com/CbsM9V5W This class is supposed to extract .p3t (ps3 themes) files, and is a direct port of the python equivalent found at http://p3textractor.googlecode.com/svn/trunk/p3textractor.py Could you please help me fix this? thanks in advance, Hosh Similar TutorialsI am able to connect to my AD server successfully. This server serves multiple domains. Example is user1@dom1.dom.net is able to successfully bind. user2@dom2.com is not able to bind but gets error 49: invalid credentials. Using windows ldp.exe, I can connect successfully, then select bind from the connection menu, enter the username (user2), the account password, and the Domain (dom2.com) and the result indicated is successful. Using php I attempt to bind using: $adBind = ldap_bind($ad, $adUname, $ldappass); Where $ad = successful connection resource, $adUname = user1@dom1.dom.com OR user2@dom2.com, $ldappass is the account password. As user1 it is successful, with user2 it is unable to bind with error 49. Any suggestions or help is greatly appreciated. Thanks in advance! Hi sorry for the trouble guys but i'm really stuck on this one, and i've tried everything i can. (I've been using php only for sometime now) I'm stuck at this code and can't figure out why this is failing. Objective of the script : To try and include BOTH files or throw and exception if even one fails. I tried : Including just one at a time. Its fine, so i know the path is correct. I tried a if (! (expr1 && expr2) ) statement to check if the syntax is correct to create a everything or nothing logic. $offlineLibraryPath = '/var/www/common/lib'; // Attempt to include the files try { if(! ( require_once($offlineLibraryPath.'/variables/all.php') && require_once($offlineLibraryPath.'/functions/all.php') ) ) { throw new Exception ('Including all the common library files failed.'); } } catch (Exception $e) { echo '<b>Error</b> :'.$e->getMessage(); } I get this error : Warning: require_once(1): failed to open stream: No such file or directory in /var/www/common/lib/startupIncludes.php on line 18 Fatal error: require_once(): Failed opening required '1' (include_path='/var/www/common/lib/: /var/www/culturesque/lib/: /var/www/mine/lib/') in /var/www/common/lib/startupIncludes.php on line 18 Thanks in advance for the help! I have a web service that queries an Oracle database and then returns a struct. If there is any error on my side, I still reply the struct, except it is populated with differnt values. If I change the coding in my error handling to return the struct populated with the error values, then it returns fine, but if I simulate an ORACLE error (use the incorrect passoword for example) I get the following error: "XML error parsing SOAP payload on line 2: Invalid document end" Any suggestions? Is there a way that I can display the "SOAP Payload" to see what is missing? The following extract from my code: <<<< <?php require_once('../NuSoap/lib/nusoap.php'); date_default_timezone_set('Africa/Johannesburg'); $server = new soap_server(); $server->configureWSDL('oracle_err', 'urn:oracle_err'); $server->wsdl->addComplexType('ReturnRecords', 'complexType', 'struct', 'all', '', array( 'FirstVal' =>array('name'=>'FirstVal' , 'type'=>'xsd:string'), 'SecondVal'=>array('name'=>'SecondVal', 'type'=>'xsd:string'), 'ThirdVal' =>array('name'=>'ThirdVal' , 'type'=>'xsd:string'), 'FourthVal'=>array('name'=>'FourthVal', 'type'=>'xsd:string'), 'FifthVal' =>array('name'=>'FifthVal' , 'type'=>'xsd:string'))); $server->wsdl->addComplexType('RecordStatus', 'complexType', 'struct', 'all', '', array( 'ErrStatus'=>array('name'=>'ErrStatus', 'type'=>'xsd:string'), 'FaultReason'=>array('name'=>'FaultReason', 'type'=>'xsd:string'), 'RowsFetched'=>array('name'=>'RowsFetched', 'type'=>'xsd:decimal'))); $server->wsdl->addComplexType('ReturnArray', 'complexType', 'array', 'all', '', array(), array('RntRecs'=>array('name'=>'RntRecs','type'=>'tns:ReturnRecords[]'), 'RecStat'=>array('name'=>'RecStat','type'=>'tns:RecordStatus'))); $server->register('oracle_err', array('InputParam' => 'xsd:string'), array('return' => 'tns:ReturnArray'), 'urn:oracle_err', 'urn:oracle_err#oracle_err', 'rpc', 'encoded', 'Testing Oracle connection.'); function oracle_err($InputParam) { //The connection details to make the database connection. require_once('cdbCred.php'); $date_stamp = date('M_d'); $db_results = array(); $results = array(); $LogFile = $log_dir . "Oracle_error_" . $date_stamp . ".log"; $record_size_limit = 64; //To control the size of the return array. $fptr = fopen($LogFile, 'a') or die("can't open file"); $sys_time = date('omd H:i:s'); fwrite($fptr,"\n\n***************************************\n"); fwrite($fptr,"* PHP - Start Time - ". $sys_time . "*\n"); fwrite($fptr,"***************************************\n"); fwrite($fptr,"PHP - IN WEB Service oracle_err()\n"); fwrite($fptr,"PHP - Source code - oracle_err.php\n"); //**** SETTING UP THE RETURN STRUCT variables **** $sys_time = date('omd H:i:s'); $rows_fetched= 0; $fault_reason= ' '; $error_status = 0; $tempArray = array('FirstVal' => "0", 'SecondVal' => "0", 'ThirdVal' => "0", 'FourthVal' => "0", 'FifthVal' => "0"); fwrite($fptr,"PHP - RECIEVED DATA\n"); fwrite($fptr,"PHP - InputParam =[". $InputParam ."]\n"); fwrite($fptr,"\n") ; $conn = oci_connect($user_name, $user_pswd, $user_database); if (!$conn) { $e = oci_error(); fwrite($fptr, "oci_error=[". $e['message'] . "]\n"); $rows_fetched= 0; $fault_reason= "Error - CONNECTING to ORACLE database.[" . $e['message'] ."]"; $error_status = 1; fwrite($fptr,"PHP - " . $fault_reason . "\n"); $reply_status = array('ErrStatus'=>$error_status, 'FaultReason'=>$fault_reason, 'RowsFetched'=>$rows_fetched); $RtnArray = array('RntRecs' => $tempArray, 'RecStat' => $reply_status); fwrite($fptr,"PHP - LEAVING THE PHP - " . date('omd H:i:s') . "\n"); fclose($fptr); return $RtnArray; } else { fwrite($fptr,"PHP - Connection to the ORACLE database successfull.\n"); } //*********************************************************** // LOADING the reply struct. //*********************************************************** $tempArray = array('FirstVal' => "FIRST", 'SecondVal' => "SECOND", 'ThirdVal' => "THIRD", 'FourthVal' => "FOURTH", 'FifthVal' => "FIFTH"); array_push($results,$tempArray); $tempArray = array('FirstVal' => "ONE", 'SecondVal' => "TWO", 'ThirdVal' => "THREE", 'FourthVal' => "FOUR", 'FifthVal' => "FIVE"); array_push($results,$tempArray); $reply_status = array('ErrStatus'=>$error_status, 'FaultReason'=>$fault_reason, 'RowsFetched'=>count($results)); $RtnArray = array('RntRecs' => $results, 'RecStat' => $reply_status); fwrite($fptr,"\n"); fwrite($fptr,"PHP - DISCONNECTING from ORACLE.\n\n"); oci_close($conn); fwrite($fptr,"PHP - LEAVING THE PHP - " . date('omd H:i:s') . "\n"); fclose($fptr); return $RtnArray; } $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> AND the call to the web service: <?php // Pull in the NuSOAP code require_once('../lib/nusoap.php'); date_default_timezone_set('Africa/Johannesburg'); $client = new nusoap_client('http://myserver/web/services/oracle_err?wsdl'); echo 'ORACLE ERROR simulation... <br>'; $input_parameter = "1"; $result = $client->call('oracle_err', array('InputParam'=>$input_parameter)); echo 'Back at the client<br>'; echo 'Result=['. $result .'] <br>'; echo 'Count of Result='. count($result) . '<br>'; if ($client->fault) { echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>'; } else { $err = $client->getError(); if ($err) { echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>'; } } echo 'END'; ?> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=319071.0 I'm getting an invalid argument error for my While loop. I can't figure out why. Code: [Select] $sql="SELECT * FROM schools ORDER BY class DESC,sectional ASC,team ASC"; $results = mysql_query($sql); while ($team = mysql_fetch_assoc($results)) { echo $team['school'] . '<br>'; } Here is the error: Quote Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/******/public_html/hoosierhoopsmagazine.com/resources/sectional_assignments.php on line 7 I added <?php $_menu = ''?> <?php foreach ($this->getStoreCategories() as $_category): ?> <?php $_menu .= $this->drawItem($_category) ?> <?php endforeach ?> <?php if ($_menu): ?> <div class="nav-container"> <ul id="nav"> <li class="level0 first nav-home"><a href="<?php echo $this->getUrl() ?>"><span><?php echo $this->__('Home') ?></span></a></li> <?php echo $_menu; ?> <li class="level0 nav-1 parent"><a href="<?php echo $this->getUrl('contacts')?>"><span><?php echo $this->__('Contact') ?></span></a></li> <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('menu')->toHtml() ?> </ul> </div> <?php endif; ?> to top.phtml and it works as expected, I now have CMS links in my nav but how can I make them have active state like the category links do?? here is the site: http://pro-tools-training.com/new-magento/index.php/video-1.html Is there a way, and if so how would I detect the state of the user on my site. Like by using their ip? Thanks! Hi I'm hoping someone can point me in the right direction. I'm trying to create a single page that contains a couple of checkboxes. When the first checkbox is checked I want to set a session. When the second chechbox is checked I want to set a different session. When the page submits ( to itself ) I'd like the checkboxes to reflect if they are checked or not. I can sort of do that part,but I'm having major issues with unsetting the sessions and updating the checkboxes to reflect this. Does anyone have a simple example on how to do this. Many Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=312305.0 Any help on this would been very much appreciated. I am trying find a way to save the state of the JQuery accordions on my webpage after a user refreshes or changes webpages within my website. I have tried installing different scripts and downloading different cookie plugins but they either don't work or breaks all of the jquery functions on my webpage. Thank you.
This is in my header
<head> <link rel="stylesheet" type="text/css" href="css/styles.css"> <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"> <script src="js/jquery.js"></script> <script src="js/jquery-ui.js"></script> <script type="text/javascript" src="Cookies/jquery.cookie.js"></script> </head>My Html <div id="History"> <!---Images---> <p>Today In History</p> <div> <script type="text/javascript" src="http://rss.brainyhistory.com/link/historyevents.js"></script><small><i>more <a href="http://www.brainyhistory.com/" target="_blank">History</a></i></small> </div> </div>This is my original JQuery code $( "#History" ).accordion({ collapsible: "true", heightStyle: "content" }); Code: [Select] <div id="nav"> <ul> <li class="item"><a href="/">Home</a>/</li> <li class="item"><a href="/one">one</a></li> <li class="item"><a href="/two>two</a></li> <li class="item"><a href="/three">three</a></li> </ul> <div> i want to add class='active' to the a tags . when the menu is the current page. namely.when i on the home page. the a label is Code: [Select] <li class="item"><a href="/" class="active">Home</a>/</li> .but the others a label are not have class="active". when i on the one page. it is is Code: [Select] <li class="item"><a href="one" class="active">one</a>/</li>.the others a label are not have class="active". In this report I want to create a line break and a Total line for each State.
while ($row = odbc_fetch_array($result)) { echo "<tr><td>" . $row['cmlstate']."</td>"; echo "<td>" . $row['cmlpostcode']."</td>"; echo "<td>" . $row['cmlcity']."</td>"; echo "<td>" . $row['ompSalesOrderID']."</td>"; echo "<td>" . $row['cmoName']."</td>"; echo "<td>" . number_format($row['UOMPVOLUMETOTAL'],2)."</td>"; echo "<td>" . number_format($row['UOMPTOTALBOXCOUNT'],0)."</td>"; echo "<td>" . $row['Hold']."</td></tr>"; I want to sum 'UOMPVOLUMETOTAL' for each state and create a line break between it and the next state. }
I've got 2 database tables (states, stores) and I want to output all the states with a list of specific locations under each state. My 'states' table has a 'state_id' and 'state' while my 'stores' table has all the store information along with the 'state_id' to work with the 'states' table. How would I ago about formulating a loop to display all locations organized by each state, etc.? How can I prevent someone from making an ivalid selection in a form? Lets say I had a select dropdown box and someone saved the HTML source from the browser, changed an item in the list, and changed the action to point back to my server eg. action="testsite.com/index.php". Then they open the file and try to submit the form.
This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=345840.0 Am new to php... I have been battling on my dynamic checkboxes in such a way that if none is checked the form is return, also I need to retain what was checked when the form postback due to other invalid inputs. Code: [Select] $result = mysql_query("SELECT * FROM course") or die(mysql_error()); if ($result) { while ($row = mysql_fetch_array($result)){ if (isset($_POST['courses']) and $_POST['courses'] == $row['cid']) {echo $row['cid'];} print "<input type=\"checkbox\" name=\"courses[]\" value=\"$row[cid]\">$row[cname]\n"; } } Help needed purely on php codes. Thanks in advance Hello, mates! I am new to PHP. I want to store some data shared between requests. I know that it is possible with memcached and shared memory in Unix. What ways to do it could you advice? How could I realize background service in PHP? Thank you.
Hi all, great forum so far. Am new so hope I find my way around ok. I have been working on a site that uses mysql to store the info and then php to talk to mysql. Basically the site has a custom build CMS (I'm learning). I have created a dynamic subnav in my page where entries can be added or removed in the admin area for the site. Here is the code that pull the info etc. How can I set an active state for nav? Each sub nav link dynamically created the href. I need to find if the url is the same as the href for each subnav link. If it is then add a class called .active to that li item only. Hope that makes sense? any help would be great thank you, Code: [Select] $subnav = new DataConn; //connection to database with my classes file $subnav->query("SELECT * FROM stock_categories ORDER BY category_order"); $currCatID = 0; $currCatTitle = ''; $i = 1; ?> <ul class="subnav"> <?php while($rs_subnav = mysql_fetch_array($subnav->result)) { if ($i == 1) { $currCatID = $rs_subnav['category_id']; $currCatTitle = $rs_subnav['title']; } ?> <li><a href="stock-list.php?cat=<?php echo $rs_subnav['category_id']; ?>"><?php echo $rs_subnav['title']; ?></a></li> <?php $i++; } ?> </ul> hey guys just wondering what u think the best way to do this.....on my form registration for users....I have a drop down for countrys....but I dont want to have 2 drop downs 1 for state and 1 for province if they choose canada/usa....I have seen alot of java scrit on such sites where if you choose Canada for country, then it switches to a drop down for just provinces, not states. Same for zip code/postal code...american zip code would be like 90210 where as a postal code would be like n5j2S1. Is there a script or something already I can use with all the countrys/provinces/states etc already entered so im not re-inventing the wheel here? If someone can point me in right directon id appreciate it. Thanks Hi, I've been looking at this for a couple of hours and it's killing me a little inside. I've butchered a few pieces of code from various sources together and come up with this. I understand how it's supposed to work (or i'm pretty sure i do) but the foreach statement is giving me the following error: Warning: Invalid argument supplied for foreach() /document/etc/etc on line 80 Obviously the offending statement is this one: Code: [Select] <?php // Check if button name "Submit" is active, do this if($_SERVER['REQUEST_METHOD'] == "POST") { foreach($_POST['id'] as $id) { $update="UPDATE users SET firstname='" . $_POST["firstname".$id] . "', lastname='" . $_POST["lastname".$id] . "', email='" . $_POST["email".$id] . "', password='" . $_POST["password".$id] . "', adminid='" . $_POST["adminid".$id] . "' WHERE id='" . $id . "'"; $result = mysql_query($update); echo "Updated"; } } ?> Not a clue what the problem is atm. If someone could either tell me or point me in the right direction i'd appreciate it/ Reece |