Existing user? Sign in
Sign up
Games
Servers
Useful
User
Pass
2FA
PHP Intrebare
Freakz Forum Index
->
Trash Bin
->
Trash
->
Programming / Scripting / Database
Author
Message
860
LolzyTM
[Mentally Stable]
Status: Offline
(since 08-11-2012 15:22)
Joined: 24 Feb 2011
Posts: 31
,
Topics: 19
Location:
Romania
Reputation:
86.2
Votes
: 2
Posted: 26-01-2012, 21:31:11
| Translate post to:
... (
Click for more languages
)
Salu ...uite care'i treaba daca ma puteti ajuta am un cod care introduce in baza de date anumite date...
Codul este acesta : care se numeste adaugameci.php
Cod:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator CMS</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/assets/css/ng_all.css">
<style type="text/css">
<!--
body {
background-image: url(images/camo.jpg);
}
a:link {
color: #806547;
}
-->
</style></head>
<body>
<table width="275" border="0" style="position:absolute; left: 6px; top: 13px; width: 319px; height: 35px;" align="right" class="roundtable111">
<tr>
<td><a href="admin.php">Panoul Central</a> | <a href="logout.php">Logout</a> |
<?
session_start();
if(!session_is_registered(myusername)){
header("location:login.php");
}
echo 'Esti logat cu user-ul:' . ' ' . '<b>' . $_SESSION['myusername'] . '<b>';
?></td>
</tr>
</table>
<table width="410" height="47" border="0" align="center" class="roundtable111">
<tr>
<td width="363" height="43"><?php
include('connect_to_mysql.php');
if(isset($_POST['addcomment'])) /// daca butonul "addcomment" a fost apasat !
{ session_start();
$titlu = $_POST['titlu'];
$data = $_POST['data'];
$locatia = $_POST['locatia'];
$ora = $_POST['ora'];
$intalnirea = $_POST['intalnirea'];
$scenarii = $_POST['scenarii'];
$echipament = $_POST['echipament'];
$inchirieri = $_POST['inchirieri'];
$detalii = $_POST['detalii'];
$autor = $_SESSION['myusername'];
$data1 = $_POST['data1'];
// trim => elimina spatiile goale de la inceput si sfarsit
// addslashes => baga niste slashes daca cineva incearca sa iti bage in forma cod pt sql injection hack
// strip_tags => elimina caracterele speciale daca cineva incearca sa bage in comment scripturi, sau coduri malitioase
print(' ' . ' ' . '<b>' . '<u>' . $titlu . '</u>' . '</b>');
if(strlen($titlu) > 0) // /daca lungimea cuintelor introduse este mai mare ca zero
{
$sql = "INSERT INTO meciuri (titlu ,data ,locatia ,ora ,intalnirea ,scenarii ,echipament ,inchirieri ,detalii ,autor ,data1) VALUES ('$titlu','$data','$locatia','$ora','$intalnirea','$scenarii','$echipament','$inchirieri','$detalii','$autor',now())";
mysql_query($sql) or die("error inserting user : $sql");
//header("Location: index.php");
echo ' ' . ' ' . ' a fost adaugat';
}
else
{
echo "Nu ai completat toate campurile!";
}
}
?>
</td>
</tr>
</table>
<p> </p>
<table width="695" border="0" align="center" class="roundtable111">
<tr>
<td width="689" height="373">
<center>
<form action="adaugameci.php" style="background-color:#CCC" method="post">
<p> </p>
<p> </p><center>
<table width="417" border="0" align="center" style="positsion:absolute; left: 430px; top: 146px; width: 392px;">
<tr>
<td width="5"> </td>
<td width="89">Titlu:</td>
<td width="161"><input type="text" id="titlu" name="titlu"/></td>
<td width="144">MAX 10 Caractere</td>
</tr>
<tr>
<td> </td>
<td>Data meciului:</td>
<td> <input type="text" id="data" name="data"/></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Locatia meciului:</td>
<td><input type="text" id="locatia" name="locatia"/> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Ora meciului:</td>
<td><input type="text" id="ora" name="ora"/> </td>
<td><div style="text-align:left;">[Ora:Min] AM/PM</div></td>
</tr>
<tr>
<td> </td>
<td>Scenarii propuse:</td>
<td><input type="text" id="scenarii" name="scenarii"/> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Locul intalnirii:</td>
<td><textarea id="intalnirea" name="intalnirea"/></textarea></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Echipament</td>
<td><textarea id="echipament" name="echipament"/></textarea></td>
<td> </td>
</tr>
<tr>
<td height="39"> </td>
<td>Inchirierii:</td>
<td><textarea id="inchirieri" name="inchirieri"/></textarea></td>
<td> </td>
</tr>
</table>
Detalii:<br />
<br />
<script type="text/javascript">
var ng_config = {
assests_dir: 'assets/'
}
</script>
<script type="text/javascript" src="ng_all.js"></script>
<script type="text/javascript" src="components/calendar.js"></script>
<script type="text/javascript">
var my_cal;
ng.ready(function(){
my_cal = new ng.Calendar({
input: 'data',
start_date: 'year - 1',
display_date: new Date()
});
});
</script>
<textarea id="detalii" name="detalii" class="textarea" style="height: 100px; width: 300px; background-color:#FFF;">
</textarea>
</center>
</p>
<p>
<input name="addcomment" type="submit" id="addcomment" value="Posteaza!">
</p>
</form></center></td>
</tr>
</table>
<table width="538" border="0" align="center" class="roundtable111">
<tr>
<td width="532" align="right" valign="top"><h4>Stergere Postari:</h4><br />
<script type="text/javascript">
function show_confirm()
{
var r=confirm("Esti sigur ca vrei sa Stergi Postarea?");
if (r==true)
{
alert("Postare Stearsa cu succes!");
}
else
{
alert("Stergerea a fost anulata!");
}
}
</script>
<?php
require('connect_to_mysql.php');
$deleteid=(int)$_GET['id'];
mysql_query("DELETE FROM meciuri WHERE id='$deleteid'");
?>
<?php
require('connect_to_mysql.php');
$query=mysql_query("SELECT * FROM meciuri ORDER BY id DESC");
while($rows=mysql_fetch_assoc($query))
{
$titlu=$rows['titlu'];
print('ID MECI:' . ' ' .$rows['id']);
$data=$rows['data'];
$locatia=$rows['locatia'];
$intalnirea=$rows['intalnirea'];
$scenarii=$rows['scenarii'];
$echipament=$rows['echipament'];
$inchirieri=$rows['inchirieri'];
$detalii=$rows['detalii'];
$autor=$rows['autor'];
$data1=$rows['data1'];
$linkdel= '<a href="adaugameci.php?id='.$rows['id'].'" onclick="show_confirm()">Sterge</a>';
echo 'Titlu:' . ' ' . '<b>' . $titlu . '</b>' . ' ' . '-' . ' ' . 'Din Data:' . ' ' . '<b>' . $date1 . '</b>' . ' ' . '-' . ' ' . 'Postata de:' . ' ' . '<b>' . $autor . '</b>' . ' ' . '-' . ' ' . $linkdel . '<br>';
}
?> </td>
</tr>
</table>
</body>
</html>
Ok nu'i aci' e prob... si mai am un cod care afiseaza ce ai introdus in baza de date din adaugameciuri.php :
meciuri.php:
Cod:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Despre noi Brasov Airsoft TEAM</title>
<link rel="stylesheet" href="menu_style.css" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="social.css" />
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="lightbox.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="staticlogo.js"></script>
<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />
<style type="text/css">
<!--
body {
background-image: url(images/camo.jpg);
background-repeat: repeat;
background-color: #1E1E1E;
}
</style>
<!-- Script facut de Bocos Alexandru -->
<script LANGUAGE="JavaScript">
var moto = new Array()
moto[0] = '<a href="slide/img7.JPG" rel="lightbox[roadtrip]"><img src="slide/img7.JPG" width="177" height="115" /></a>'
moto[1] = '<a href="slide/img2.JPG" rel="lightbox[roadtrip]"><img src="slide/img2.JPG" width="177" height="115" /></a>'
moto[2] = '<a href="slide/img3.JPG" rel="lightbox[roadtrip]"><img src="slide/img3.JPG" width="177" height="115" /></a>'
moto[3] = '<a href="slide/img4.JPG" rel="lightbox[roadtrip]"><img src="slide/img4.JPG" width="177" height="115" /></a>'
moto[4] = '<a href="slide/img5.JPG" rel="lightbox[roadtrip]"><img src="slide/img5.JPG" width="177" height="115" /></a>'
moto[5] = '<a href="slide/img6.JPG" rel="lightbox[roadtrip]"><img src="slide/img6.JPG" width="177" height="115" /></a>'
moto[6] = '<a href="slide/img7.JPG" rel="lightbox[roadtrip]"><img src="slide/img7.JPG" width="177" height="115" /></a>'
moto[7] = '<a href="slide/img8.JPG" rel="lightbox[roadtrip]"><img src="slide/img8.JPG" width="177" height="115" /></a>'
moto[8] = '<a href="slide/img9.JPG" rel="lightbox[roadtrip]"><img src="slide/img9.JPG" width="177" height="115" /></a>'
moto[9] = '<a href="slide/img10.JPG" rel="lightbox[roadtrip]"><img src="slide/img10.JPG" width="177" height="115" /></a>>'
var j = 0
var p = moto.length;
var preBuffer = new Array()
var schimbaremoto = Math.round(Math.random()*(p-1));
function motouri(){
if(schimbaremoto==0){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==1){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==2){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==3){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==4){ document.write(moto[schimbaremoto]);}
else if(schimbaremoto==5){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==6){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==7){ document.write(moto[schimbaremoto]); }
else if(schimbaremoto==8){ document.write(moto[schimbaremoto]);}
else if(schimbaremoto==9){ document.write(moto[schimbaremoto]);}
}
</script>
</head>
<body>
<div class="banner1"><img src="images/banner2.gif" width="451" border="0" alt="#" onmouseover="this.src='images/banner.gif'" onmouseout="this.src='images/banner2.gif'" /></div>
<p></p>
<p> </p>
<p> </p>
<p> </p>
<p><br />
</p>
<div align="left" width="200" class="logo"><img src="images/logo.gif" width="150" height="164" /></div>
<table width="1013" height="489" border="0" align="center" class="roundtable111">
<tr>
<td width="181" height="43" align="left" valign="top"> </td>
<td width="822" align="left" valign="top"><div>
<ul id='menu'>
<li class="button"><a href='index.php' >Home</a></li>
<li class="button"><a class='current' href='despre.php' >Despre noi</a></li>
<li class="button"><a href='regulament.php' >Regulament Airsoft</a></li>
<li class="button"><a href='photo.php' >Galerie Foto</a></li>
<li class="button"><a href='echipa.php' >Echipa BAT</a></li>
<li class="button"><a href='forum.php' >Forum</a></li>
<li class="button"><a href='contact.php' >Contact</a> </li>
</ul>
</div></td>
</tr>
<tr>
<td height="440" align="left" valign="top"><table width="184" height="142" border="0" class="roundtable1112">
<tr>
<td valign="middle"><script>motouri();</script></td>
</tr>
</table></td>
<td align="left" valign="top" ><table width="342" border="0" align="center" class="update2">
<tr>
<td width="42" align="left" valign="top">
<?php
require('connect_to_mysql.php');
$query=mysql_query("SELECT * FROM meciuri ORDER BY id DESC");
while($rows=mysql_fetch_assoc($query))
{
$titlu=$rows['titlu'];
$data=$rows['data'];
$locatia=$rows['locatia'];
$intalnirea=$rows['intalnirea'];
$scenarii=$rows['scenarii'];
$echipament=$rows['echipament'];
$inchirieri=$rows['inchirieri'];
$detalii=$rows['detalii'];
$autor=$rows['autor'];
$data1=$rows['data1'];
echo '<div align="left">' . '<img src="images/autor.png" width="16" height="16"/>' . ' ' . 'Autor:' . ' ' . $autor . ' ' . ' ' . ' ' . '<img src="images/calendarday.png" width="16" height="16"/>' . ' ' . 'Data postari:' . ' ' . $data1 . '<br />' . '<br />' . '<br />' . '<h2>' . $titlu . '</h2>' . '<br>' . '<br>' . 'Data meciului:' . ' ' . ' ' . $data . '<br>' . 'Locatia meciului:' . ' ' . ' ' . $locatia . '<br>' . 'Locul intalniri:' . ' ' . ' ' . $intalnirea . '<br>' . 'Scenarii propuse:' . ' ' . ' ' . $scenarii . '<br>' . 'Echipament necesar, pe langa cel de baza:' . ' ' . ' ' . $echipament . '<br>' . 'Inchirieri replicii:' . ' ' . ' ' . $inchirieri . ' ' . ' ' . '(a se lua legatura cu cel care inchireaza)' . '<br>' . 'Alte detalii:' . ' ' . ' ' . $detalii . '<br>' . '</div>' . '<hr align="left" style="border-style:solid color:#595944" size="1" width="750"/>' . '<br>' . '<a href="meciuri.php?id'.$rows['id'].'" http://airsoftbv.vacau.com' ;
}
?></td>
</tr>
</table></td>
</tr>
</table>
<br />
<table width="672" height="94" border="0" align="center" class="roundtable111">
<tr>
<td width="666" height="90"><div valign="top" id="social"><a href="http://facebook.com"><img src="images/facebook.png" border="0" width="35" height="35" /></a> <a href="http://youtube.com/"><img src="images/youtube.png" width="35" border="0" height="35" /></a></div>
<table style="text-align:center" width="670" border="0">
<tr>
<td width="570" height="19"> Copyright © 2012 Toate drepturile rezervate Airsoft Brasov</td>
<td width="90"> </td>
</tr>
</table></td>
</tr>
</table>
<p> </p>
</body>
</html>
Ok cu ce vreau sa ma ajuti... As vrea in loc sa afiseze in meciuri.php toate datele sa imi arate doar un link care duce catre o pagina cu meciul separat....si am cautat in tot netul dar nu stiu cum sa fac... daca ma poti ajuta iti sunt f recunoscator..- Ms mult!
0
0
Back to top
Freakz Forum Index
->
Trash Bin
->
Trash
->
Programming / Scripting / Database
The time now is 01-12-2024, 22:24:50
Copyright info
Based on phpBB
ro
/
com
B
Login
I forgot my password
World of Warcraft
Login for more...
Download WoW 7.3.5
Misc
eSports
Achievements
Buy reputation with votes
Reputation trades
Forum rules
Ban list
Members list
User guide (FAQ)
World of Warcraft
View details