- Licence Fondamentale d'Informatique
samedi 2 mars 2013

Creating a simple PHP forum tutorial (3/3)

Learn to create forum step by step, in this tutorials use only simple php code but powerful.

STEP6: Create file add_answer.php

############### Code
<?php

$host="localhost";
 // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="forum_answer"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// Get value of id that sent from hidden field 
$id=$_POST['id'];
// Find highest answer number. 
$sql="SELECT MAX(a_id) AS Maxa_id FROM $tbl_name WHERE question_id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);

// add + 1 to highest answer number and keep it in variable name "$Max_id". if there no answer yet set it = 1
if ($rows) {
$Max_id = $rows['Maxa_id']+1;
}
else {
$Max_id = 1;
}
// get values that sent from form 
$a_name=$_POST['a_name'];
$a_email=$_POST['a_email'];
$a_answer=$_POST['a_answer'];

$datetime=date("d/m/y H:i:s"); // create date and time

// Insert answer 

$sql2="INSERT INTO $tbl_name(question_id, a_id, a_name, a_email, a_answer, a_datetime)VALUES('$id', '$Max_id', '$a_name', '$a_email', '$a_answer', '$datetime')";
$result2=mysql_query($sql2);
if($result2){
echo "Successful<BR>";
echo "<a href='view_topic.php?id=".$id."'>View your answer</a>";

// If added new answer, add value +1 in reply column 

$tbl_name2="forum_question";
$sql3="UPDATE $tbl_name2 SET reply='$Max_id' WHERE id='$id'";
$result3=mysql_query($sql3);
}
else {
echo "ERROR";
}

// Close connection
mysql_close();
?>

Creating a simple PHP forum tutorial (2/3)

Learn to create forum step by step, in this tutorials use only simple php code but powerful.

STEP5: Create file view_topic.php

############### Code
<?php

$host="localhost";
 // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="forum_question"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get value of id that sent from address bar 
$id=$_GET['id'];
$sql="SELECT * FROM $tbl_name WHERE id='$id'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
?>


<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bordercolor="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F8F7F1"><strong><? echo $rows['topic']; ?></strong></td>
</tr>

<tr>
<td bgcolor="#F8F7F1"><? echo $rows['detail']; ?></td>
</tr>

<tr>
<td bgcolor="#F8F7F1"><strong>By :</strong> <? echo $rows['name']; ?><strong>Email : </strong><? echo $rows['email'];?></td>
</tr>

<tr>
<td bgcolor="#F8F7F1"><strong>Date/time : </strong><? echo $rows['datetime']; ?></td>
</tr>
</table></td>
</tr>
</table>
<BR>

<?php

$tbl_name2="forum_answer";
 // Switch to table "forum_answer"
$sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'";
$result2=mysql_query($sql2);
while($rows=mysql_fetch_array($result2)){
?>


<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F8F7F1"><strong>ID</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_id']; ?></td>
</tr>
<tr>
<td width="18%" bgcolor="#F8F7F1"><strong>Name</strong></td>
<td width="5%" bgcolor="#F8F7F1">:</td>
<td width="77%" bgcolor="#F8F7F1"><? echo $rows['a_name']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Email</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_email']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Answer</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_answer']; ?></td>
</tr>
<tr>
<td bgcolor="#F8F7F1"><strong>Date/Time</strong></td>
<td bgcolor="#F8F7F1">:</td>
<td bgcolor="#F8F7F1"><? echo $rows['a_datetime']; ?></td>
</tr>
</table></td>
</tr>
</table><br>

<?php
}
$sql3="SELECT view FROM $tbl_name WHERE id='$id'";
$result3=mysql_query($sql3);
$rows=mysql_fetch_array($result3);
$view=$rows['view'];

// if have no counter value set counter = 1
if(empty($view)){
$view=1;
$sql4="INSERT INTO $tbl_name(view) VALUES('$view') WHERE id='$id'";
$result4=mysql_query($sql4);
}

// count more value
$addview=$view+1;
$sql5="update $tbl_name set view='$addview' WHERE id='$id'";
$result5=mysql_query($sql5);
mysql_close();
?>

<BR>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="add_answer.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td width="18%"><strong>Name</strong></td>
<td width="3%">:</td>
<td width="79%"><input name="a_name" type="text" id="a_name" size="45"></td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="a_email" type="text" id="a_email" size="45"></td>
</tr>
<tr>
<td valign="top"><strong>Answer</strong></td>
<td valign="top">:</td>
<td><textarea name="a_answer" cols="45" rows="3" id="a_answer"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input name="id" type="hidden" value="<? echo $id; ?>"></td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

Creating a simple PHP forum tutorial (1/3)

Learn to create forum step by step, in this tutorials use only simple php code but powerful.

Overview

In this tutorial, create 5 files
1. create_topic.php
2. add_topic.php
3. main_forum.php
4. view_topic.php
5. add_answer.php

