Go Back   Tech Support Forum > Design Forum > Web Serving and Management

User Tag List

Limiting user inputting records

This is a discussion on Limiting user inputting records within the Web Serving and Management forums, part of the Tech Support Forum category. Hi all I am in need of help. Again. What I have is a plane logging system. Part of it,


Closed Thread
 
Thread Tools Search this Thread
Old 11-07-2015, 04:20 AM   #1
Elite Commander
 
VividProfessional's Avatar
 
Join Date: Apr 2009
Location: Merseyside Uk
Posts: 1,406
OS: Windows 10

My System

Send a message via MSN to VividProfessional

Hi all
I am in need of help. Again.

What I have is a plane logging system. Part of it, the non paid for area should limit the about of "spots" a user inputs into the system. These demo users are in a group called "GROUP 1". each user has a username in a variable called "$username" is it possible to check the database table in this case "spottings" to see how many records a user has .

So that if "freddie" inputted 200 records it would be OK and allow him to input the record
If he tried to input another record, aka his 201st record the website would redirect him to a page called suprem.php asking Freddie to contribute to the site to enable him to input more?

Thanks
__________________
Boeing 787 Dreamliner Register
The worlds premier Dreamliner site
www.b787register.co.uk
VividProfessional is offline  
Sponsored Links
Advertisement
 
Old 01-07-2016, 12:54 PM   #2
TSF Enthusiast
 
BrentC's Avatar
 
Join Date: May 2007
Posts: 1,116
OS: Vista Home Premium



Hi Dave,

First, I would implement a form to collect the info you want to store in the database for each user and have the action in the form code set to your php file.

Then, use PHP/MySQL to INSERT the info collected to the database. Then SELECT from the database all rows it contains. Then implement PHP/MySQL to return the number of rows it has. Using PHP now, if the number of rows is 201, then "echo" the HTML to implement a way for your users to donate. I suggest you use Paypal which will collect donations in a secure manner. With Paypal the user can donate via direct withdrawal from their bank account or with credit card.

If you want the PHP/MySQL code to do all this I can provide it.
BrentC is offline  
Old 01-07-2016, 02:20 PM   #3
Elite Commander
 
VividProfessional's Avatar
 
Join Date: Apr 2009
Location: Merseyside Uk
Posts: 1,406
OS: Windows 10

My System

Send a message via MSN to VividProfessional

Quote:
Originally Posted by BrentC View Post

If you want the PHP/MySQL code to do all this I can provide it.
that would be extremely helpful thank you
__________________
Boeing 787 Dreamliner Register
The worlds premier Dreamliner site
www.b787register.co.uk
VividProfessional is offline  
Sponsored Links
Advertisement
 
Old 01-07-2016, 02:56 PM   #4
TSF Enthusiast
 
BrentC's Avatar
 
Join Date: May 2007
Posts: 1,116
OS: Vista Home Premium



First of all, do you know how to connect to a MySQL database which you have created?
BrentC is offline  
Old 03-03-2016, 04:10 PM   #5
TSF Enthusiast
 
BrentC's Avatar
 
Join Date: May 2007
Posts: 1,116
OS: Vista Home Premium



Hi,

Here is the first page:

HTML Code:
<!DOCTYPE html>

<html>

<body>


<form action="dave.php" method="POST">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  Last name: <input type="text" name="limit"><br>
  <input type="submit" value="Submit">
</form>

</body>
</html>


Now the second page in PHP:

PHP Code:
<?php


$host
="localhost";
$username="username";
$password="*******";
$db_name="databasename";

$con=mysqli_connect($host$username$password$db_name);

// Check connection
if (mysqli_connect_errno())
  {
  die (
"Failed to connect to MySQL: " mysqli_connect_error());
  }

  
$sql="SELECT * FROM $username";

$result mysqli_query($con$sql);
if (!
$result) {
    
mysqli_close($con);
    die(
'Error with SELECT From username: ' mysqli_error());
    }

        
$num_rows mysqli_num_rows($result);
        
