How to right align several lines of text in PHP - newbie - right-align

I'm trying to right align a date and 6 lines of text on a letterhead using PHP, but either break the PHP code or it isn't right aligning all the text lines.
This is the existing PHP code I've adjusted to this point which right aligns the date and the first two lines, but the rest of the text lines are still on the left.
The end result I want to achieve is to align the date and the 6 lines of text after the date on the right side of the page.
<?php
echo "<br />";
echo "<br />";
echo "<div align='right'>";
echo date("d/m/Y") . "</div><br />";
echo "<br />";
echo "<br />";
$user_info = wp_get_current_user(1);
echo "<div align='right'>";
echo $user_info->first_name . " " . $user_info->last_name . "\n";
echo "Job Title</div>" . "\n";
echo 'Email: ' . $user_info->user_email. "\n";
echo 'Mobile: ' . $user_info->mobile_number. "\n";
echo 'Web Address: ' . $user_info->webaddress1. "\n";
echo 'Facebook Page: ' . $user_info->facebook. "\n";
echo "<br />";
echo "<br />";
echo "<hr />";
echo "Dear " . $_POST["c_name"] . "," . "\n";
I'm very new at this so thanks so much for any help and suggestions.

change your code at line 9
from echo "<div align='right'>";
to echo "<div style='text-align:right'>";

Related

Send an HTML email with an attachment in unix either using mail,mailx or sendmail

I am trying to send an HTML email along with few attachments, but i when m not using
Content-Type: text/html
in header then i am able to send the attachment , but HTML part of the email is displayed as below :-
<html>
<body>
<p>This is the body content</p>
</body>
</html>
but when m using the
Content-Type: text/html in header am able to see the HTML part of the email as below :-
This is the body content
But in this case m not able to send the attachment.
Below is the 2 sets of code am using
For set 1 :-
FILES="$(ls /dir_with_the_list_of_files_to_be_sent | awk '{print $0}' | tr '\n' ' ')"
(
echo "To: abc#abc.com"
echo "Subject:Extract List ";
echo "Content-Type: text/html"
echo
echo "<html>"
echo "<body>"
echo "<font face='Courier New' size='1'>"
echo "<h1>Hi All,</h1>"
echo "<h1>Below are the path </h1>"
echo "<br>"
echo "<font size="4"><p>Thanks & Regards,<br />
<br />
echo "`for f in $FILES ; do uuencode "$f" "$f" ; done `"
ABC</p></font>"
echo "</font>"
echo "</body>"
echo "</html>"
) | /usr/sbin/sendmail -t
For set 2 :-
FILES="$(ls /dir_with_the_list_of_files_to_be_sent | awk '{print $0}' | tr '\n' ' ')"
(
echo "To: abc#abc.com"
echo "Subject:Extract List ";
echo
echo "<html>"
echo "<body>"
echo "<font face='Courier New' size='1'>"
echo "<h1>Hi All,</h1>"
echo "<h1>Below are the path </h1>"
echo "<br>"
echo "<font size="4"><p>Thanks & Regards,<br />
<br />
echo "`for f in $FILES ; do uuencode "$f" "$f" ; done `"
ABC</p></font>"
echo "</font>"
echo "</body>"
echo "</html>"
) | /usr/sbin/sendmail -t
Could someone please suggest how can i send both the HTML part of email and attachment from unix.
Thanks in advance.

I cannot pass the id to the controller?

I tried to play the songs and pass the dynamic id to the controller.But I tried this code.
<?php
$i = 1;
foreach ($view as $row)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td>"."<a href='<?php echo base_url();?>admin/play/$row->audio'".$row->audio."</a></td>";
$i++;
echo "</tr>";
}
?>
In inspecting the element anchor shows the direct php code instead of localhost/bla/bla/ how can i fix this? my controller name is play and i want to pass the value of its the particular name.Is my concatenation is correct?
You are opening php tags twice. make it like this:
<?php
$i = 1;
foreach ($view as $row)
{
echo "<tr>";
echo "<td>".$i."</td>";
echo "<td><a href='" . base_url('admin/play' . $row->audio) . "'>" . $row=>audio . "</a><td>";
$i++;
echo "</tr>";
}

