Jump to content

PHPTOM

Members
  • Posts

    84
  • Joined

  • Last visited

Posts posted by PHPTOM

  1. Put all the IPs into seperate rows.

    Then:

    <?php
    $myQuery = mysql_query("SELECT `banip` FROM `banedIPS`");
    if(!$myQuery) {
        die("Database table Selection Failed: " . mysql_error());
    }
    while ($row = mysql_fetch_assoc($myQuery)) {
    if($row['banip'] == $_SERVER['REMOTE_ADDR']){
    	if(!isset($_POST['submit'])){
    	echo "<form method=\"post\">";
    	echo "Are you a human?<br />";
    	echo "<select name=\"humancheck\">";
    	echo "<option value=\"no\">No</option>";
    	echo "<option valu=\"yes\">Yes</option>";
    	echo "<input type=\"submit\" name=\"submit\" value=\"Submit\" />";
    	echo "</select></form>";
    }else{
    	$check = $_POST['humancheck'];
    	if($check == "no"){
    		header("Location: http://www.google.com");
    	}elseif($check == "yes"){
    		mysql_query("DELETE FROM `banip` WHERE `banip` = '".$_GET['REMOTE_ADDR']."'");
    		header("Location: http://www.yoursite.com");
    	}
    }
    }
    ?>
    
    
    

     

     

     

     

    ----------------

    Now playing: 2pac - Changes

    via FoxyTunes

  2. Hi,

    I have always used MySQL, but I might switch to MySQLi. I'm planning a new application I am making but I don't know whether to use MySQLi or MySQL. How do you do things like mysql_fetch_array with mysqli? Is this how you do a query? :

    $query = $mysqli->query("SELECT * FROM `table`");
    

    I do understand some of it, like $mysqli would have to be a

    $mysqli = new Mysqli;
    

    something like that.

     

    Thanks a lot

     

    ----------------

    Now playing: Chris Brown - Forever

    via FoxyTunes

  3. THanks for all the responses. Basically I had a range from 1-80, then I had to do a while from the database to remove certain numbers. So then I could select  a random number what hasn't already been chosen. Unset works fine, because  I shuffle it afterwords. Thanks again! :)

  4. $to = $_POST['email'];
    $subject = "You have registered";
    $body = "
    <html>
    <head>
    <title>Account Activation</title>
    </head>
    <body>
    <p>email here <br />
    <br />
    -----------------------------<br />
    This is an automated email, please don't try and reply.'
    </body>
    </html>";
    
    $headers = 'From: website.com <noreply@website.com>';
    mail($to, $subject, $body, $headers);
    

     

    What happens if you do that?

     

    ----------------

    Now playing: Linkin Park - Crawling Demo

    via FoxyTunes

  5. <?php
    error_reporting(E_ALL);
    session_start( );
    
    // if username and password are set and not empty then proceed with the rest of the process
    if( isset( $_POST[ 'username' ] ) && isset( $_POST[ 'company' ] ) && $_POST[ 'username' ] != '' && $_POST[ 'company' ] != '' )
    {
    
    
    
    
    
    
    
    
    $link = mysql_connect( 'host', 'username', 'password' );
    
    
    
    
    
    
    
    
    
    $db_selected = mysql_select_db('dbname', $link);
    
    
    
    
    
    
    
    
    $username = mysql_real_escape_string($_POST['username'], $link);
    
    
    
    $company = mysql_real_escape_string($_POST['company'], $link);
    
    
    
    
    
    
    if (!$db_selected) 
    
    
    
    {
    
    
    
    
    
    echo"Connection to the database failed. Please try again later." ;
    
    
    
    
    
    
    
    
    
    
    
    
    exit;
    
    
    
    }
    
    
    
    
    
    
    //checks for username and password in db table.
    
    
    
    $results = mysql_query("select * from access where username='" . $username . "' and company = '" . $company . "'" ,$link ) or die(mysql_error());
    
    
    
    $num_rows = mysql_num_rows($results);
    
    
    
    
    
    
    //greater than zero
    
    
    
    
    
    
    
    
    if( $num_rows  > 0 )
    
    
    
    {
    
    
    
    
    
    $_SESSION['username'] = $username;
    $_SESSION['company'] = $company;
    
    
    
    
    
    //redirect
    
    
    
    
    
    $data = mysql_fetch_array($results);
    
    
    
    
    
    
    
    
    
    
    header("Location: {$data['company']}.php");
    
    
    
    }
    
    
    
    
    }
    ?>
    

     

    <div id="center_column">
    					<?php
    					if (isset($_SESSION['username']) && $_SESSION['company'] == "thecompany") 
    					{ 
    					echo'<br /><br /><br />';
    					echo '<p>You are logged in as '.$_SESSION['username'].'</p>'; 
    
    					echo'<a href="#nogo">Project</a><br><br>';
    					echo'<a href="#nogo">Links</a><br><br>';
    					echo'<a href="#nogo">Will</a><br><br>';
    					echo'<a href="#nogo">Go</a><br><br>';
    					echo'<a href="#nogo">Here</a><br><br><br><br>';
    					} 
    					else 
    					{ 
    					echo '<p>You are not logged in.</p>'; 
    					echo '<p>Only logged in members may visit these pages.</p>'; 
    					echo '<p><a href="login_access.php">Client login Page</a><br /><br /></p>';
    					} 
    
    					?>
    				</div>
    

  6. You'd need set up a MySQL database and get the information from there.

    Example:

    $query = mysql_query("SELECT * FROM `products`");
    while($a = mysql_fetch_array($query)){
    echo"<form method=\"POST\"
      action=\"https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/*********\"
          accept-charset=\"utf-8\">
    
      <input type=\"hidden\" name=\"$a[product_title]\" value=\"Product Title\"/>
      <input type=\"hidden\" name=\"$a[p_model]\" value=\"Product Model Number.\"/>
      <input type=\"hidden\" name=\"$a[quantity]\" value=\"Quantity\"/>
      <input type=\"hidden\" name=\"$a[price]\" value=\"Price\"/>
      <input type=\"hidden\" name=\"USPS Priority\" value=\"UPS Ground\"/>
      <input type=\"hidden\" name=\"$a[shipping]\" value=\"Shipping\"/>
    
      <input type=\"hidden\" name=\"_charset_\"/>
      <input type=\"image\" name=\"Google Checkout\" alt=\"Fast checkout through Google\"
    src=\"http://checkout.google.com/buttons/checkout.gif?merchant_id=*******&w=180&h=46&style=white&variant=text&loc=en_US\"
    height=\"36\" width=\"100\"/>
    
    </form>";
    }
    

     

    Of course you would need to setup a database. If you want me to help you with that and your host has PHPMYadmin I will help you. Email me tlomas [at] gmail [dot] com

     

    ----------------

    Now playing: Jay-Z And Linkin Park - Numb/Encore

    via FoxyTunes

     

    ----------------

    Now playing: Jay-Z And Linkin Park - Numb/Encore

    via FoxyTunes

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