$row mysqli_fetch_array($result);
    if((
$num_rows == 200) && !$row['limit']) {
    
            
$sql "INSERT INTO $username (firstname, lastname, limit)
            VALUES ('John', 'Doe','true')"
;
        
$result mysqli_query($con$sql);
    
    echo 
'<div style="position:absolute; top:200px; left:47%; text-align:center; font-family:Arial, sans serif; font-size:24px;">
    We request that you make a donation as you are at 200 records saved.<br><br>
    <form  name="myform" action="dave2.html"  style="position:absolute; top:300px; left:47%;" />
        <input class="buttons" style="background-color:#3366FF; color:#ffffff;" type="submit" value="Payment" />
    </form></div>'
;
    } else {
        
        
$sql "INSERT INTO $username (firstname, lastname, limit)
        VALUES ('John', 'Doe','true')"
;
    
$result mysqli_query($con$sql);
    if (!
$result) {
        
mysqli_close($con);
        die(
'Error INSERTing ' mysqli_error());
        }
    }


mysqli_close($con);
?>

And a third:

HTML Code:
<!DOCTYPE html>

<html>

<body>


<form style='margin-left:31%' action='https://www.paypal.com/cgi-bin/webscr' method='post' target='_top'>
<input type='hidden' name='cmd' value='_s-xclick'>
<input type='hidden' name='hosted_button_id' value='PAZ5G388TXWFL'>
<input type='image' src='https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif' width='31%' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>
<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif' width='1' height='1'>
</form>

<br><br><br>

<form action="dave.html" method="get">
  <input type="submit" value="Homepage">
</form>

</body>
</html>

What you have to do is create a database with these:

$host="localhost";
$username="username";
$password="*******";
$db_name="databasename";

Fill in the value of $username, $db_name and password. You must create a table for each user with the same name as each user. There will only be one name for the database.

Adjust the form on the first page to input the info you want to save in the database for each user. You also create a password for each user.

You do all of this with PHPMyAdmin which is included with your Hosting Service.

I haven't tested this so good luck. Come back for further help.
BrentC is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Lenovo laptop running slow on browsing and everything else
Hi TSF, I have a new Lenovo Yoga 2 laptop (core i5 4202Y, 128 SSD, 4GB ram) that I purchased about 3 months ago. Its running windows 8.1 and seems to be somewhat sluggish especially when I'm browsing the web. Seems to freeze on pages (including gmail inbox). I'm wondering if there is anything I...
nileshcg Resolved HJT Threads 9 01-25-2015 09:22 PM
Slow computer and hot deals pop ups
My computer has been very slow as of late. Even opening up a a folder can sometimes take awhile. Also using my firefox browser I get these side windows that pop up saying Hot Deals with different deals. The browser is also incredibly slow. I attached the necessary scans. I also do have a boot...
XMayenX Virus/Trojan/Spyware Help 14 01-09-2015 11:33 AM
Both my browsers hijacked
Hi Both my browsers have been hijacked. I can still use them but every so often they redirect me to unwanted sites. I run I.E and Firefox. I couldn't zip the "Attach" and "Ark" files it seems I only have WinRAR on my system to zip and unzip. I will paste them here I hope it's ok. Thanks for...
vaindioux Resolved HJT Threads 26 08-18-2014 06:00 PM
Need some help with start up issue then crash
Hi I got what I think is a minor problem but i dont know how to fix it. I just cleared out some malware (with some good advice from another forum that focus on malware), did some system maintenance and while I was updating the drivers seem to have disturbed the operating system. There is no...
simon255 Windows 7 , Windows Vista Support 2 04-03-2013 04:44 PM
[SOLVED] Internet Dropping Off When Ever It Feels Like it
Folks I am using a new netgear N105 wireless modem, on a HP Pavilion a6440a system with windows xp. The Internet seems to drop off. Things I tried: Firstly I recently changed from Netcomm to Netgear as the Netcomm modem start dropping of at random. The new nettgear N105 wireless modem now...
duncvr Modems/Cable/DSL/Satellite 14 02-15-2011 11:32 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question


» Site Navigation
 > FAQ
  > 10.0.0.2
Powered by vBadvanced CMPS v3.2.3


All times are GMT -7. The time now is 08:03 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.1.0 (Pro) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
Copyright 2001 - 2018, Tech Support Forum

Windows 10 - Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security - Top Web Hosts