Sent email with iCal to outlook with valarm reminder

I am in a situation where I want to send email with iCal attachment to Outlook Calendar and I want to set reminder to 120 minutes before start event.
I send RAW message with iCal(see below).
If recipient opens the message, event is automatically added to outlook calendar, but reminder is set to 15 minutes(default in outlook), even if I set different value in VALARM.
If I use ics file with iCal to import to Outlook Calendar then reminder is set to my value.
I would really appreciate help on this. How to set reminder for event?
$from_name = "<FROM_NAME>";
$from_address = "<FROM_ADDRESS>";
$subject = "Meeting Booking";
$meeting_description = "Here is a brief description of my meeting\n\n";
$meeting_location = "My Office";
$domain = 'domain.com';
$to_name = "<TO_NAME>";
$to_address = "<TO_ADDRESS>";
$meeting_date = "2015-10-21 15:40:00";
$meeting_duration = 3600;
$meeting_stamp = STRTOTIME($meeting_date . " UTC");
$dtstart= GMDATE("Ymd\THis\Z",$meeting_stamp);
$dtend= GMDATE("Ymd\THis\Z",$meeting_stamp+$meeting_duration);
$mime_boundary = "----Meeting Booking----".MD5(TIME());
//Create ICAL Content
$ical = 'BEGIN:VCALENDAR' . "\r\n" .
'PRODID:-//Patient Portal//MyEyeDr.//EN' . "\r\n" .
'VERSION:2.0' . "\r\n" .
'METHOD:REQUEST' . "\r\n" .
'BEGIN:VEVENT' . "\r\n" .
'ORGANIZER;CN="'.$from_name.'":MAILTO:'.$from_address. "\r\n" .
'ATTENDEE;CN="'.$to_name.'";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:'.$to_address. "\r\n" .
'LAST-MODIFIED:' . date("Ymd\TGis") . "\r\n" .
'UID:'.date("Ymd\TGis", strtotime($meeting_date)).rand()."#".$domain."\r\n" .
'DTSTAMP:'.date("Ymd\TGis"). "\r\n" .
'DTSTART;TZID="America/New_York":'.$dtstart. "\r\n" .
'DTEND;TZID="EAmerica/New_York":'.$dtend. "\r\n" .
'SEQUENCE:1'. "\r\n" .
'SUMMARY:' . $subject . "\r\n" .
'LOCATION:' . $meeting_location . "\r\n" .
'CLASS:PUBLIC'. "\r\n" .
'PRIORITY:5'. "\r\n" .
'BEGIN:VALARM'. "\r\n" .
'ACTION:Display'. "\r\n" .
'DESCRIPTION:'.$meeting_description. "\r\n" .
'SUMMARY:Event Alarm'. "\r\n" .
'TRIGGER:-PT120M'. "\r\n" .
'END:VALARM'. "\r\n" .
'END:VEVENT'. "\r\n" .
'END:VCALENDAR'. "\r\n";
$message= "To: ".$to_address."\n";
$message.= "From: ".$from_address."\n";
$message.= "Subject: Example SES mail (raw)\n";
$message.= "MIME-Version: 1.0\n";
$message .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";
$message .= "Content-class: urn:content-classes:calendarmessage\n";
$message.= "\n\n";
$message .= "--$mime_boundary\r\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body>\n";
$message .= '<p>Dear ...,</p>';
$message .= '<p>This is an email message.</p>';
$message .= "</body>\n";
$message .= "</html>\n";
$message .= "--$mime_boundary\r\n";
$message .= 'Content-Type: text/calendar;name="meeting.ics";method=REQUEST'."\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "X-Mailer: Microsoft Office Outlook 15.0\r\n";
$message .= $ical;
I think there is nothing wrong with your code. Most calendar clients will ignore any alarm that is sent along with an invitation. When you think about it, this makes sense: if you invite me, I may want to accept or decline, but you should not dictate when I want to be notified.
On the other hand, when importing, you are making those events your own.
Change METHOD:REQUEST to METHOD:PUBLISH. Also change your other method code at the bottom from method=REQUEST to method=PUBLISH.