Steps
1. Create table name "forum_question" and "forum_answer" in database "test".
2. Create file create_topic.php.
3. Create file add_topic. php.
4. Create file main_forum.php
5. Create file view_topic.php
6. Create file add_answer.php
If you don't know how to create database and table read this tutorial 

STEP1: Set up database

Create database "test" and create 2 tables "forum_question" and table "forum_answer"

Table forum_question
CREATE TABLE `forum_question` (
`id` int(4) NOT NULL auto_increment,
`topic` varchar(255) NOT NULL default '',
`detail` longtext NOT NULL,
`name` varchar(65) NOT NULL default '',
`email` varchar(65) NOT NULL default '',
`datetime` varchar(25) NOT NULL default '',
`view` int(4) NOT NULL default '0',
`reply` int(4) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

Table forum_answer
CREATE TABLE `forum_answer` (
`question_id` int(4) NOT NULL default '0',
`a_id` int(4) NOT NULL default '0',
`a_name` varchar(65) NOT NULL default '',
`a_email` varchar(65) NOT NULL default '',
`a_answer` longtext NOT NULL,
`a_datetime` varchar(25) NOT NULL default '',
KEY `a_id` (`a_id`)
) TYPE=MyISAM;

STEP2: Create file create_topic.php

create php forum topic
############### Code
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form id="form1" name="form1" method="post" action="add_topic.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3" bgcolor="#E6E6E6"><strong>Create New Topic</strong> </td>
</tr>
<tr>
<td width="14%"><strong>Topic</strong></td>
<td width="2%">:</td>
<td width="84%"><input name="topic" type="text" id="topic" size="50" /></td>
</tr>
<tr>
<td valign="top"><strong>Detail</strong></td>
<td valign="top">:</td>
<td><textarea name="detail" cols="50" rows="3" id="detail"></textarea></td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50" /></td>
</tr>
<tr>
<td><strong>Email</strong></td>
<td>:</td>
<td><input name="email" type="text" id="email" size="50" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

STEP3: Create file add_topic.php

############### Code
<?php

$host="localhost";
 // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="forum_question"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get data that sent from form 
$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];

$datetime=date("d/m/y h:i:s"); //create date time

$sql="INSERT INTO $tbl_name(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>

STEP4: Create file main_forum.php

create php forum topic
############### Code
<?php

$host="localhost";
 // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="forum_question"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name ORDER BY id DESC";// OREDER BY id DESC is order result by descending
$result=mysql_query($sql);
?>


<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
<td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>


<?php

// Start looping table row
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td bgcolor="#FFFFFF">
<? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF">
<? echo $rows['view']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['reply']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['datetime']; ?></td>
</tr>


<?php// Exit looping and close connection
}
mysql_close();
?>


<tr>
<td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong> </a></td>
</tr>
</table>

Creating simple PHP contact form

When you need user to send feedback to your email, you can use contact form. In this tutorial you'll learn how to create contact form with php script.

Overview

if you want to test on you own computer you must set your computer as a mail server by using Argosoft mail server other softwares that have the same features as Argosoft.Read this tutorial for how to set up.
In this tutorial, create 2 files
1. contact.php
2. send_contact.php

Steps
1. Create file contact.php.
2. Create file send_contact.php.

STEP1: Create file contact.php


############### Code
<table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td><form name="form1" method="post" action="send_contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="16%">Subject</td>
<td width="2%">:</td>
<td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
</tr>
<tr>
<td>Detail</td>
<td>:</td>
<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
</tr>
<tr>
<td>Name</td>
<td>:</td>
<td><input name="name" type="text" id="name" size="50"></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>

STEP2: Create file send_contact.php


############### Code
<?php

// Contact subject
$subject ="$subject";

// Details

$message="$detail";

// Mail of sender

$mail_from="$customer_mail";

// From 

$header="from: $name <$mail_from>";

// Enter your email address

$to ='someone@somewhere.com';
$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message "We've recived your information"

if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

تحـَدّى الـ Facebook مع المجلة النـّـآدرة Se Ultimate



هذه واجهة الموقع 

This image has been resized. Click this bar to view the full image. The original image is sized 913x646.




سأبدأ بتعريف المجلة 

هي مزيج رائع بين الفايسبوك العالمي[Facebook] .. 

الهاي فايف [Hi5] و الماي سبايس [MySpace]

سوف نجد فيها العديد من الخاصيات كالمجموعات 

الصور و الالبومات

الموسيقى 

مقاطع الفيديو 

غرفة دردشة جميلة

و الكثير من الخاصيات الاخرى 



تحميل المجلة







نبدأ الشرح باسم الله 


الان حملنا المجلة و فككنا الظغط بال[Winrar] 

نرفع جميع محتويات المجلد الى موقعنا باستعمال اي برنامج [FTP]

انا استعمل [FileZilla]

This image has been resized. Click this bar to view the full image. The original image is sized 724x308.



الخطوة الثانية هي اعطاء التصاريح

للمجلدات التالية

