Jump to content

emediastudios

Members
  • Posts

    418
  • Joined

  • Last visited

Posts posted by emediastudios

  1. Hi everyone, I would like to edit a file so that it only shows a image iif it is the home page on wordpress.

    <?php
    /*
    WARNING: This file is part of the core Genesis framework. DO NOT edit
    this file under any circumstances. Please do all modifications
    in the form of a child theme.
    */
    /**
    * Handles the footer structure.
    *
    * This file is a core Genesis file and should not be edited.
    *
    * @category Genesis
    * @package  Templates
    * @author   StudioPress
    * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
    * @link	 http://www.studiopress.com/themes/genesis
    */
    genesis_structural_wrap( 'inner', '</div><!-- end .wrap -->' );
    echo '</div><div class="quote-table"><img src="http://clients2.weblink.com.au/clients/oceaniacapital/quotes_img.asp" alt="Quote Table" style="border: solid 1px #ddd;" /></div>';
    do_action( 'genesis_before_footer' );
    do_action( 'genesis_footer' );
    do_action( 'genesis_after_footer' );
    ?>
    </div><!-- end #wrap -->
    <?php
    wp_footer(); // we need this for plugins
    do_action( 'genesis_after' );
    ?>
    

     

    This is what I only want to show on the home page.

    echo '</div><div class="quote-table"><img src="http://clients2.weblink.com.au/clients/oceaniacapital/quotes_img.asp" alt="Quote Table" style="border: solid 1px #ddd;" /></div>';

  2. You can use PHP's round() function. Example:

    $price = 19.9500;
    echo round($price, 2);
    

     

    So, in your case:

    <?php echo $this->helper('catalog/output')->productAttribute($_product, round($_product->getPrice(), 2), 'price') ?>

     

    Love your work sumpygump, have been on the magento forum and have had no help. You solved my problem, works a charm! awesome! thankyou!

  3. Hi All, this is probable not the place to post this, but though this section may have someone in the know.

    I am looking for a PHP member scheduler, with calendar for my existing site, or it can run independently, just want it so my client can add appointment times on a day on a calender for any member in an admin, and when the client logs in only sees his appointments,

    Anyone know of a free open source php script, i will install a forum or wordpress if it is easier.

    Thanks.

  4. Make `email` a unique key and use INSERT IGNORE, the database will handle destroying duplicates.

     

    -Dan

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM newsletter WHERE email = 'ross@mail.com'' at line 1

  5. This is the full code i have, it works well, just want to stop the email being added multiple times.

     

    <?php
    
    switch ($_REQUEST['action']) {
    
    default:
    
    foreach($_POST as $key=>$value){
    $$key = $value;
    }
    
    if ($email == ''){
    $error_msg = 'email required';
    }
    
    elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
        $error_msg = 'Invalid email address'; 
    }
    
    
    if ($error_msg == ''){
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
     $Q = mysql_query("INSERT INTO newsletter (`email`) VALUES ('$email')");
    
    $companyname = 'Newsletter Signup';
    $companyemail = 'me@emediastudios.com.au';
    
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$email." <".$email.">\r\n";
    $headers .= "Reply-To: ".$email." <".$email.">\r\n";
    $to = "".$companyname."<".$companyemail.">";
    $subject = "Newsletter Signup";
    
    $message = '<style type="text/css">
    <!--
    .style {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    }
    -->
    </style>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
        <td class="style">
    <b>Details:</b><br /><br />
    <b>Email:</b> '.$email.'<br />
        </td>
      	</tr>
    </table>';
    
    mail($to, $subject, $message, $headers);
    
    	echo '<form id="form1" name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'">
                  <table width="200" border="0" align="left" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="144"><input name="email" type="text" class="newsinput" id="email" value="Subscribed" /></td>
                      <td width="56" align="left" class="signuppad"><input type="submit" class="submit" value=""/></td>
                    </tr>
    </table>
                </form>';
    
    }else{
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    
    echo '<form id="form1" name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="41%"><input name="email" type="text" class="newsinput" id="email" value="'.$email.'" size="30" /></td>
                      <td width="59%" class="signuppad"><input type="submit" class="submit" value=""/></td>
                    </tr>
                  </table>
                </form>';
    
    break;
    
    }
    }
    ?>

  6. Hey everyone, im building my first newsletter sign up and wanted to add the validation of checking if the email is already in the database.

     

    This is the top part of the code that works.

    <?php
    
    switch ($_REQUEST['action']) {
    
    default:
    
    foreach($_POST as $key=>$value){
    $$key = $value;
    }
    
    if ($email == ''){
    $error_msg = 'email required';
    }
    
    elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
        $error_msg = 'Invalid email address'; 
    }
    echo "";
    
    
    if ($error_msg == ''){
    
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
     $Q = mysql_query("INSERT INTO newsletter (`email`) VALUES ('$email')");

     

    But when i add my attempted validation it doesn't work.

     

    $check = mysql_query("SELECT FROM newsletter WHERE email = '$email'") or die(mysql_error()); 
     $check2 = mysql_num_rows($check); 
     if ($check2 != 1) {
    
     $error_msg = 'email exists'; 

     

    Could someone be so kind to add this code where it should go, iv tried everything.

     

     

     

     

  7. Thanks champ, that the pdf issue resolved. As for the rename of the file, i was thinking, rename it to the persons name submitting the pdf, the $name value of the form and put a random number on the end for good measure, or if easier just the id number.

    Thanks again for your help

     

  8. Thnks for the replies.

    I tried but no luck, i tried adding a random number function and failed.

    Anychance of a sample please, i'll keep reading up and see if i can get it.

    the script does everything it should, except the rename and pdf check.

  9. Hi everyone, im a newbie and have written this script, has taken me a day to get here. :)

    The form inserts data into the database, uploads a file and sends an email.

    All this works fine, what i am trying to do is rename the file to the id of the record and check to make sure it is a pdf.

    I would really appreciate any help. I've tried and tried and just cant get it to work.

     

    <?php
    switch ($_REQUEST['action']) {
    case 'recruit':
    foreach($_POST as $key=>$value){
    $$key = $value;
    }
    if ((!$name) || (!$email) || (!$phone)) {
    $error_msg = 'Fields marked<span class="gold"> * </span>are required to submit the form';
    }elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
        $error_msg = 'Invalid email address'; 
    }
    echo "$error_msg","<br><br>";
    if ($error_msg == ''){
    
    $date=date("d/m/y", time());		
    $add="recruitment/".$_FILES[userfile][name];
    $cleaned = stripit($add);
        $add2 = $cleaned;
    
       if(move_uploaded_file ($_FILES[userfile][tmp_name], $add2));		
        $Q = mysql_query("INSERT INTO recruitment (`name`,`phone`,`email`, `qual`,`exper`,`file`) VALUES ('$name','$phone','$email','$qual','$exper','$cleaned')");
      
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    $companyname = 'Mead Business college';
    $companyemail = 'ross@emediastudios.com.au';
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$name." <".$email.">\r\n";
    $headers .= "Reply-To: ".$name." <".$email.">\r\n";
    $to = "".$companyname."<".$companyemail.">";
    $subject = "Mead Business College Recruitment Form Submission";
    $message = '<style type="text/css>";
    
    
    <!--
    .style {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    }
    -->
    </style>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
        <td class="style">
    <b>Details:</b><br /><br />
    <b>Name:</b> '.$name.'<br />
    <b>Email:</b> '.$email.'<br />
    <b>Mobile No:</b> '.$phone.'<br />
    <b>Qualifications:</b><br> '.$qual.'<br />
    <b>Experience:</b><br /><br />'.$exper.'<br /><br />
    <b>Uploaded resume:</b> http://www.mydomain.com.au/'.$cleaned.'
        </td>
      	</tr>
    </table>';
    mail($to, $subject, $message, $headers);
    
    echo '<table width="99%" border="0" cellpadding="0" cellspacing="0">
    
      	<tr>
    
        <td class="mybody">Hi '.$name.',<p />Thank you for your enquiry. An MBC Consultant will contact you shortly.<br />
          <br />
          </td>
      	</tr>
    </table>';
    
    }else{
    
    foreach($_POST as $key=>$value){
    
    $$key = htmlentities(stripslashes($value));
    
    }
    echo '
    <FORM ENCTYPE="multipart/form-data" id="form" name="Contact Form" method="post" action="'.$_SERVER['PHP_SELF'].'?action=recruit">
      <table width="489" border="0" cellspacing="5" cellpadding="0" class="formsw">
        <tr>
          <td width="227">Name:</td>
          <td width="358"><input type="text" name="name" id="name" value="'.$name.'" /></td>
        </tr>
        <tr>
          <td>Contact Mobile:</td>
          <td><input type="text" name="phone" id="phone" value="'.$phone.'" /></td>
        </tr>
        <tr>
          <td>Email:</td>
          <td><input type="text" name="email" id="email" value="'.$email.'" /></td>
        </tr>
        <tr>
          <td>Relevent Qualifications:</td>
          <td><textarea name="qual" id="qual" cols="45" rows="5" value="'.$qual.'"></textarea></td>
        </tr>
        <tr>
          <td>Recent Experience:</td>
          <td><textarea name="exper" id="exper" cols="45" rows="5" value="'.$exper.'"></textarea></td>
        </tr>
        <tr>
          <td>Upload Resume:</td>
          <td><input type="file" name="userfile" id="userfile" /></td>
        </tr>
        <tr>
          <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
          <td> </td>
        </tr>
      </table>
    </form>';
    
    }
    
    break;
    }
    ?>

  10. Hi Everyone, I have a small problem and try to learn from all the help i get here.

    I have a form that gathers info, emails and inserts info into the database, everything works fine except the file doesnt upload and the file name does not go into the database, instead i get /recruitment in the file field of the databse, instead of recruitment/uploadedfile.pdf

     

    Code Below, please help,

     

    <?php
    switch ($_REQUEST['action']) {
    case 'recruit':
    foreach($_POST as $key=>$value){
    $$key = $value;
    }
    if ((!$name) || (!$email) || (!$phone)) {
    $error_msg = 'Fields marked<span class="gold"> * </span>are required to submit the form';
    }elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { 
        $error_msg = 'Invalid email address'; 
    }
    echo "$error_msg","<br><br>";
    if ($error_msg == ''){
    
    $add="recruitment/".$_FILES[userfile][name];
    $cleaned = stripit($add);
        $add2 = "../".$cleaned;
    
        move_uploaded_file ($_FILES[userfile][tmp_name], $add2);		
        $Q = mysql_query("INSERT INTO recruitment (`name`,`phone`,`email`, `qual`,`exper`,`file`) VALUES ('$name','$phone','$email','$qual','$exper','$cleaned')");
      
    foreach($_POST as $key=>$value){
    $$key = htmlentities(stripslashes($value));
    }
    $companyname = 'Business college';
    $companyemail = 'ross@emediastudios.com.au';
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: ".$name." <".$email.">\r\n";
    $headers .= "Reply-To: ".$name." <".$email.">\r\n";
    $to = "".$companyname."<".$companyemail.">";
    $subject = "Business College Recruitment Form Submission";
    $message = '<style type="text/css>";
    
    
    
    
    <!--
    .style {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    }
    -->
    </style>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
        <td class="style">
    <b>Details:</b><br /><br />
    <b>Name:</b> '.$name.'<br />
    <b>Email:</b> '.$email.'<br />
    <b>Mobile No:</b> '.$phone.'<br />
    <b>Qualifications:</b><br> '.$qual.'<br />
    <b>Experience:</b><br /><br />'.$exper.'<br /><br />
    <b>Uploaded resume:</b> http://www.mydomain.com.au/'.$cleaned.'
        </td>
      	</tr>
    </table>';
    mail($to, $subject, $message, $headers);
    
    
         
          
    
    echo '<table width="99%" border="0" cellpadding="0" cellspacing="0">
    
      	<tr>
    
        <td class="mybody">Hi '.$name.',<p />Thank you for your enquiry. An Consultant will contact you shortly.<br />
          <br />
          </td>
      	</tr>
    </table>';
    
    }else{
    
    foreach($_POST as $key=>$value){
    
    $$key = htmlentities(stripslashes($value));
    
    }
    echo '
    <form id="form" name="Contact Form" method="post" action="'.$_SERVER['PHP_SELF'].'?action=recruit">
      <table width="489" border="0" cellspacing="5" cellpadding="0">
        <tr>
          <td width="227">Name:</td>
          <td width="358"><input type="text" name="name" id="name" value="'.$name.'" /></td>
        </tr>
        <tr>
          <td>Contact Mobile:</td>
          <td><input type="text" name="phone" id="phone" value="'.$phone.'" /></td>
        </tr>
        <tr>
          <td>Email:</td>
          <td><input type="text" name="email" id="email" value="'.$email.'" /></td>
        </tr>
        <tr>
          <td>Relevent Qualifications:</td>
          <td><textarea name="qual" id="qual" cols="45" rows="5" value="'.$qual.'"></textarea></td>
        </tr>
        <tr>
          <td>Recent Experience:</td>
          <td><textarea name="exper" id="exper" cols="45" rows="5" value="'.$exper.'"></textarea></td>
        </tr>
        <tr>
          <td>Upload Resume:</td>
          <td><input type="file" name="userfile" id="userfile" /></td>
        </tr>
        <tr>
          <td><input type="submit" name="submit" id="submit" value="Submit" /></td>
          <td> </td>
        </tr>
      </table>
    </form>';
    
    }
    
    break;
    }
    ?>

  11. Hey all.

    Have a question, im still learning but what i am trying to do is make the number 1 add 1 to itself and repeat in the loop so, 1 2, 3, 4, 5, 6 ect...What am i doing wrong.

     

     

     $result = mysql_query("SELECT * FROM comments WHERE quoteid = ".$_REQUEST['quoteid'].""); 
    while($row=mysql_fetch_array($result)){
    $date = $row[date];
    $name = $row[name];
    $email = $row[email];
    $quoteid = $row[quoteid];
    $comment = stripslashes($row[comment]);
    $commentid = $row[commentid];
    $counter = 1;
    $counted = 	$counter++;
    
    $resultb = mysql_query("SELECT * FROM quotes WHERE quoteid= '$quoteid'") or die(mysql_error()); 
    while($link=mysql_fetch_array($resultb)){
    $artist = $link[artist];
    $song = $link[song];
    
    	}
    echo'<table border="0" cellpadding="0" cellspacing="0"><tr>
                    <td  rowspan="3" align="center"><span class="commentNumber">'.$counted.'</span></td>

  12. Hi everyone,

    I have a like button on repeating regions that is used for keeping a record of votes on comments.

    People click it an it adds 1 to the votes column total.

     

    It works just fine.

     

    Problem is i only want to a allow a user one vote per comment only. can vote on other comments as well, but again, only one vote per day per comment.

     

    i wouldn't know where to start.

    Would i use a cookie or record an ip?

     

    switch ($_REQUEST['action']) {
    case 'likeit';
    
    foreach($_REQUEST as $key=>$value){
    $$key = $value;
    }
    $votes = $_GET['votes'];
    $total = ($votes + 1);
    
    $sql = mysql_query("UPDATE quotes SET votes = '$total' WHERE quoteid = '$quoteid'");
    
    break;
    
    }

  13. I have a small job that i wish for an experienced programmer to assist me with.

    The applicant must speak good English and use good code practices.

     

    Payment will be made via pay pal after the client has paid me which could be one week after completion.

    There should only be a couple of hours in it.

    This is a trial job, if the first job goes well and am I am happy with the final result, this will lead to further projects.

     

    This website is a post and comment site, with a voting system, most of the admin is completed but needs cleaning functions and a few other functions completed.

    Applicant must be prepared to use msn messenger.

     

     

  14. The $link was going to be for displaying a count,

    But anyway, it probably not the best way  to achieve what i am aiming for.

     

    I'm doing it the hard way i am sure.

     

    Basically, I have a quote table and a comment table.

    both tables have a field called quoteid, i use this to match comments made to the quote.

     

    When calling the comments, i want to show details from the quote table as well, such as song name, artist.

    and when calling the quotes, i want to show the total amounts of comments made on it.

     

     

  15. Hi Everyone, could anyone tell me why this only shows one record.

    There is at least four that will match the query.

     

    case 'jayzquotes';
    echo '<table border="0" cellspacing="0" cellpadding="2"><tr><td><h1>Jay-Z Quotes</h1></td></tr></table><br>';
    
    
     echo '<table width="600" border="0" cellspacing="0" cellpadding="2">';
      
      $result = mysql_query("SELECT * FROM quotes WHERE artist LIKE 'J%' and approved = 'y'")
    or die(mysql_error()); 
    
    $count = mysql_num_rows ($result );
    while($row=mysql_fetch_array($result)){
    
      
    $resultb = mysql_query("SELECT * FROM comments WHERE quoteid=".$row['quoteid']."")
    or die(mysql_error()); 
    while($link=mysql_fetch_array($resultb)){
    
    $date = $row[date];
    $user = $row[user];
    $email = $row[email];
    $artist = $row[artist];
    $song = $row[song];
    $quote = stripslashes($row[quote]);
    $quoteid = $row[quoteid];
    $votes = $row[votes];
    
    
    echo '
    <tr>
      <td width="424"><strong>Date Submitted:</strong><span class="red"> '.$date.'</span></td>
      <td width="156" align="right"><strong>Total Votes</strong> (<span class="red">'.$votes.'</span>)</td>
      </tr>
    <tr>
      <td colspan="2"><strong>Quote submitted by:</strong><span class="red"> '.$user.' </span>- <span class="red"><a href="mailto:'.$email.'">'.$email.'</a> </span></td>
      </tr>
    <tr>
      <td colspan="2"><strong>Artist:</strong> <span class="red">'.$artist.' </span></td>
      </tr>
    <tr>
      <td colspan="2"><strong>Song name:</strong> <span class="red">'.$song.' </span></td>
      </tr>
    <tr>
      <td colspan="2"><strong>Quote:</strong><hr></td>
      </tr>
    <tr>
        <td colspan="2">'.$quote.'</td>
        </tr>
    <tr>
      <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="quotefooter">
        <tr>
          <td><strong>(<span class="dark">'.$countb.'</span>) Comments: View / Edit Comments</strong></td>
          <td align="center"><strong><a href="index.php?action=editquote&quoteid='.$quoteid.'" target="_self">Edit Quote</a></strong></td>
          <td align="center"><strong><a href="index.php?action=deletequote&quoteid='.$quoteid.'">Delete Quote</a></strong></td>
            </tr>
          </table><br><hr></td>
      </tr>
    ';
    	}
    }
    echo '</table>';
    echo '<strong>Total Results</strong><span class="red"> '.$count.'</span>';
    
    break;
    

  16. Hi everyone.

    I am a newbie to mysql php and have a question.

    I can display records in a loop from one table but i want to display the records from another table as well that has the same quoteid and where approved is "n"

     

    This is what  have so far, but there is also only 3 fields from the quotes table i want to display in the loop.

     

    	$sql = mysql_query("SELECT * FROM comments WHERE approved LIKE 'n%'");
    while ($row = mysql_fetch_array($sql)) {
    $count = mysql_num_rows ( $sql );	
    foreach($row as $key=>$value){
    $$key = htmlentities(stripslashes($value));
      }
    
    echo '

     

    Hope i make sense.

     

     

     

×
×
  • 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.