Jump to content

davelearning

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Posts posted by davelearning

  1. Hi all,

     

    Firstly here is my code

    <?php 
    if (isset($_POST['update']))
    {
    include('../config.php');
    $name = $_POST['name'];
    $email = $_POST['email'];
    $id = $_POST['id'];
    
    $uquery=mysql_query("UPDATE customers SET name='$name' AND email='$email' WHERE id='$id'");
    if($uquery)
    {
    	echo mysql_error();
    }
    
    else
    
    {
    	echo mysql_error();
    }
    }
    ?>
    
    
    <link href="../styles/clientbox.css" rel="stylesheet" type="text/css">
    <link href="cancelform.css" rel="stylesheet" type="text/css" />
    <link href="../styles/form_dark.css" rel="stylesheet" type="text/css" />
    <body><br>
    <h3>My Details</h3>
    <div class="text">
    Please keep your details updated below, for security reasons you cannot change your password.<br>
    <?php 
    $id = $_GET['id'];
    include('../config.php');
    $query=mysql_query("SELECT * FROM customers WHERE id='$id'");
    while($row = mysql_fetch_assoc($query))
      				{
    					$name = $row['name'];
    					$email = $row['email'];
    
    				}
    				?>
    <form class="dark" action="" method="post">
      <ol>
        <li>
          <fieldset>
            <legend>My Details</legend>
            <ol>
              <li>
                <label for="name">Account Holder</label>
                <input type="text" id="name" name="name" value="<?php echo $name;?>" />
              </li>
              <li>
                <label for="email">Contact/Login Email Address</label>
                <input type="text" id="email" name="email" value="<?php echo $email;?>" />
                <input type="hidden" id="id" name="id" value="<?php echo $id;?>" />
              </li>
            </ol>
          </fieldset>
        </li>
      </ol>
      <p style="text-align:right;">
        <input type="reset" value="CANCEL" />
        <input type="submit" value="UPDATE" name="update" />
      </p>
    </form>

     

    Basically what is happening is that whatever you enter into the name box returns a 0 if its text or 1 if numbers are entered as opposed to storing the value inputed, if the email address is changed then nothing happens at all.

     

    Can someone see if I have made a noob mistake somewhere? The name and email fields are both varchar(256) in my database

     

    Thanks

     

  2. Hi all,

     

    I have the following which displays my posts on a wordpress blog

    <?php 
    		$x = 0;
    		while (have_posts()) : the_post(); update_post_caches($posts); 
    		$x++;
    		?>
    			<li<?php if ($x % 2) { } else { echo ' class="right_col"';} ?>>
    				<?php unset($img); 
    					if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
    					$thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
    					$img = $thumbURL[0];  }
    					else { 
    						unset($img);
    						if ($wpzoom_cf_use == 'Yes')  { $img = get_post_meta($post->ID, $wpzoom_cf_photo, true); }
    					else {  
    						if (!$img)  {  $img = catch_that_image($post->ID);  } }
    					}
    					if ($img) { $img = wpzoom_wpmu($img); ?>
    					<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&w=75&h=75&zc=1" alt="<?php the_title(); ?>" /></a><?php } ?>
    				<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><span class="comm_bubble"><?php comments_popup_link('0', '1', '%', ' ', ' '); ?></span>
    				<span class="meta"><?php the_time("$dateformat $timeformat"); ?> <?php edit_post_link( __('Edit', 'wpzoom'), ' ', ''); ?></span>
    				<?php wpe_excerpt('excerpt_tabs', 'wpe_excerptmore'); ?>
    
    			</li><?php endwhile; ?>
    
    		</ul><?php endif; ?>

     

    What I would like to do is limit the max posts to 6, but I cant seem to work out a way of doing it!

     

    Any pointers?

     

    Cheers

     

  3. Hi all, this is a shot in the dark as the code wasnt written by me and its a mess, I was just wondering if anyone would have a quick look at

     

    http://www.meetster.ch/

     

    and see if their is an obvious reason why it looks so screwed in ie, in chrome it displays fine!

     

    He has about 5 different css files, and it looks like a lot of moo-tools stuff, I cant make head nor tail of it to be honest :)

  4. I appear to be having a simple simon day!

     

    my foreach is only displaying the last result in the table as opposed to each row

    $num_rows = mysql_num_rows($query);
    echo "There are $num_rows records.<br>";
    
    	while($row = mysql_fetch_row($query))
    	foreach ($row as $field)
    
    		{ 
    			echo '<div class="results">';
    			echo  $field;
    			echo '<br></div>'; 
    
    		}

     

    And the source

     

     

    <link href="../styles/clientbox.css" rel="stylesheet" type="text/css">
    
    <body><br>
    
    
    
    <h3>My Services</h3>
    
    <div class="text">
    
    You currently have the following services with us:
    
    </div>
    
    There are 2 records.<br><div class="results">test1<br></div>
    
    
    </body>
    
    </html>

     

    My table has 2 rows which the 1st one has a package of test and the second a package of test1

     

     

    Can anyone help?

     

    Thanks

     

     

  5. ehhm,

     

    they are the same and it does work...

     

    The insert query I had the created $variable contained the error

     

    I should have just echoed out my variable :(

     

    Dunce hat on head....

  6. Thanks for the replies

    Are they the same including spelling, capitalization, and white space? 'Hello World' does not equal 'Hello world', or 'Hello World ' . . .

     

    Yup exactly the same :(

    if it's an integer i am pretty sure you don't need those " " around it either.

    if ($x == 1) {
      echo 'x is 1';
    }
    

     

    I wasnt sure, it works with them in!

     

  7. This may sound a bit stupid, but I cant get an if statement to work!

     

    I can get it to run if the answer is a number, eg

     

    if($variable=="1")
    {
    }
    

     

    but what if its a word?

     

    eg

     

     

     

    if($variable=="hello world")
    {
    }
    

     

    I cant get this to work!

     

    Cheers

     

     

  8. Hi all,

     

    I am wondering if nayone can spot why more form is not processing, basically the page just loads afresh once details have been entered and submit button clicked

     

    The page is called client.php

    <?php
    session_start();
    
    if (isset($_POST['submit']))
    {
    include('config.php');
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $query = mysql_query("SELECT email,password FROM customers WHERE email='$username' AND password = '$password'");
    $count=mysql_num_rows($query);
    
    
    	if($count==1)
    		{
    			$query1= mysql_query("SELECT id FROM customers WHERE email='$username'");
    			echo mysql_error() ;
    			while($row = mysql_fetch_assoc($query1))
      				{
    					$id = $row['id'];
    					$_SESSION['id'] = $id;
    					$_SESSION['logged'] = "SET";
    					header("Location: client.php?id=$id");
    				}
    		}
    
    	else
    		{
    			echo "<script>alert('Incorrect Login Details')</script>";
    		}
    }
    ?>
    
    <link href="styles/style.css" rel="stylesheet" type="text/css" />
    <link href="styles/form_clean.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="scripts/pageload.js"></script>
    <script type="text/javascript">
    function swapImages(that) {
      that.src =  (that.src.indexOf('buttonselected')>-1) ? ("images/"+that.id+"button.gif") : ("images/"+that.id+"buttonselected.gif");
    }
    </script>
    <link href="styles/form_clean.css" rel="stylesheet" type="text/css" />
    
    </head>
    
    <body>
    
    <div id="main">
    <div id="links">
    	<a href="index.php"><img src="images/homebutton.gif" alt="Home Button" class="buttons" id="home" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    	<a href="javascript:ajaxpage('packages.php', 'content');"><img src="images/packagebutton.gif" alt="Packages Button" class="buttons" id="package" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    <a href="javascript:ajaxpage('purchase.php', 'content');"><img src="images/purchasebutton.gif" alt="Purchase Button" class="buttons" id="purchase" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    <a href="javascript:ajaxpage('contact.php', 'content');"><img src="images/contactabutton.gif" alt="Contact Button" class="buttons" id="contacta" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
              <a href="client.php"><img src="images/clientbutton.gif" alt="Client Button" class="buttons" id="client" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    </div>
        
        
        <div id="logobox"><img src="images/logo.png" alt="JollyHosting.com - Simplified Reseller Hosting"/>
    </div>
        <div id="content">
        <img src="images/gaptop.png" alt="seperator" />
        
        <?php
    
    if(!isset($_SESSION['logged']))
    {
    	?>
           <h2> Please Login</h2>
            <div id="login">
        <form class="clean" action="client.php" method="post">
          <ol>
            <li>
              <fieldset>
                <legend>Login</legend>
                <ol>
                  <li>
                    <label for="username">Email Address</label>
                    <input type="text" id="username" name="username" value="" />
                  </li>
                  <li>
                    <label for="password">Password</label>
                    <input type="password" id="password" name="password" value="" />
                  </li>
                </ol>
              </fieldset>
            </li>
          </ol>
          <p style="text-align:right;">
            
            <input type="submit" value="OK" />
          </p>
        </form>
        </div>
    	<?php
    }
    
    else
    {
    	echo "loggin in";
    }
        ?>
      </div>
        
        <?php include('footer.php');?>
    </div>
    </body>
    </html>
    

     

     

    Many thanks

     

  9. Hi all,

     

    This is driving me insane!

     

    Basically I am simply trying to setup a reoccurring payment, in live and sandbox I get an error once I submit login details

    The link you have used to enter the PayPal system is invalid. Please review the link and try again.

     

    The code I am sending to paypal is:

    header("location:
    https://www.sandbox.paypal.com/cgi-bin/webscr?
    cmd=_xclick-subscriptions&
    business=sandbox@minecraftclan.com&
    item_name=Item1&
    a3=3.00&
    p3=30&
    t3=D");

     

    My sandbox account is 'sandbox@minecraftclan.com', I really cant see what the issue is!

     

    It will show the payment screen, but error occours after logging in with sandbox details, the same if I run to the live site and use an real paypal account

     

    Any ideas?

     

    EDIT:

     

    This iswhat a view source on the error page looks like:

    s.prop1="xpt/Merchant/hostedpayments/Error";
    s.prop6="6FW885512W222534S";
    s.prop7="Personal";
    s.prop8="Verified";
    s.prop9="Unrestricted";
    s.prop10="US";
    s.prop14="The link you have used to enter the PayPal system is invalid. Please review the link and try again.";
    s.prop16="";
    s.prop34="PayPalCredit:Servicing:CO:NoTransactions";
    s.prop15="";
    s.pageName="xpt/Merchant/hostedpayments/Error::_flow";
    s.prop50="en_US";
    s.prop18="";

     

    That mean anything to anyone?!

     

     

  10. Hi all,

     

    What I am trying to achieve is, I thought quite simple!

     

    Basically, a user signs up and chooses a package, form is submitted, details added to the database, email sent to customer, then I want to direct them to a paypal payment screen, this is where I am having issues!

     

    Is their any way in php to submit a form without user interaction? Here is my code for the form process page

    <?php
    include('config.php');
    require('scripts/class.phpmailer.php');
    
    $package = $_POST['select1'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $password = md5($_POST['password']);
    
    $domain = $_POST['domain'];
    $a_username = $_POST['a_username'];
    $a_password = $_POST['a_password'];
    
    
    $query=mysql_query("INSERT INTO orders (package, name, email, password, domain, a_username, a_password)
    VALUES
    ('$package', '$name', '$email', '$password', '$domain', '$a_username', '$a_password')");
    
    if (!$query)
    {
    echo "fail<br>";
    echo mysql_error();
    }
    
    else
    {
    $id = mysql_insert_id();
    $query1=mysql_query("INSERT INTO customers (id, name, email, password)
    values
    ('$id', '$name', '$email', '$password')");
    
    if (!$query1)
    {
    	echo "fail<br>";
    	echo mysql_error();
    }
    
    
    if($package=="Reseller Hosting")
    {
    
    //email stuff here - all works - just cutting it to keep the code short
    
    
    if(!$mail->Send())
    {
       echo "Message could not be sent. <p>";
       echo "Mailer Error: " . $mail->ErrorInfo;
       exit;
    }
    ?>
    
    
    <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_xclick-subscriptions">
    <input type="hidden" name="business" value="subscription@jollyhosting.com">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="item_name" value="Jolly Hosting Reseller Packages"> 
    <input type="hidden" name="no_shipping" value="1">
    
    <!--1st month -->
    <input type="hidden" name="currency_code" value="USD">  
    <input type="hidden" name="a3" value="3.00">
    <input type="hidden" name="p3" value="1">
    <input type="hidden" name="t3" value="M">
    <input type="hidden" name="src" value="1">
    <input type="hidden" name="sra" value="1">
    </form>';
    
    
    <?php
    }
    
    //last
    }
    //end
    ?>

     

  11. Hi all,

     

    No matter what username I enter, I am receiving the invalid username message:

    $(function() {
    
    // load the modal window
    $('a.modal').click(function(){
    
    	// scroll to top
    	$('html, body').animate({scrollTop:0}, 'fast');
    
    	// before showing the modal window, reset the form incase of previous use.
    	$('.success, .error').hide();
    	$('form#contactForm').show();
    
    	// Reset all the default values in the form fields
    	$('#name').val('Your name');
    	$('#email').val('Your email address');
    	$('#comment').val('Enter your comment or query...');
    
    	//show the mask and contact divs
    	$('#mask').show().fadeTo('', 0.7);
    	$('div#contact').fadeIn();
    
    	// stop the modal link from doing its default action
    	return false;
    });
    
    // close the modal window is close div or mask div are clicked.
    $('div#close, div#mask').click(function() {
    	$('div#contact, div#mask').stop().fadeOut('slow');
    
    });
    
    $('#contactForm input').focus(function() {
    	$(this).val(' ');
    });
    
    $('#contactForm textarea').focus(function() {
            $(this).val('');
        });
    
    // when the Submit button is clicked...
    $('input#submit').click(function() {
    $('.error').hide().remove();
    	//Inputed Strings
    	var name = $('#name').val(),
    		email = $('#email').val(),
    		comment = $('#comment').val();
    
    
    	//Error Count
    	var error_count;
    
    	//Regex Strings
    	var name_regex =  /^[a-z0-9_-]{3,15}$/,
    		email_regex = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
    
    		//Test Username
    		if(!name_regex.test(name)) {
    			$('#contact_header').after('<p class=error>Invalid username entered!</p>');
    			error_count += 1;
    		}
    
    		//Test Email
    		if(!email_regex.test(email)) {
    			$('#contact_header').after('<p class=error>Invalid email entered!</p>');
    			error_count += 1;
    		}
    
    		//Blank Comment?
    		if(comment == '') {
    			$('#contact_header').after('<p class=error>No Comment was entered!</p>');
    			error_count += 1;
    		}
    
    		//No Errors?
    		if(error_count === 0) {
    			$.ajax({
    				type: "post",
    				url: "scripts/send.php",
    				data: "name=" + name + "&email=" + email + "&comment=" + comment,
    				error: function() {
    					$('.error').hide();
    					$('#sendError').slideDown('slow');
    				},
    				success: function () {
    					$('.error').hide();
    					$('.success').slideDown('slow');
    					$('form#contactForm').fadeOut('slow');
    				}				
    			});	
    		}
    
    		else {
                    $('.error').show();
                }
    
    	return false;
    });
    
    });

     

  12. Hi all,

     

    Can anyone tell me why my jquery validate will not run when I use my image swap script? I am relatively new to jquery and javascript in general and I don't understand what the issue is, if I remove my links with the onmouseover and onmouseout functions then the validator works fine, however if I leave them in then the form just executes.

     

    My code:

    <script type="text/javascript" src="scripts/pageload.js"></script>
    <script type="text/javascript" src="scripts/formhelper.js"></script>
    <script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="scripts/jquery.validate.pack.js"></script>
    
    <script type="text/javascript">
    
      $(document).ready(function(){
        $("#purchase").validate();
      });
      function swapImages(that) {
      that.src =  (that.src.indexOf('buttonselected')>-1) ? ("images/"+that.id+"button.gif") : ("images/"+that.id+"buttonselected.gif");
    }
    
      </script>
    
    </head>
    
    <body>
    <div id="main">
    <div id="links">
    	<a href="index.php"><img src="images/homebutton.gif" alt="Home Button" class="buttons" id="home" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    	<a href="packages.php"><img src="images/packagebutton.gif" alt="Packages Button" class="buttons" id="package" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    <a href="purchase.php"><img src="images/purchasebutton.gif" alt="Purchase Button" class="buttons" id="purchase" onmouseover="swapImages(this)" onmouseout="swapImages(this)" /></a>
    	<img src="images/contactbutton.gif" alt="Contact Button" class="buttons" id="contact" onmouseover="swapImages(this)" onmouseout="swapImages(this)" />
            <img src="images/clientbutton.gif" alt="Client Button" class="buttons" id="client" onmouseover="swapImages(this)" onmouseout="swapImages(this)" />
    

     

    Many Thanks

     

  13. Ok I have noticed I can do it like this:

    <script type="text/javascript">
    function homeOver()
    {
    document.getElementById("home").src ="images/homebuttonselected.gif";
    
    }
    
    function homeOut()
    {
    document.getElementById("home").src ="images/homebutton.gif";
    
    }
    
    function packageOver()
    {
    
    document.getElementById("packages").src ="images/packagebuttonselected.gif";
    }
    
    function packageOut()
    {
    
    document.getElementById("packages").src ="images/packagebutton.gif";
    }
    
    function purchaseOver()
    {
    
    document.getElementById("purchase").src ="images/purchasebuttonselected.gif";
    }
    
    function purchaseOut()
    {
    
    document.getElementById("purchase").src ="images/purchasebutton.gif";
    }
    
    </script>
    </head>
    
    <body>
    <div id="main">
    <div id="links">
    <img src="images/homebutton.gif" class="buttons" id="home" onmouseover="homeOver()" onmouseout="homeOut()" />
    
    <img src="images/packagebutton.gif" class="buttons" id="packages" onmouseover="packageOver()" onmouseout="packageOut()" />
    
    <img src="images/purchasebutton.gif" class="buttons" id="purchase" onmouseover="purchaseOver()" onmouseout="purchaseOut()" /></div>
    </div>
    </body>
    </html>

     

    But is their a simpler way?

     

  14. Hi all, I am relatively new to javascript, hence the basic problem! All I am trying to do is show a different image for a button onmouseover, basically it just has an arrow to show the button is selected.

     

    Here is my code

    <script type="text/javascript">
    function mouseOver()
    {
    document.getElementById("home").src ="images/homebuttonselected.gif";
    document.getElementById("packages").src ="images/packagebuttonselected.gif";
    }
    
    function mouseOut()
    {
    document.getElementById("home").src ="images/homebutton.gif";
    document.getElementById("packages").src ="images/packagebutton.gif";
    }
    </script>
    </head>
    
    <body>
    <div id="main">
    <div id="links"><img src="images/homebutton.gif" class="buttons" id="home" onmouseover="mouseOver()" onmouseout="mouseOut()" />
    <img src="images/packagebutton.gif" class="buttons" id="packages" onmouseover="mouseOver()" onmouseout="mouseOut()" /></div>
    </div>
    </body>
    </html>
    

     

    My problem is that when one button is highlighted, both images change to there onmouseover state, how to I remedy this so each one is treated individually?

     

    Thanks

     

  15. Solved

    function displayVals() {
          var serverCost = $("#server").val();
      var fservercost = parseFloat(serverCost);
      var ramCost = $("#ram").val();
      var framcost = parseFloat(ramCost);
      var storageCost = $("#hdd").val();
      var fstorageCost = parseFloat(storageCost);
      var ipCost = $("#ip").val();
      var fipcost = parseFloat(ipCost);
      var totalValue = fservercost + framcost + fstorageCost + fipcost;
      
      
          
          $("#price").html("<b>Server Cost:</b> $" + 
                      serverCost + "<br><b>Extra Ram:</b> $" +  ramCost
    			  + "<br><b>Storage Space:</b> $" +  storageCost
    			   + "<br><b>Extra IP's:</b> $" +  ipCost 
    			    + "<br><br><b>Total Cost:</b> $" +   totalValue );
        }
    
        $("select").change(displayVals);
        displayVals();
    

     

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