
mbeals
Members-
Posts
247 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
mbeals's Achievements

Member (2/5)
0
Reputation
-
Thanks. strangely enough, just using a single file_get_contents() call worked perfectly. No clue why CURL was giving me so many problems.
-
I've fought with this on more than a few occasions. The issue is always with the server's configuration. ****I'm assuming Linux server here....no idea how to work it on a windows machine********** open up a second terminal and 'tail -f /var/log/syslog' then run the script. You should get some errors that point you in the right direction. Are you attempting to use sendmail or postfix? have you modified your php.ini file? Are you behind a firewall that blocks stmp traffic? I've had the most luck using postfix to relay the mail out.
-
I have some equipment at remote sites that is managed by an appliance with an HTTP interface. I'm working on an automated script to log into the HTTP interface and fetch the status of the attached equipment. The appliance uses GET based, plain text authentication (not the best, but we have it IP locked over a secure link). I can successfully connect to the appliance and fetch the HTML containing the info I need, but the session is hanging, and causing the appliance to lock out any other sessions for a period of time. I know the session is hanging, because I can watch is stuck in ACK-FIN with lsof. I think the problem is the session is being abandoned after the initial login and data fetch, so when I issue the logout command, it initiates a new session, leaving the old one hanging (making the appliance think I'm still logged in). This is the code that I'm using: <?php $IP = 'xxx.xxx.xxx.xxx'; $user = 'admin'; $pass = 'xxx'; $login = "UserID=$user&Pwd=$pass"; $info = "HeadendStatus.htm?"; $logout = "LOGIN.htm?LOGOFF=LOG+OFF&"; //Fetch Status $ch = curl_init("http://$IP/".$info.$login); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); $data = curl_exec($ch); //Log out curl_setopt($ch, CURLOPT_URL,"http://$IP/".$logout.$login); $result=curl_exec($ch); curl_close($ch); // Process data..... ?> So, any thoughts on how to simulate login->fetch data->log out with curl, or any other functions?
-
so I made a brand new page : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type='text/javascript'> function with_var(){ var img_tag = document.getElementById('image'); alert(typeof img_tag); alert(typeof img_tag.src); } function without_var(){ img_tag = document.getElementById('image'); alert(typeof img_tag); alert(typeof img_tag.src); } </script> </head> <body> <img src='images/lock.gif' id='image'> <a href='#' onClick='with_var()'>With Var</a> <a href='#' onClick='without_var()'>Without Var</a> </body> </html> and it works the same in both IE and firefox...no errors img_tag is a object and img_tag.src is a string. I put the same functions in my main script page and it dies. There has to be something else in there interfering. I guess I have some digging to do. Thanks for your help.
-
It's interesting though that it works in firefox and the the img tag is the only one that breaks. I have tried to declair them each time in the calling function, and the img tag still breaks: function test(){ img_tag = document.getElementById('img_1'); alert(img_tag.src); } This pukes in IE too (but not firefox). Change img_1 to an a tag, and all is good. edit.... apparently that dies, but function test(){ var img_tag = document.getElementById('img_1'); alert(img_tag.src); } does not. I was under the impression that declaring a variable without a 'var' statement inside a function made that variable a global. I think I'm going to do the returned array route though
-
in the actual code though that statement is part of a function. I also have other getElementById() calls for other objects (tr,a, etc) that work fine. Here's actual full code: function load_obs(){ wo_textbox = document.getElementById('wo_number'); wo_hlink = document.getElementById('wo_link'); wo_img = document.getElementById('wo_img'); } function change_button(style){ load_obs(); switch(style){ case 'edit': wo_hlink.setAttribute('onClick', 'wo_edit()'); wo_hlink.title = 'edit'; wo_img.src = 'images/edit.png'; break; case 'save': wo_hlink.setAttribute('onClick', 'commit_wo()'); wo_hlink.title = 'save'; wo_img.src = 'images/accept.jpg'; break; } } <a href="#" onClick='commit_wo()' id='wo_link' ><img src='images/accept.jpg' alt='accept' width='16' height='16' border='0' id='wo_img'/></a>
-
<script> var img_tag = document.getElementById('img_1'); alert(img_tag.src); </script> <img id='img_1' src='images/testimage.jpg' /> That's quick and dirty code that breaks. I could post everything, but I know it's a combo of that html img tag and that getElementById() call; [/code]
-
I have a script that changes the src attribute of an img tag. When I fetch the object reference through document.getElementById(), IE returns the error: "Object doesn't support this property or method" It works fine in firefox. Did MS discontinue the id property of img tags?
-
Sorry, I figured out a workaround, but I'm not completely happy with it. Basically I want to create an object that extends the p object such that when I append it as a child to another object (table cell), it treats it like a p object. here's some sample code: function button(type,id){ this.id = id; this.type = type; this.p_tag = document.createElement('p'); this.a_tag = document.createElement('a'); this.img_tag = document.createElement('img'); this.img_tag.width = 16; this.img_tag.height = 16; this.img_tag.border = 0; this.p_tag.appendChild(this.a_tag); this.a_tag.appendChild(this.img_tag); this.a_tag.setAttribute('href', '#'); switch(this.type){ case 'accept' : this.a_tag.setAttribute('onClick', 'accept('+this.id+')'); this.img_tag.src = 'images/accept.jpg'; this.img_tag.alt = 'accept'; this.img_tag.title = 'accept'; break; case 'cancel' : this.a_tag.setAttribute('onClick', 'cancel('+this.id+')'); this.img_tag.src = 'images/restart.jpg'; this.img_tag.alt = 'cancel'; this.img_tag.title = 'cancel'; break; case 'delete' : this.a_tag.setAttribute('onClick', 'del('+this.id+')'); this.img_tag.src = 'images/b_drop.png'; this.img_tag.alt = 'delete'; this.img_tag.title = 'delete'; break; case 'edit' : this.a_tag.setAttribute('onClick', 'edit('+this.id+')'); this.img_tag.src = 'images/b_edit.png'; this.img_tag.alt = 'edit'; this.img_tag.title = 'edit'; break; } } with this code I can do this: var cell = document.getElementById('cell'); var accept = new button('accept','button1'); var cancel = new button('cancel','button2'); cell.appendChild(accept.p_tag); cell.appendChild(cancel.p_tag); I would prefer this behavior: var cell = document.getElementById('cell'); var accept = new button('accept','button1'); var cancel = new button('cancel','button2'); cell.appendChild(accept); cell.appendChild(cancel); in which case the base 'button' class would really be an extension of the p class. Does that help?
-
I have a page that does dynamic database updates/queries via ajax. Part of this allows the user to click an edit icon in a table row, which switches that row into "edit mode". When I switch between modes, I change the layout of buttons (in the form of hyperlinked images) in the last cell. Each "button" consists of a p tag with a href child with an img child. I build each object individually, then use appendChild to nest them. Finally, I use appendChild again to assign the final "Button" to the cell in the table. To simplify this, I created an object that takes button type as an argument. I want to be able to do something like: var cell = getElementById('cell'); var accept = new button('accept'); var cancel = new button('cancel'); cell.appendChild(accept); cell.appendChild(cancel); I appologize for not having full code. My internet connection is currently down and I'm typing this up on by phone. I will post full code a little later if needed.
-
Email body empty in Gmail & body gets cut off in Mac exchange server
mbeals replied to freephoneid's topic in PHP Coding Help
did you take "Content-Transfer-Encoding: base64" out of the header too? poking around, I found two things that may be important here: 1. there is a limit on email line length (70 chars). So be sure to: $body = chunk_split( base64_encode( $body ) ); or $body = word_wrap($body,70); 2. I found issues with sending utf-8 encoded mail with mail(). Possibly remove that from the header. 3. I found numerous issues with gmail compatibility and lots of different 'tricks' browse through the comments in the man entry: http://us2.php.net/manual/en/function.mail.php that and googleing 'php mail() gmail' turned up a lot. good luck -
Email body empty in Gmail & body gets cut off in Mac exchange server
mbeals replied to freephoneid's topic in PHP Coding Help
my guess is something with the encoding. Try sending the mail with the body as plain text (ditch the base64_encode) and just see if it fixes the problem. -
this is cool technology and all and I think it definitely is where the future of portable devices is heading, but how easy would it be for someone to steal your power? Look at how easy it is to pick up stray wifi.... What's to stop my neighbor (in an apartment building) from connecting to my wireless grid that I happen to place too close to the shared wall?
-
I actually kind of figured it out: SELECT `orders`.*, progress.* from `orders` left join (Select `order`, COUNT(*) as attached from order_progress group by `order`) as progress on `orders`.id = progress.`order` WHERE attached < num_receivers"; Now the issue I have is if I have a record in `orders` and nothing that references that record in order_progress, the COUNT(*) returns NULL instead of 0, which breaks the logic in the WHERE statement.
-
I have an order tracking system. I have one table that has the details of the actual order, including the number or items being ordered. When we begin processing an item, an entry is created in a transaction table, linking the specific item to the order. IE: CREATE TABLE IF NOT EXISTS `orders` ( `id` int(11) NOT NULL AUTO_INCREMENT, `wo` int(11) NOT NULL, `customer` int(11) NOT NULL, `num_items` int(11) NOT NULL, `details` text NOT NULL, PRIMARY KEY (`id`); CREATE TABLE IF NOT EXISTS `order_progress` ( `id` int(11) NOT NULL AUTO_INCREMENT, `order` int(11) NOT NULL, `item` int(11) NOT NULL, `shipment` varchar(20) NOT NULL, `scanned` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `called` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `boxed` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`) I need a way to only pull the records from `orders` where the number of associated records in `order_progress` are less then the number in ordes.num_items.