Fetching data into textbox

I am trying to finish my school project.
This is what my site looks like:
I am fetching daha via the "Getir" button using AJAX. This is working very well but I want to make the second row editable.
foreach ($rows as $row) {
echo "<tr>";
echo "<td>".$row['uyeid']."</td>";
echo "<td>".$row['ad']."</td>";
echo "<td>".$row['soyad']."</td>";
echo "<td>".$row['eposta']."</td>";
echo "<td>".$row['uyestatusu']."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>$duzenlenemez</td>";
echo "<td>".$row['ad']."</td>";
echo "<td>".$row['soyad']."</td>";
echo "<td>".$row['eposta']."</td>";
echo "<td>".$row['uyestatusu']."</td>";
echo "</tr>";
}
}
I am ready to supply extra code if anyone needs it to figure out more.
For anyone interested and found this subject one google I am writing this:
As I said I wanted to make second row editable so I needed to wrote data to inputs. Like this:
foreach ($rows as $row) {
echo "<tr>";
echo "<td>".$row['uyeid']."</td>";
echo "<td>".$row['ad']."</td>";
echo "<td>".$row['soyad']."</td>";
echo "<td>".$row['eposta']."</td>";
echo "<td>".$row['uyestatusu']."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>$duzenlenemez</td>";
echo "<td><input type='text' value='".$row['ad']."'/></td>";
echo "<td><input type='text' value='".$row['soyad']."'/></td>";
echo "<td><input type='text' value='".$row['eposta']."'/></td>";
echo "<td><input type='text' value='".$row['uyestatusu']."'/></td>";
echo "</tr>";
}
}
Output picture: http://puu.sh/8uSDl.png

openssl_sign and PHP 4 identical signature for different messages

I have to maintain an application in php 4 that must send signed data via openssl_sign. The issue is that for different data of the same size, the signature is always the same.
Eg. this code:
$signature = null;
$message1 = 'foobar';
$privkey1 = openssl_pkey_get_private('file://path/to/private/key/privkey1.pem');
while ($msg = openssl_error_string()) {
echo $msg . "<br />\n";
}
openssl_sign($message1, $signature, $privkey1);
while ($msg = openssl_error_string()) {
echo $msg . "<br />\n";
}
openssl_free_key($privkey1);
while ($msg = openssl_error_string()) {
echo $msg . "<br />\n";
}
$signature2 = null;
$message2 = 'foobaz';
$privkey2 = openssl_pkey_get_private('file://path/to/private/key/privkey1.pem');
while ($msg = openssl_error_string()) {
echo $msg . "<br />\n";
}
openssl_sign($message2, $signature2, $privkey2);
while ($msg = openssl_error_string()) {
echo $msg . "<br />\n";
}
openssl_free_key($privkey2);
while ($msg = openssl_error_string()) {
echo $msg . "<br />\n";
}
echo base64_encode($signature) . '<br/>';
echo base64_encode($signature2) . '<br/>';
Outputs this:
uANYD6qKuvlcyK2svarB0ESPO7qLa75cEIhCmjkTF23cwveSE+Mxuhsl7JKjOEOPf7v8mCoTLmdlm/2RDD0Nabdpi+5Ez8Di8dFNpXtMVRByJvewOOGxTgYt/1XPIqe+dvLunkqtl8dHkRhtzuBHay1suco53Ybs7r41YKdqnkk=
uANYD6qKuvlcyK2svarB0ESPO7qLa75cEIhCmjkTF23cwveSE+Mxuhsl7JKjOEOPf7v8mCoTLmdlm/2RDD0Nabdpi+5Ez8Di8dFNpXtMVRByJvewOOGxTgYt/1XPIqe+dvLunkqtl8dHkRhtzuBHay1suco53Ybs7r41YKdqnkk=
Does anyone know what the reason of this problem?