-
Posts
73 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by coolshrimp
-
-
From Codes below what would be the best code to use? and why?All do the same thing and work.1. Insert variables
<?php//Open the file.$fileHandle = @fopen("myfile.csv", "r") or die(print_r(error_get_last(),true));$count = 0;//Loop through the CSV rows.while (($row = fgetcsv($fileHandle, 0, ",")) !== FALSE) { $count++; // Skip First 2 Rows if ($count > 2) { if ($row[3] === 'TYPE') {?><td valign="center"><a href="<?php echo $row[4]?>" target="_blank"><img src="../../images/Logos/<?php echo $row[1]?>" style="max-width:<?php echo $row[2]?>px;" alt="<?php echo $row[0]?>"></a></td><?php } }}?>
2. Echo Each line
<?php//Open the file.$fileHandle = @fopen("myfile.csv", "r") or die(print_r(error_get_last(),true));$count = 0;//Loop through the CSV rows.while (($row = fgetcsv($fileHandle, 0, ",")) !== FALSE) { $count++; // Skip First 2 Rows if ($count > 2) { if ($row[3] = 'TYPE') { echo '<td valign="center"><a href="'; echo $row[4]; echo '" target="_blank"><img src="../../images/Logos/'; echo $row[1]; echo '" style="max-width:'; echo $row[2]; echo 'px;" alt="'; echo $row[0]; echo '"></a></td>'; } }}?>
3. USING EOF
<?php//Open the file.$fileHandle = @fopen("myfile.csv", "r") or die(print_r(error_get_last(),true));$count = 0;//Loop through the CSV rows.while (($row = fgetcsv($fileHandle, 0, ",")) !== FALSE) { $count++; // Skip First 2 Rows if ($count > 2) { if ($row[3] === 'TYPE') {echo <<<EOF<td valign="center"><a href="{$row[4]}" target="_blank"><img src="../../images/Logos/{$row[1]}" style="max-width:{$row[2]}px;" alt="{$row[0]}"></a></td>EOF; } }}?>
-
iv been using a php script to send a HTML forms to a google doc spreadsheet thru Zend Framework but it uses ClientLogin witch suddenly no longer works so i need script changed to use oAuth2 and i cannot figure it out myself.script can be found here:http://www.farinspace.com/saving-form-data-to-google-spreadsheets/Reply ASAP i need this done today!!!
-
Simplify URL
in PHP
you are telling to go to sub-domain again remove 'view.' from required rewritten url
RewriteEngine onRewriteRule ^view.mypostedresume.com/(.+)$ mypostedresume.com/view.php?Username=$1 [L]
tested here and seems to work http://martinmelin.se/rewrite-rule-tester/
thanks but does not seem to work for now im using.
RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^([^/.]+)/?$ /view.php?Username=$1 [L,QSA]
so i can simply visit: http://mypostedresume.com/coolshrimpill worry about the "view" subdomain later.
-
Simplify URL
in PHP
Any one able to tell me what code will work for me?
I need 2 things:
Make Nice Easy URL to view userpages:
User Types in:view.mypostedresume.com/coolshrimpurl rewrite to:mypostedresume.com/view.php?Username=coolshrimp
If they try to visit:
view.mypostedresume.com/index.phpview.mypostedresume.com/contact.phpRedirect them back to non subdomain link:mypostedresume.com/contact.phpmypostedresume.com/index.php
-
Simplify URL
in PHP
Having issues getting this to work
iv setup subdomain "view" to point to the folder:view.mypostedresume.com/ points to same place as mypostedresume.comim using following in the .htaccess file:
RewriteEngine onRewriteRule ^view.mypostedresume.com/(.+)$ view.mypostedresume.com/view.php?Username=$1 [L]
so if they visit:
http://view.mypostedresume.com/coolshrimp
they should see content from:
http://www.mypostedresume.com/view.php?Username=coolshrimp
-
Simplify URL
in PHP
ok thanks ill look into it.
-
Simplify URL
in PHP
Hey guys im looking for a simple way to simplify a URLi want to have a .php page load by grabing usename with $_Getbut i want the URL to look simpleSo right now the users have to type this to load there profile page:
http://www.mypostedresume.com/view.php?Username=coolshrimp
id like to make it simpler:
http://view.mypostedresume.com/coolshrimp
So I want them to be able to use subdomain "View" and then tailing tag be the username that .php grabs to load data.
how can i do this?
-
is there anyway i can make my current code work faster without changing to php pasignation? i really like how this jquery one works.
-
do you know of a code that can genereate what this jquery script does?i need the abbility to search rows, have pagignation, order colums by
-
im allready using a jquery datatabel script with does pagination with search and all that."http://www.datatables.net/"
-
I have a php page that loads a table with value from a MYSQL Table but it has almost 5000 rows. witch makes the page load very slow somtimes times freeze browser.
$SQL = "SELECT ID, First_Name, Last_Name, DOB, Phone FROM Customer_Info";$result = mysql_query($SQL);$fields_num = mysql_num_fields($result);$row_num = mysql_num_rows($result);echo <<<EOT<table class="datatable"><thead><tr>EOT;// printing table headersfor($i=0; $i<$fields_num; $i++){$field = mysql_fetch_field($result);echo <<<EOT<th>{$field->name}</th>EOT;}echo <<<EOT<th>Action</th></tr></thead><tbody>EOT;// printing table rowswhile($row = mysql_fetch_assoc($result)){ echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "<td style='text-align:center'><a href='ViewCustomer.php?id=" . $row['ID'] . "' style='color:#FFF'><button class='blue'>View</button></a> | <button onclick='var rowID=" . $row['ID'] . "; var string="includes/mysql/DeleteCustomer.php?id=" . $row['ID'] . ""; var result="alertBanner"; if (confirm("Are you sure you want to delete this customer?")) {ajaxLoad(string, result); $("#dt1").find("td:contains(" . $row['ID'] . ")").parent().remove(); }' style='color:#FFF' >Delete</button></td>"; echo "</tr>n";}echo <<<EOT</tr></tbody></table>EOT;mysql_free_result($result);mysql_close($connnect);
-
yes what i really what is something simple say a field has the class "required"and i need it to automaticaly finds all form fields with that class and check themif theirs blank have a popup say go back and check field in red have red border around those fields.
i have multiple forms on multiple sites that i hate typing all the name fields and i don't want to have to add the name to an array like you suggested as i have 10+ forms and some have 30+ fields being filled out.id rather add the class to the input box and have it search and flag on submit.
-
currently I use javascript to check that certain fields are filled before form submits.is there a better more automated way to do it?i have it so if all fields are filled it shows a loading bar and hides the submit button so they cannot click it a million times.once .php is done it redirect to success/fail page.
function ShowLoader(){document.getElementById('buttons').style.display = 'none';document.getElementById('loader').style.display = 'block';}/******************************** Register Page ********************************/function validateRegister(){ if (document.forms["Register-Form"]["First_Name"].value=="") { alert("First Name Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Last_Name"].value=="") { alert("Last Name Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Company"].value=="") { alert("Company Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Country"].value=="") { alert("Country Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["JobTitle"].value=="") { alert("Job Title Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Email"].value=="") { alert("Email Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Phone"].value=="") { alert("Telephone Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Address1"].value=="") { alert("Address 1 Must Be Filled Out"); return false; } else if (document.forms["Register-Form"]["Address2"].value=="") { alert("Address 2 Must Be Filled Out"); return false; } ShowLoader(); return true;}
-
yes i got it this way now. so the php generates the date and time and adds it to the $_post array
$_POST['Date'] = date('Y-m-d');$_POST['Time'] = date("g:i A.", time());$row = $_POST;
thanks for your guys help i got the whole thing working properly now.i dont know PHP very well but i know enfough to get things working and somewhat how they work.
-
FIXED!! i had to set a max-hight: to a value not a % when not hidden.page updated for any one interested.
-
and for the last part. the $row to array is this ok?it seems to work and I appended the 2 fields not in $_post
$row = $_POST;$row['Date'] = date('Y-m-d');$row['Time'] = date("g:i A.", time());
-
is it ok to do it this way? (EOF)so i dont have to escape quotes..
<?php $to = "me@email.com"; $name = $_REQUEST['First_Name']; $subject = "Email Form"; $from = $_REQUEST['Email']; $headers = 'MIME-Version: 1.0' . "rn" . 'Content-type: text/html; charset=iso-8859-1' . "rn" . "From:" . $name . " <" . $from . ">" . "rn" . "Reply-To:" . $from . "rn";//******** Generate Table and assign to $message ************************//$message = <<<EOF<table cellspacing="4" cellpadding="4" border="1" align="center"><tr> EOF;foreach ($_POST as $key => $value) { $message .= "<td align="center">" . $key . "</td>";}$message .= <<<EOF<td align="center">Date</td><td align="center">Time</td></tr><tr>EOF;foreach ($_POST as $key => $value) { $message .= "<td align="center">" . strip_tags($value) . "</td>";}$message .= <<<EOF<td align="center">EOF;$message .= date('Y-m-d');$message .= <<<EOF</td><td align="center">EOF;$message .= date("g:i A.", time());$message .= <<<EOF</td></tr></table> EOF; if (mail($to,$subject,$message,$headers)) { echo "Email sent"; } else { echo "Failed To Send Email";} ?>
-
ok using this it got it to work is there anything wrong with doing it like this and is there a simpler way?
<?php $to = "me@email.com"; $name = $_REQUEST['Name']; $subject = "Email Form"; $from = $_REQUEST['Email']; $headers = 'MIME-Version: 1.0' . "rn" . 'Content-type: text/html; charset=iso-8859-1' . "rn" . "From:" . $name . " <" . $from . ">" . "rn" . "Reply-To:" . $from . "rn";$message .= "<table cellspacing="4" cellpadding="4" border="1" align="center"><tr>";foreach ($_POST as $key => $value) { $message .= "<td align="center">" . $key . "</td>";}$message .= "<td align="center">Date</td>";$message .= "<td align="center">Time</td>";$message .= "</tr><tr>";foreach ($_POST as $key => $value) { $message .= "<td align="center">" . strip_tags($value) . "</td>";} $message .= "<td align="center">" . date('Y-m-d') . "</td>"; $message .= "<td align="center">" . date("g:i A.", time()) . "</td>"; $message .= "</tr>"; $message .= "</table>"; if (mail($to,$subject,$message,$headers)) { echo "Email sent"; } else { echo "Failed To Send Email"; } ?>
-
here is a full code im trying to get to work.im using EOF (end of file) so i dont have to escape quotations.im guessing for the date and time i have to assign to a variable and then add the variable to the message instead? ($date = date('Y-m-d'))
<?php $to = "Me@email.com"; $name = $_REQUEST['Name']; $subject = "Email Form"; $from = $_REQUEST['Email']; $headers = 'MIME-Version: 1.0' . "rn" . 'Content-type: text/html; charset=iso-8859-1' . "rn" . "From:" . $name . " <" . $from . ">" . "rn" . "Reply-To:" . $from . "rn";$message = <<<EOF<html><head><title>Email</title></head><body><table cellspacing="4" cellpadding="4" border="1" align="center"><tr>foreach ($_POST as $key => $value) { <td align="center">" . $key . "</td>} <td align="center">Date</td><td align="center">Time</td></tr><tr>foreach ($_POST as $key => $value) { <td align="center">" . strip_tags($value) . "</td>}<td align="center">" . date('Y-m-d') . "</td><td align="center">" . date("g:i A.", time()) . "</td></tr></table></body></html>EOF;echo $message; if (mail($to,$subject,$message,$headers)) { echo "Email sent"; } else { echo "Failed To Send Email"; } } ?>
-
ok so for my second box where i have "$message =" this would be the correct code?i tested and it seems the generate the table propperlly on a blank page.
but so now how can i set it to $message= so that i can sen it in an email?
<?php echo "<table cellspacing="4" cellpadding="4" border="1" align="center"><tr>";foreach ($_POST as $key => $value) { echo "<td align="center">" . $key . "</td>";}echo "<td align="center">Date</td>";echo "<td align="center">Time</td>";echo "</tr><tr>";foreach ($_POST as $key => $value) { echo "<td align="center">" . strip_tags($value) . "</td>";} echo "<td align="center">" . date('Y-m-d') . "</td>"; echo "<td align="center">" . date("g:i A.", time()) . "</td>"; echo "</tr>"; echo "</table>"; ?>
-
here is my code i want the panel to slide up/down slowely (animated) when button clicked but some reason it is not working not sure why.http://codepen.io/anon/pen/pvzQXbany help would be great thanks...
-
i have a few things to sort out.is there an easy code to get form fields and assign them to variables rather then listing each one? see bellow
$Title = $_REQUEST['Title']$Name= $_REQUEST['Name']$Email= $_REQUEST['Email']$Comapny= $_REQUEST['Comapny']$Date= $_REQUEST['Date']is ther somthing like this (not a proper code I know)For each( field as string ){$(Field_Name) = $(Field_Value)}
also need to make this simpleri need to generate a table with the values sublitted to be emailed: bellow is what i use now. can we simplify it?
$message = "<html><head><title>New Registration</title></head><body><table cellspacing="4" cellpadding="4" border="1" align="center"> <tr><td align="center">Title</td><td align="center">DOB</td><td align="center">Name</td><td align="center">Name_Passport</td><td align="center">Number_Passport</td><td align="center">Expire_Passport</td><td align="center">Country</td><td align="center">Country_Passport</td><td align="center">Visas</td><td align="center">Travel_Restrictions</td><td align="center">Address</td><td align="center">Phone</td><td align="center">Cell</td><td align="center">Email</td><td align="center">Skype</td><td align="center">Highest_Education</td><td align="center">Institution</td><td align="center">Degrees</td><td align="center">Certifications</td><td align="center">Why_Apply</td><td align="center">Community_Interests<td align="center">Special_Interests</td><td align="center">Share_Interests</td><td align="center">Languages</td><td align="center">Sponsor_Info</td><td align="center">Sponsor_Name</td><td align="center">Sponsor_Orginization</td><td align="center">Sponsor_Position</td><td align="center">Sponsor_Email</td><td align="center">Sponsor_Phone</td><td align="center">Sponsor_Country</td><td align="center">Employment_Organization</td><td align="center">Employment_Position</td><td align="center">Employment_Responsibilities</td><td align="center">Employment_Achievements</td><td align="center">Employment_Start</td><td align="center">Employment_Sector</td><td align="center">Employment_Organization_1</td><td align="center">Employment_Position_1</td><td align="center">Employment_Responsibilities_1</td><td align="center">Employment_Achievements_1</td><td align="center">Employment_Start_1</td><td align="center">Employment_End_1</td><td align="center">Employment_Organization_2</td><td align="center">Employment_Position_2</td><td align="center">Employment_Responsibilities_2</td><td align="center">Employment_Achievements_2</td><td align="center">Employment_Start_2</td><td align="center">Employment_End_2</td><td align="center">Date</td><td align="center">Time</td> </tr> <tr><td align="center">" . strip_tags($_REQUEST['Title']) . "</td><td align="center">" . strip_tags($_REQUEST['DOB']) . "</td><td align="center">" . strip_tags($_REQUEST['Name']) . "</td><td align="center">" . strip_tags($_REQUEST['Name_Passport']) . "</td><td align="center">" . strip_tags($_REQUEST['Number_Passport']) . "</td><td align="center">" . strip_tags($_REQUEST['Expire_Passport']) . "</td><td align="center">" . strip_tags($_REQUEST['Country']) . "</td><td align="center">" . strip_tags($_REQUEST['Country_Passport']) . "</td><td align="center">" . strip_tags($_REQUEST['Visas']) . "</td><td align="center">" . strip_tags($_REQUEST['Travel_Restrictions']) . "</td><td align="center">" . strip_tags($_REQUEST['Address']) . "</td><td align="center">" . strip_tags($_REQUEST['Phone']) . "</td><td align="center">" . strip_tags($_REQUEST['Cell']) . "</td><td align="center">" . strip_tags($_REQUEST['Email']) . "</td><td align="center">" . strip_tags($_REQUEST['Skype']) . "</td><td align="center">" . strip_tags($_REQUEST['Highest_Education']) . "</td><td align="center">" . strip_tags($_REQUEST['Institution']) . "</td><td align="center">" . strip_tags($_REQUEST['Degrees']) . "</td><td align="center">" . strip_tags($_REQUEST['Certifications']) . "</td><td align="center">" . strip_tags($_REQUEST['Why_Apply']) . "</td><td align="center">" . strip_tags($_REQUEST['Community_Interests']) . "</td><td align="center">" . strip_tags($_REQUEST['Special_Interests']) . "</td><td align="center">" . strip_tags($_REQUEST['Share_Interests']) . "</td><td align="center">" . strip_tags($_REQUEST['Languages']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Info']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Name']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Orginization']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Position']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Email']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Phone']) . "</td><td align="center">" . strip_tags($_REQUEST['Sponsor_Country']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Organization']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Position']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Responsibilities']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Achievements']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Start']) . "</td><td align="center">" . $Sector . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Organization_1']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Position_1']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Responsibilities_1']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Achievements_1']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Start_1']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_End_1']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Organization_2']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Position_2']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Responsibilities_2']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Achievements_2']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_Start_2']) . "</td><td align="center">" . strip_tags($_REQUEST['Employment_End_2']) . "</td><td align="center">" . date('Y-m-d') . "</td><td align="center">" . date("g:i A.", time()) . "</td> </tr> </table></body></html>";
also can i generate this exact array with simpler code?
$row = array( "Title" => $_REQUEST['Title'] , "DOB" => $_REQUEST['DOB'] , "Name" => $_REQUEST['Name'] , "Name_Passport" => $_REQUEST['Name_Passport'] , "Number_Passport" => $_REQUEST['Number_Passport'] , "Expire_Passport" => $_REQUEST['Expire_Passport'] , "Country" => $_REQUEST['Country'] , "Country_Passport" => $_REQUEST['Country_Passport'] , "Visas" => $_REQUEST['Visas'] , "Travel_Restrictions" => $_REQUEST['Travel_Restrictions'] , "Address" => $_REQUEST['Address'] , "Phone" => $_REQUEST['Phone'] , "Cell" => $_REQUEST['Cell'] , "Email" => $_REQUEST['Email'] , "Skype" => $_REQUEST['Skype'] , "Highest_Education" => $_REQUEST['Highest_Education'] , "Institution" => $_REQUEST['Institution'] , "Degrees" => $_REQUEST['Degrees'] , "Certifications" => $_REQUEST['Certifications'] , "Why_Apply" => $_REQUEST['Why_Apply'] , "Community_Interests" => $_REQUEST['Community_Interests'] , "Special_Interests" => $_REQUEST['Special_Interests'] , "Special_Interests" => $_REQUEST['Share_Interests'] , "Languages" => $_REQUEST['Languages'] , "Sponsor_Info" => $_REQUEST['Sponsor_Info'] , "Sponsor_Name" => $_REQUEST['Sponsor_Name'] , "Sponsor_Orginization" => $_REQUEST['Sponsor_Orginization'] , "Sponsor_Position" => $_REQUEST['Sponsor_Position'] , "Sponsor_Email" => $_REQUEST['Sponsor_Email'] , "Sponsor_Phone" => $_REQUEST['Sponsor_Phone'] , "Sponsor_Country" => $_REQUEST['Sponsor_Country'] , "Employment_Organization" => $_REQUEST['Employment_Organization'] , "Employment_Position" => $_REQUEST['Employment_Position'] , "Employment_Responsibilities" => $_REQUEST['Employment_Responsibilities'] , "Employment_Achievements" => $_REQUEST['Employment_Achievements'] , "Employment_Start" => $_REQUEST['Employment_Start'] , "Employment_Sector" => $Sector , "Employment_Organization_1" => $_REQUEST['Employment_Organization_1'] , "Employment_Position_1" => $_REQUEST['Employment_Position_1'] , "Employment_Responsibilities_1" => $_REQUEST['Employment_Responsibilities_1'] , "Employment_Achievements_1" => $_REQUEST['Employment_Achievements_1'] , "Employment_Start_1" => $_REQUEST['Employment_Start_1'] , "Employment_End_1" => $_REQUEST['Employment_End_1'] , "Employment_Organization_2" => $_REQUEST['Employment_Organization_2'] , "Employment_Position_2" => $_REQUEST['Employment_Position_2'] , "Employment_Responsibilities_2" => $_REQUEST['Employment_Responsibilities_2'] , "Employment_Achievements_2" => $_REQUEST['Employment_Achievements_2'] , "Employment_Start_2" => $_REQUEST['Employment_Start_2'] , "Employment_End_2" => $_REQUEST['Employment_End_2'] , "Date" => date('Y-m-d') , "Time" => date("g:i A.", time()) );
Send email function()
in PHP
Posted · Edited by coolshrimp
i got this working myself after a bit of time yesterday.!!i have emails sending thru smtp of my gmail account. (cound not get hotmail working)On 64-Bit Windows 8 running Xamppyou will need to do 4 things.Make A Gmail account we will use there smtp to send out emails.Nex install program called Stunnel (MANDITORY MAKES IT ALL WORK): https://www.stunnel.org/downloads.htmlNext open up php.ini for xammp make changes below serch for "[mail function]" set following:
now go into "C:/Xampp/sendmail" and open sendmail.ini edit bellow replacing ur User and pasword
now restart ur xammp (apache server)