Jump to content

andyd34

Members
  • Posts

    118
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

andyd34's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Just a quick note, Ive just tested in firefox and everything is working fine. When testing in Chrome and IE its throwing the error
  2. Thanks for the replies, i think i've found the main issue. its all part of an automation process Subdomain Creation Database User Creation Database Creation User added to database Database tables added Files moved to subdomain when i've split everything up i'm getting a server 500 EMPTY_RESPONSE error on steps 2, 3 and 4. $this->xmlapi->set_port( 2082 ); $this->xmlapi->password_auth($cPanelUser,$cPanelPass); $this->xmlapi->set_debug(1); //output actions in the error log 1 for true and 0 false $this->xmlapi->api1_query($cPanelUser, 'SubDomain', 'addsubdomain', array($subDomain,$rootDomain,0,0, $dir)); set_time_limit(10); $this->xmlapi->api1_query($cPanelUser, "Mysql", "adduser", array($databaseuser, $databasepass)); set_time_limit(10); $this->xmlapi->api1_query($cPanelUser, "Mysql", "adddb", array($databasename)); set_time_limit(10); $addusr = $this->xmlapi->api1_query($cPanelUser, "Mysql", "adduserdb", array($databasename, $databaseuser, 'all')); I've tried extending the time out but it didnt work. I'll just have to keep plugging away at it
  3. I have the following script, sometimes it works great and sometimes it only copies a few files which isnt much use static public function recurse_copy($src, $dst) { $dir = opendir($src); $result = ($dir === false ? false : true); if ($result !== false) { if (!is_dir($dst)) { $result = @mkdir($dst); } if ($result === true) { while(false !== ( $file = readdir($dir)) ) { if (( $file != '.' ) && ( $file != '..' ) && $result) { if ( is_dir($src . '/' . $file) ) { $result = self::recurse_copy($src . '/' . $file,$dst . '/' . $file); set_time_limit(5); } else { $result = copy($src . '/' . $file,$dst . '/' . $file); set_time_limit(5); } set_time_limit(5); } } closedir($dir); } } return $result; } Does anyone have a better more stable solutions. The folder is 14mb Any help would be nuch appreciated
  4. I've created a subscription button with paypal but some of the fields are returning empty. Can anyone help <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="$pp_email"> <input type="hidden" name="lc" value="GB"> <input type="hidden" name="item_name" value="Subscription"> <input type="hidden" name="return" value="http://www.my-return_url.com/subscription"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="src" value="1"> <input type="hidden" name="a3" value="1"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribe_SM.gif:NonHostedGuest"> <input type="hidden" name="cm" value="$name"> <input type="hidden" name="item_number" value="$customer"> <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_subscribe_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1"> </form>' This is whats being returned
  5. I have 2 pages http://domain.domain.com <?php if(isset($_POST['Submit']) && $_POST['Submit'] == "Secure_Login") { $username = $_POST['username ']; $password = $_POST['password']; $ip = $_POST['ip']; $Submit = $_POST['Submit']; $subDoamin = $_POST['subDomain ']; header("location:http://".$subDoamin.".domain.com/Login?username=$username&password=$password&ip=$ip&Submit=$Submit"); } ?> <html> <body> <form> <input type="hidden" name="ip" value="<?=$_SERVER['REMOTE_ADDR']?>" /> <input type="text" name="subDomain" /> <input type="text" name="username" /> <input type="password" name="password" /> <button type="submit" name="Submit" value="Secure_Login">Login</button> </form> </body> </html> then i have http://www.subdomain.domain.com <?php if(isset($_REQUEST['Submit']) && $_REQUEST['Submit'] == "Secure_Login") { $username = $_REQUEST['username ']; $password = $_REQUEST['password']; $ip = $_REQUEST['ip']; $Submit = $_REQUEST['Submit']; // do login } ?> <html> <body> <form> <input type="hidden" name="ip" value="<?=$_SERVER['REMOTE_ADDR']?>" /> <input type="text" name="username" /> <input type="password" name="password" /> <button type="submit" name="Submit" value="Secure_Login">Login</button> </form> </body> </html> Now the problem i am having is when trying to login from http://domain.domain.com i am getting the login screen of http://subdomain.domain.com instead of being logged in automatically The reason for this is i have several subdimains and 1 mobile app and the mobile app directs to http://domain.domain.com so i dont have to get an app for each sun domain Does anyone have any idea whats going wrong
  6. I've managed to sort it but its a little convoluted, if anyone knows a better way it would be much appreciated $debits = array(); $i=1; foreach($data['debits'] as $key=>$value) { foreach($value as $row) { if(isset($row->Week)) { $debits[$i]['Week'] = $row->Week; $debits[$i]['Year'] = $row->Year; $debits[$i]['Debit'] = $row->Debit; $i++; } } } $i=1; foreach($data['credits'] as $key=>$value) { foreach($value as $row) { if(isset($row->Week)) { $credits[$i]['Credit'] = $row->Credit; $i++; } } } $row = array(); for($i=0;$i<count($debits)+1;$i++) { if(isset($debits[$i]['Week'])) { $week = $debits[$i]['Week']; $year = $debits[$i]['Year']; $date = date("l jS F Y", strtotime("{$year}-W{$week}-1")); $credit = number_format($credits[$i]['Credit'],2,'.',','); $debit = number_format($debits[$i]['Debit'],2,'.',','); $amount = number_format($credits[$i]['Credit'] - $debits[$i]['Debit'],2,'.',','); if($amount < 0 ? $color = 'red' : $color = 'green'); array_push($row, "<tr><td>$date</td><td>$credit</td><td>$debit</td><th style='color:$color'>$amount</th></tr>"."\n"); } } ?> <table class="table"> <tr> <th>Week</th> <th>Credits</th> <th>Debits</th> <th>Profit / Loss</th> </tr> <?php foreach($row as $ker=>$val) { echo $val; } ?>
  7. I have 2 arrays $credits = array('week' => '(1-52)', 'year' => 'Whatever Year', 'credit' => '3333'); $debits = array('week' => '(1-52)', 'year' => 'Whatever Year', 'debit' => '3333'); I have merged them but want to display the results as a profit & loss table <table> <tr> <th>Week</th> <th>Credits</th> <th>Debits</th> <th></th> </tr> <?php foreach($array as $row) { <td><?=$row->Week .'-'. $row-Year?></td> <td><?=$row->Credit?></td> <td><?=$row->Debit?></td> <td><?=$row-Credit-$row-Debit?></td> } ?> </table> the trouble is i cannot find a way of adding the values to the array so have merged them which isnt what i want what i realley needed to to is as the debit to the array where the week is equal to the credit week Does anyone know how i can achieve this?
  8. Thank you so much for your help
  9. I think i've been a little vague and my example is a little misleading. I want array_push($array, array('id' => $row->IdEmployee, 'name' => $row->employeeName, 'date' => date("jS M Y", strtotime($row->Year.'W'.str_pad($row->Week, 2, 0, STR_PAD_LEFT).' +6 days')), 'week' => $row->Week, 'currency' => $row->CurrencySymbol, 'wage' => $row->Wage)); to output like http://prntscr.com/b7umsp
  10. I am trying to fetch the results from an array into a spreadsheet like table. Here is where the array is built array_push($array, array('id' => $row->IdEmployee, 'name' => $row->employeeName, 'date' => date("jS M Y", strtotime($row->Year.'W'.str_pad($row->Week, 2, 0, STR_PAD_LEFT).' +6 days')), 'week' => $row->Week, 'currency' => $row->CurrencySymbol, 'wage' => $row->Wage)); i want to fetch it like this <table> <tr> <th>Employee</th> <th>Week 1</th> <th>Week 2</th> <th>Week 3</th> <th>Week 4</th> // and so on, weeks will be dynamic </tr> foreach($x as $r) { <tr> <td>$r->name</td> <td>$r->val_wk_1</td> <td>$r->val_wk_2</td> <td>$r->val_wk_3</td> <td>$r->val_wk_4</td> </table> } I can get the table headers, names and week 1 but cant get my head around the values for the additional weeks
  11. Thanks for that. I know it was something stupid but couldn't see the wood for the trees haha
  12. I'm trying to select some things from a few tables, what i want is to work out the payroll of what i have to pay my employees week by week but am failing misserably. I can select the sum but it isnt breaking down into weeks. Here is my code "SELECT ".PREFIX."tEmployees.IdEmployee, ".PREFIX."tEmployees.employeeName, ".PREFIX."tPayroll.IdPayroll, ".PREFIX."tPayroll.IdInvoice, ".PREFIX."tPayroll.IdEmployee, SUM(".PREFIX."tPayroll.PayeAmount) AS Wage, WEEK(".PREFIX."tPayroll.CreatedDate) AS 'Week', YEAR(".PREFIX."tPayroll.CreatedDate) AS 'Year', ".PREFIX."tOrderInvoices.InvoiceCurrency, ".PREFIX."tOrderInvoices.InvoiceNumber, ".PREFIX."tCurrency.CurrencySymbol FROM ".PREFIX."tPayroll LEFT JOIN ".PREFIX."tEmployees ON ".PREFIX."tEmployees.IdEmployee = ".PREFIX."tPayroll.IdEmployee LEFT JOIN ".PREFIX."tOrderInvoices ON ".PREFIX."tOrderInvoices.IdInvoice = ".PREFIX."tPayroll.IdInvoice LEFT JOIN ".PREFIX."tCurrency ON ".PREFIX."tCurrency.IdCurrency = ".PREFIX."tOrderInvoices.InvoiceCurrency GROUP BY ".PREFIX."tEmployees.IdEmployee ASC"); Like i say i am getting results but they arnt breaking down into weeks
  13. I'm sorry if my post offends you but i was a little frustrated when i was typing it. With the above the mail was sending but nothing was being received. I've been playing about with it and i'm getting the mail with the attachment but no contents in the mail. Here is what i have function send_invoice($to, $from_name, $from, $msg, $dir, $filename, $subject) { $filepath = "$dir"."$filename"; $filetype = "application/pdf"; $message = "<!DOCTYPE html>"; $message .= "<html>"; $message .= "<link rel='stylesheet' href='http://www.mysite.com/styles/styles.css' />"; $message .= "<body>"; $message .= "<pre>$msg</pre>"; $message .= "</body>"; $message .= "</html>"; $semi_rand = md5(time()); //$message .= "--{$mime_boundary}\r\n"; $file = fopen($filepath, "r" ); if( $file == false ) { return "Error in opening $file\r\n"; exit(); } $size = filesize($filepath); $content = fread( $file, $size); fclose($file); $encoded_content = chunk_split( base64_encode($content)); $num = md5(time()); $header = "MIME-Version: 1.0" . "\r\n"; $header .= 'From: My Services<'. $from .'>' . "\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "--".$semi_rand."\r\n"; $header .= "Content-type:text/html; charset=iso-8859-1" . "\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message."\r\n\r\n"; $header .= "--".$semi_rand."\r\n"; $header = "MIME-Version: 1.0" . "\r\n"; $header .= "Content-type:text/html;; charset=iso-8859-1" . "\r\n"; $header .= "From: $from_name<$from>" . "\r\n"; $header .= "Content-Type: $filetype; name=\"".$filename."\"\r\n"; // use different content types here $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n"; $header .= $encoded_content."\r\n\r\n"; $header .= "--".$semi_rand."--"; if(mail($to, $subject, $message, $header)) { return "mail sent to $to!\r\n"; } else { return "mail could not be sent!\r\n"; } }
  14. I've created the following function but its not working for some reason. I've been playing round with it now for a few hours with no luck. Can anyone help please function send_mail_attachment($to, $from_name, $from, $msg, $dir, $path, $subject) { $headers = 'From: $from_name<'. $from .'>' . "\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n<pre>$msg</pre>\n\n"; $message .= "--{$mime_boundary}\n"; $file = fopen($dir.$path,"rb"); $data = fread($file,filesize($dir.$path)); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: 'application/pdf';\n" . " name=\"$path\"\n" . "Content-Disposition: attachment;\n" . " filename=\"$path\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; $message .= "--{$mime_boundary}\n"; if(@mail($to, $subject, $message, $headers)) { return "mail sent to $to!<br />"; } else { return "mail could not be sent!<br />"; } } and here is how its called $msg = "this is the message"; $dir = "./directory/"; $path = "file.pdf"; $to = $emails; $from_name = 'A N Other'; $from = "another@newbie.co.uk"; $subject ="file attached"; echo send_mail_attachment($emails, $from_name, $from, $msg, $dir, $path, $subject); Any help would be much appreciated Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.