Jump to content

Recommended Posts

Posted

Well its a small guide ,but you can use this for a shit of things.Its a simple form that inserts data in SQL and then show's it to the admin (example).You can do ALOT of things like i did with it ,its so fucking simple and its used alot.An example is this : click.I used it as a L2 Ticketing system for reporting bugs blabla ,but if you have a good imagination you can use it for news (example).Insert the record to MySQL and then show it to the readers :) So lets see how this thingie works

 

First make a connection to the database.I recommend for all to make a other file called "config.php" or something similiar and there will be all values for connecting etc.So here's how config file should look :

<?php
$user = "root"; // Database user
$pass = "112233"; // Password for the database
$db = "dot"; // Database name
$host = "localhost"; // IP/Host to connect to the database
$connection = mysql_connect($host, $user, $pass) or die("Cant connect to database1"); // Lets try to connect ,if not die();
$db = mysql_select_db($db,$connection)or die("Cant connect to database2"); // If first connection is successful ,lets conncet to the database name ,if error die();
$chars="set character set latin1"; //Charset .. You can use this if you have some problems with the encoding of your character
mysql_query($chars); // To send the encoding of the character type (latin1 type)
?> 

 

That was a simple connection method ,and the most used though.

 

Second step.How to insert to the database?

Well now to establish the connection you can use this code to include the configuration file for sql

<?php include "FILENAME.php"; ?> 

Okay now we have a database connection ,lets proceed to the importing into it.

The import way is easy too ,but pls dont copy/paste it ,so you can learn it faster :)

Here's how the submit form should look .. With explames in the file :)

  <form method="POST">
</p>
<p>Value1: <br />
  <input name="value" type="text" /> 
  *
</p>
  <input type="submit" name="button" value="Submit it!">
  <?php
include('FILENAME.php'); // This is the config file name.Replace it with your config file name in order to connect into database 
if($_POST['button']){ // Here is the button "Submit".It has a name "button" you can change it ,but it its the same.Leave it as it is
$value=$_POST['value']; // This is the first value that we will insert.. If you wish to add more ,look above.
//$ot=$_POST['value1'];
//$izp=$_POST['value2];
//$pesen=$_POST['value3'];
//$screen=$_POST['value4'];
//$comment=$_POST['value5'];
$query = mysql_query("INSERT INTO `table` (value) VALUES('$value')") or die(mysql_error()); // We insert the value we want.For an example i inserted the "VALUE" name ,so its named as $value.
echo "Added successfuly.<br><a href=\"index.php\">Go to the index page..</a>";}?> // Successfuly added ,return to index ^^

 

Okay lets give explanations now.

  <input name="value" type="text" />

This is the value submitted.You can configurate this ,but you also gotta change the sql insert :

INSERT INTO `table` (value) VALUES('$value')")

which is configurated by

$value=$_POST['value'];

If you need more than 1 value ,you can remove the // before the $value1 value and it will be enabled.But you gotta insert it in the INSERT INTO syntax too and has to look something like this :

$query = mysql_query("INSERT INTO `table` (value,value1) VALUES('$value', '$value1')") or die(mysql_error());

 

Okay i think you got it.

Now how to view our already posted records in database?

Well if its successful ,you can make a file called view.php (example ,you can name it w/e u want)

Into this file lets export the records in this way .. Example of the file :

<?php include "conf.php"; // Change it to your config file name 
?>
<?php $q = mysql_query("SELECT * from TABLE order by id DESC"); // Getting the query
while($d = mysql_fetch_assoc($q)) {
		 echo 'Value is : '.$d['value'].''; } ?>

Lets see what we need to change

First the config file name (where are the database info's)

Then change the table which the file will connect

mysql_query("SELECT * from TABLE order by id DESC");

P.S. If you got a ORDER BY id error ,remove the "order by id" text :)

Okay ,everything we got ready from php side ,lets view the sql code now :

CREATE TABLE `TABLE NAME` (
`value` varchar(999) collate latin1_swedish_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=376 ; 

On the TABLE NAME write your table name that this code will create.

Execute it with navicat or w/e you are using ,and you're done :)

 

Extra scripts :

 

How to write the users IP when they submit?

Simple :) If you read that guide (all of it) you already know how to insert a new value.So make 1 ,and another colum in SQL by this code :

ALTER TABLE tablename
ADD columname varchar(250);

and execute in sql after you configurate it by your needs.

So make a new value in the php (with inserting in database) and @ put this in the start of the site :

<?php $ip=$_SERVER['REMOTE_ADDR']; ?>

and then insert the value as $ip in the sql insert syntax.

 

How to record all visitors IP's in a text file :

<?php
$file = fopen('ipadmin.txt', 'a'); // opens ,create a new file with storage
fwrite($file,$_SERVER['REMOTE_ADDR']."\n"); // Ip storing
fclose($file); // Close the file
echo "<br><b>Your ip was stored successfuly in ipadmin.txt file.</b>"; // if successful
?>

If you dont want your visitors not to understand that they'r ip is recorded ,remove this

echo "<br><b>Your ip was stored successfuly in ipadmin.txt file.</b>"; // if successful

 

Thanks for all who saw it ^^

 

The guide is MINE and its wroten specialy for the programmers in worldb0x ,but i shared it here too :)

Thanks for reading!

Posted

Nice Guide its like how to start programming with databases and php's basic functions :).

Keep it up mate.

Posted

Nice one for the newcomers.

If someone wants to gain more knowledge about this or other useful things, visit www.w3schools.com [server Scripting].

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Purchase Telegram Stars at a favorable price with minimal markup. New auctions from Telegram are expected, and our bot will help you prepare in advance. Active links: Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. Other services: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to SMM Panel: Go to – promotion of your social media accounts. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Purchase Telegram Stars at a favorable price with minimal markup. New auctions from Telegram are expected, and our bot will help you prepare in advance. Active links: Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. Other services: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to SMM Panel: Go to – promotion of your social media accounts. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Purchase Telegram Stars at a favorable price with minimal markup. New auctions from Telegram are expected, and our bot will help you prepare in advance. Active links: Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. Other services: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to SMM Panel: Go to – promotion of your social media accounts. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • 亲爱的合作伙伴! 目前我们非常需要以下项目: ➡ WhatsApp 老账户 ➡ Twitter 带粉丝和帖子账户(老账户) 请通过以下联系方式与我们联系。我们很高兴与您合作! 我们项目的有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram 信使方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快速且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 联系方式和支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Dear partners! At the moment we are in great need of the following positions: ➡ WhatsApp OLD Accounts ➡ Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock