Code:
$exchangesnapin = "Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010";
$output = shell_exec('powershell '.$exchangesnapin.';"get-mailboxdatabase" 2>&1');
echo( '<pre>' );
echo( $output );
echo( '</pre>' );
Result:
Name Server Recovery ReplicationType
---- ------ -------- ---------------
Mailbox Database 0651932265 EGCVMADTEST False None
Mailbox Database 0651932266 EGCVMADTEST False None
I tried with
echo( $output[1] );
The result was only a letter 'N'. I believe its taking the Name column but one character at a time.
$output[1] is 'N', $output[2] is 'a'.
Is there any way I can get the mailbox list into array?
I want to do the following:
$a = array();
$a[] = array(1,2);
$a[] = array(2,5);
$a[] = array(3,4);
var_dump (in_array(array(2,5), $a));
this returns OK, as it expected, but if the source array is not fully matched:
$a = array();
$a[] = array(1,2, 'f' => array());
$a[] = array(2,5, 'f' => array());
$a[] = array(3,4, 'f' => array());
var_dump (in_array(array(2,5), $a));
it returns false. Is there a way to do it with the built-in way, or I have to code it?
The below code seems like it should work; however, the blob in the database only contains 0 after the function is run. Does the below code look accurate? If not how can I fix it?
$tmpName = $_FILES['picture']['tmp_name'];
$fp = fopen($tmpName, 'r');
$binary = fread($fp, filesize($tmpName));
fclose($fp);
$originalImage = imagecreatefromstring($binary);
$tempImage = imagecreate(100,100);
imagecopyresized($tempImage,$originalImage,0,0,0,0,100,100);
ob_start();
imageJPEG($tempImage);
$thumbnail = ob_get_contents();
ob_end_clean();
$wpdb->query("UPDATE ".$wpdb->prefix."items SET picture = $thumbnail WHERE id=$id'");
Thank :)!
Hi guys.. ok so i have the following array:
0 - 208533
1 - 208523
2 - 208522
3 - 208572
4 - 208518
5 - 208501
6 - 208534
7 - 208499
All i need is a quick function that'll start the array key at 1 rather than 0.
eg: 1 - 208533 etc
Any ideas?
Thanks!
Is it possible to know (serverside) the time it took for a file to upload? I have an image upload API and in my response I'd like to return the upload time (not including script execution time).
Hi,
I built a class that allows me to do:
$db->query($query);
and it works perfectly, although if I want to do:
$db->query($query);
while($row = $db->fetch_assoc()){
$db->query($anotherquery);
echo $db->result();
}
it "breaks" the class. I don't want to constantly have to redeclare my class (eg: $seconddb = new database()), is there a way to get around this? I want to be able to reuse $db within $db, without overwriting the "outside" db. currently I'm create an array of data (from db-fetch_assoc() then doing a foreach and then doing the db call inside that:
$db->query('SELECT * FROM table');
while($row = $db->fetch_assoc()){
$arr[] = $row;
}
foreach($arr as $a){
$db->query(); // query and processing here
}
Is this the best method or am I missing the obvious? Should I consider passing a connection link ID with the database connection?
Hi,
I am building a web site which supports IPhone also. Now I am quite confused as to find a way to upload the IPhone photos to my website.
Also it seems the "input type text" also doesnt work in IPhone. Have anybody worked on it....please suggest.
Hi everybody,
How could I make sure that the startProcess(); function is being called, but without halting the execution for myFunction(). I'll guess that there's a way to call a function and prevent it from returning it's value to thereby accomplishing this?
Pseudo-code:
function myFunction() {
startProcess();
return $something;
}
function startProcess() {
sleep(5);
// Do stuff that user doesn't should have to wait for.
}
Reading about Kohana templates and saw soemthing I've never seen before:
$this->template->title = __('Welcome To Acme Widgets');
What does __('Text') mean? What is it? What does it do?
Hi ,
Am working in the classes and object class structure , but not extream level ,
Just class and function , then in one place instantiation . that's it , not much big functions
like __construct etc ,
Please tell me very simply ,
1.what is th purpose of constructor ad destructor ,
But i know theoretical explanation school level ,
But i am expecting something like in real time , which situation we have to use, and is
there any example for that please tell me,
Regards
Hello,
I am trying to set up a navigation system that uses GET parameters with no value, example:
http://foo.bar/?mainPage
takes the visitor to the main page.
So I am using if statements and I am wondering if there is a way I can do this without a bunch of if statements? I don't think switch statements would work for this. This is currently what I have:
$mainPage = $_GET['mainPage'];
$contact = $_GET['contact'];
if(isset($mainPage)) {
// go to main page
}
if(isset($contact)) {
// go to contact page
}
I don't want to have to end up writing a ton of if statements, though. Any ideas?
Thanks.
Having a nightmare at the moment and just can't see why it isn't working
I have a value in the form H:i (ie 10:00, 13:30) etc called $time
What I want to do is create two new values, $startTime which is 30 mins before $time and $endTime which is 30 mins after $time
I have tried the following but just doesn't seem to want to work
$startTime = date("H:i",strtotime('-30 minutes',$time));
$endTime = date("H:i",strtotime('+30 minutes',$time));
If I pass through 10:00 as $time and echo out both $startTime and $endTime I get:
$startTime = 00:30
$startTime = 01:30
Hi,
How can I take a line like this:
Digital Presentation (10:45), (11:30), 12:00, 12:40, 13:20, 14:00, 14:40, 15:20, 16:00, 16:40, 17:20, 18:00, 18:40, 19:20, 20:00, 20:40, 21:20, 22:00, 22:40, 23:10, 23:40.
And match all the 24 hour times so I can convert to a more human readable format using date()?
Also I want to match times in the 24:00-24:59 range too
Thanks!
I see extra characters like â showing because of encoding issues as I found out here -
HTML encoding issues - "Â" character showing up instead of " "
I understand that if I set the browser meta encoding to UTF-8, these will not affect anything but I need to strip these extra characters from the database for other purposes.
For eg. :
Text: ↑ should be become Text: ?
But if I run it through utf8_decode it gives me Text: ???
For every other occurrence of the â character, it converts properly to a blank space. Any help will be appreciated.
I'm writing some code which processes a queue of items. The way it works is this:
Get the next item flagged as needing
to be processed from the mysql
database row.
Request some info from a google API
using Curl, wait until the info is
returned.
Do the remainder of the processing
based on the info returned.
Flag the item as processed in the
db, move onto the next item.
The problem is that on step # 2. Google sometimes takes 10-15 seconds to return the requested info, during this time my script has to remain halted and wait.
I'm wondering if I could change the code to do the following instead:
Get the next 5 items to be processed
as usual.
Request info for items 1-5 from
google, one after the other.
When the info for item 1 is
returned, a 'callback' should be
done which calls up a function or
otherwise calls some code which then
does the remainder of the processing
on items 1-5.
And then the script starts over
until all pending items in db are
marked processed.
How can something like this be achieved?
Hi,
I am working with classes and object class structure, but not at a complex level – just classes and functions, then, in one place, instantiation.
As to __construct and __destruct, please tell me very simply: what is the purpose of constructors and destructors?
I know the school level theoretical explanation, but i am expecting something like in real world, as in which situations we have to use them.
Provide also an example, please.
Regards
i want to create a table where first column have timing in below style
timing | user1 | user2 | user3
-------------------------------
9 AM | | |
10 AM | | |
. | | |
. | | |
. | | |
6 PM | | |
7 PM | | |
is it possible to use range() for creating timing list, if yes then please tell me , or if not then suggest me better method.
Thanks always
Hi all
I'm trying to write a function that could receive it's second arg a name of a function.
In order to validate function's name (that will be used in an eval statement) I use function_exists such as:
if(function_exists($type)){
$toEval= $type.'(\''.$file.'\');';
}else{
But if the arg sent is include or require (with 'once' variations) this code fails (function_exists returns false).
How could this be fixed?
Thanks,
Alex