(CHMOD 777) on the "/include" directory
(CHMOD 777) on the "/uploads_user" directory
(CHMOD 777) on the "/uploads_admin" directory
(CHMOD 777) on the "/uploads_admin/ads" directory
(CHMOD 777) on the "/include/smarty/templates_c" directory
(CHMOD 777) on every file inside the "/templates" directory [هنا التصاريح لكل الملفات]
(CHMOD 777) on the /mf_gifts directory
(CHMOD 777) on the /uploads_classified directory
(CHMOD 777) on the /uploads_event directory
(CHMOD 777) on the /uploads_group directory
(CHMOD 777) on the /uploads_userpoints directory
(CHMOD 777) on the /uploads_video directory
(CHMOD 777) on the /vidfeeder_cache directory


الان ننتقل الى تنصيب المجلة على موقعنا

ملاحظة: الان نحتاج لعمل قاعدة بيانات و لن اشرح ذلك لأن كل

استضافة و طريقتها في عمل هذه القاعدة و ثانيا اظن ان الاغلبية

تعرف الطريقة 

طيب الان نتجه الى







الان نملأ الخانات بما يناسب قاعدة البيانات


و نظغط 

ِConnect to MySQL Server

للإتصال بالقاعدة


تمام .. تم الاتصال بنجاح




الان نكمل

Continue...


This image has been resized. Click this bar to view the full image. The original image is sized 953x171.




This image has been resized. Click this bar to view the full image. The original image is sized 961x750.

تم تنصيب المجلة بنجاح 

مبروك


الان لا ننسى ان نحذف الملفين 

Install.php
Installsql.php



ندخل الى الادارة باستعمال الباس اللذي وضعته لنا المجلة


This image has been resized. Click this bar to view the full image. The original image is sized 738x327.




هذه هي واجهة الادمن 


This image has been resized. Click this bar to view the full image. The original image is sized 942x594.


الان ننصب الإضافات او كما قلت الخاصيات

نتجه الى 

View Plugins

ثم ننصب الاضافات واحدة تلو الاخرى

This image has been resized. Click this bar to view the full image. The original image is sized 829x614.



تمام الان انتهى الشرح




ان شاء الله يكون الشرح مفهوم 

الى شرح اخر

تحياتي

Source  : http://www.tunisia-sat.com/vb/showthread.php?t=959714

Cracker un compte Premium des hébergeurs de fichiers



Vous en avez marre des comptes gratuits trop limités, de la vitesse de téléchargement atone, de l'impossibilité de reprendre vos téléchargement, du temps d'attente,...etc. Alors mettez vous à l'action et suivez les instructions de ce modeste tutoriel pour pouvoir télécharger avec un compte Premium, sans limite quotidienne, avec une vitesse évanescente, en ayant toujours la possibilité de mettre en pause et de reprendre vos téléchargement.

c'est un rêve? oui mais avec Les Meilleurs Tutoriels c'est possible en quelques minutes, avec quelques cliques et 100% Gratuit.
Les Besoins :
  • L'applicatif MCG (Multi Cookie Generator)
Cliquer+ici
  • Un module complémentaire pour la gestion des Cookies
Navigateur
Mozila Firefox
Google Chrome
Module
  • Un petit compte sur le site  TomTest.net
Les Instructions :

N.B: les éléments à rechercher pour modifier ou à ajouter selon le serveur d'hébergement sont:
Hébergeur
Cookie
Hotfile
auth
Bayfiles
SESSID
Filefactory
ff_membership
Fast-debrid
fast
Oron
xfss
Uploaded.to
login
Hébergeur
Cookie
Rapidshare
enc
Netload.in
cookie_user
Depositfiles
autologin
Alldebrid
uid
Rapidgator
user__
Extabit
PHPSESSID
Hébergeur
Cookie
Debrid-Link
PHPSESSID
Ok2upload
xfss
Ryushare
xfss
Filereactor
xfss
Filevelocity
xfss
------------
-------------

Windows 8 : Formation vidéo pour découvrir les nouveautés


Ce parcours de formation va vous permettre de découvrir Windows 8, le nouveau système d'exploitation de Microsoft depuis mars 2012. La grande nouveauté de Windows 8 réside dans le menu démarrer. En effet, ce dernier est devenu une véritable interface indépendante, qu'on appelle aussi l'interface Metro. Le nouveau menu démarrer devient la page d'accueil de Windows 8. Se présentant sous forme de mosaïque, il permet d'accéder rapidement à toutes les applications. Il est possible de le personnaliser en y ajoutant d'autres applications, des dossiers personnels, et même des pages internet. Adapté aux écrans tactiles, la navigation se fait à travers plusieurs volets. Vous verrez aussi comment organiser vos comptes utilisateurs, et comment basculer de l'un à l'autre. L'explorateur Windows a lui aussi évolué, puisque les outils sont organisés dans des rubans. Vous verrez les principales nouveautés de Windows 8.

1h23mn de formation - 20 vidéos
Pour visualiser une vidéo cliquez sur le bouton Play et pour la télécharger cliquez sur le texte descriptif 


 
-