par
papayou_s » 29 oct. 2006, 17:48
bonjour j utilise un script de top site . son nom atsphp-5.1.2 il est anglais
j aimerai changer a fonction du champ à l interieur . Celui de la banniere .
Dans le script lorsqu une personne s enregistre elle dois donner l url de ça banniere. cette url est enregistre dans la base de donnée et pas l image de la banniere .
Moi ce que j aimerai c est de uploader , renomer, redimentionner et enregistrer l image sur mon serveur dans un dossier .
Dans ma base de donnée j aimerai enregistrer le chemin qui mene au dossier ou à ete enregisté la banniere corespondant au site qui viens de s enregistrer
se script et composé de deux fichier . il se combine ensemble join.php et join_form.html meme un petit aide de rien du tous me ferai plaisir car je suis debutante et je suis coinçé depuis un moment et encore merci de bien vouloir m aider
voici le fichier join.php
Code : Tout sélectionner
<?php
//===========================================================================
// Aardvark Topsites PHP 5
// Copyright (c) 2003-2006 Jeremy Scheff. All rights reserved.
//---------------------------------------------------------------------------
// http://www.aardvarktopsitesphp.com/http://www.avatic.com/
//---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//===========================================================================
if (!defined('ATSPHP')) {
die("This file cannot be accessed directly.");
}
class join extends join_edit {
function join() {
global $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['join_header'];
if (!isset($FORM['submit'])) {
$this->form();
}
else {
$this->process();
}
}
function form() {
global $CONF, $FORM, $LNG, $TMPL;
if ($CONF['captcha']) {
$TMPL['join_captcha'] = $this->do_skin('join_captcha');
}
else {
$TMPL['join_captcha'] = '';
}
$TMPL['categories_menu'] = "<select name="category">n";
foreach ($CONF['categories'] as $cat => $skin) {
if ($TMPL['category'] == $cat) {
$TMPL['categories_menu'] .= "<option value="{$cat}" selected="selected">{$cat}</option>n";
}
else {
$TMPL['categories_menu'] .= "<option value="{$cat}">{$cat}</option>n";
}
}
$TMPL['categories_menu'] .= "</select>";
if (!isset($TMPL['url'])) { $TMPL['url'] = 'http://'; }
if (!isset($TMPL['banner_url'])) { $TMPL['banner_url'] = 'http://'; }
if (isset($TMPL['url'])) { $TMPL['url'] = stripslashes($TMPL['url']); }
if (isset($TMPL['title'])) { $TMPL['title'] = stripslashes($TMPL['title']); }
if (isset($TMPL['description'])) { $TMPL['description'] = stripslashes($TMPL['description']); }
if (isset($TMPL['category'])) { $TMPL['category'] = stripslashes($TMPL['category']); }
if (isset($TMPL['banner_url'])) { $TMPL['banner_url'] = stripslashes($TMPL['banner_url']); }
if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }
$TMPL['content'] = $this->do_skin('join_form');
}
function process() {
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['username'] = $DB->escape($FORM['u'], 1);
$TMPL['url'] = $DB->escape($FORM['url'], 1);
$TMPL['title'] = $DB->escape($FORM['title'], 1);
$FORM['description'] = str_replace(array("rn", "n", "r"), ' ', $FORM['description']);
$TMPL['description'] = $DB->escape($FORM['description'], 1);
$TMPL['category'] = $DB->escape($FORM['category'], 1);
$TMPL['banner_url'] = $DB->escape($FORM['banner_url'], 1);
$TMPL['email'] = $DB->escape($FORM['email'], 1);
$TMPL['title'] = $this->bad_words($TMPL['title']);
$TMPL['description'] = $this->bad_words($TMPL['description']);
if ($this->check_input('join')) {
$password = md5($FORM['password']);
require_once("{$CONF['path']}/sources/in.php");
$short_url = in::short_url($TMPL['url']);
$join_date = date('Y-m-d', time() + (3600*$CONF['time_offset']));
$DB->query("INSERT INTO {$CONF['sql_prefix']}_sites (username, password, url, short_url, title, description, category, banner_url, email, join_date, active, openid)
VALUES ('{$TMPL['username']}', '{$password}', '{$TMPL['url']}', '{$short_url}', '{$TMPL['title']}', '{$TMPL['description']}', '{$TMPL['category']}', '{$TMPL['banner_url']}', '{$TMPL['email']}', '{$join_date}', {$CONF['active_default']}, 0)", __FILE__, __LINE__);
$DB->query("INSERT INTO {$CONF['sql_prefix']}_stats (username) VALUES ('{$TMPL['username']}')", __FILE__, __LINE__);
if ($CONF['google_friendly_links']) {
$TMPL['verbose_link'] = "";
}
else {
$TMPL['verbose_link'] = "index.php?a=in&u={$TMPL['username']}";
}
$TMPL['link_code'] = $this->do_skin('link_code');
$LNG['join_welcome'] = sprintf($LNG['join_welcome'], $TMPL['list_name']);
if ($CONF['active_default']) {
$TMPL['approve_message'] = '';
}
else {
$TMPL['approve_message'] = $LNG['join_approve'];
}
$join_email = new skin('join_email');
$join_email->send_email($TMPL['email']);
if ($CONF['email_admin_on_join']) {
$join_email_admin = new skin('join_email_admin');
$join_email_admin->send_email($CONF['your_email']);
}
$TMPL['content'] = $this->do_skin('join_finish');
}
else {
$this->form();
}
}
}
?>
et en dessous le formulaire join_form.html se script sous LICENSE GNU
Code : Tout sélectionner
<form action="index.php?a=join" method="post" name="join_form">
<fieldset>
<legend>{$lng->join_user}</legend>
<div class="{$error_style_username}"><label>{$lng->g_username}<br />
<input type="text" name="u" size="20" value="{$username}" />
{$error_username}
</label></div><br />
<div class="{$error_style_password}"><label>{$lng->g_password}<br />
<input type="password" name="password" size="20" value="{$password}" />
{$error_password}
</label></div>
</fieldset>
<fieldset>
<legend>{$lng->join_website}</legend>
<div class="{$error_style_url}"><label>{$lng->g_url}<br />
<input type="text" name="url" size="50" value="{$url}" />
{$error_url}
</label></div><br />
<div class="{$error_style_title}"><label>{$lng->g_title}<br />
<input type="text" name="title" size="50" value="{$title}" />
{$error_title}
</label></div><br />
<label>{$lng->g_description}<br />
<textarea cols="40" rows="5" name="description">{$description}</textarea><br /><br />
</label>
<label>{$lng->g_category}<br />
{$categories_menu}<br /><br />
</label>
<div class="{$error_style_banner_url}"><label>{$lng->g_banner_url}<br />
<input type="text" name="banner_url" size="50" value="{$banner_url}" />
{$error_banner_url}
</label></div><br />
<div class="{$error_style_email}"><label>{$lng->g_email}<br />
<input type="text" name="email" size="50" value="{$email}" />
{$error_email}
</label></div><br />
{$join_captcha}
<input name="submit" type="submit" value="{$lng->join_header}" />
</fieldset>
</form>
dans la base j ai 9 tables les enregistrement des sites se font dans la table _sites
la table _site est composé des champs suivant
username / password / url / short_url / title / description / category / banner_url / email / fichier / join_date / active
bonjour j utilise un script de top site . son nom atsphp-5.1.2 il est anglais
j aimerai changer a fonction du champ à l interieur . Celui de la banniere .
Dans le script lorsqu une personne s enregistre elle dois donner l url de ça banniere. cette url est enregistre dans la base de donnée et pas l image de la banniere .
Moi ce que j aimerai c est de uploader , renomer, redimentionner et enregistrer l image sur mon serveur dans un dossier .
Dans ma base de donnée j aimerai enregistrer le chemin qui mene au dossier ou à ete enregisté la banniere corespondant au site qui viens de s enregistrer
se script et composé de deux fichier . il se combine ensemble join.php et join_form.html meme un petit aide de rien du tous me ferai plaisir car je suis debutante et je suis coinçé depuis un moment et encore merci de bien vouloir m aider
voici le fichier join.php
[code]
<?php
//===========================================================================
// Aardvark Topsites PHP 5
// Copyright (c) 2003-2006 Jeremy Scheff. All rights reserved.
//---------------------------------------------------------------------------
// http://www.aardvarktopsitesphp.com/http://www.avatic.com/
//---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
// Public License for more details.
//===========================================================================
if (!defined('ATSPHP')) {
die("This file cannot be accessed directly.");
}
class join extends join_edit {
function join() {
global $FORM, $LNG, $TMPL;
$TMPL['header'] = $LNG['join_header'];
if (!isset($FORM['submit'])) {
$this->form();
}
else {
$this->process();
}
}
function form() {
global $CONF, $FORM, $LNG, $TMPL;
if ($CONF['captcha']) {
$TMPL['join_captcha'] = $this->do_skin('join_captcha');
}
else {
$TMPL['join_captcha'] = '';
}
$TMPL['categories_menu'] = "<select name="category">n";
foreach ($CONF['categories'] as $cat => $skin) {
if ($TMPL['category'] == $cat) {
$TMPL['categories_menu'] .= "<option value="{$cat}" selected="selected">{$cat}</option>n";
}
else {
$TMPL['categories_menu'] .= "<option value="{$cat}">{$cat}</option>n";
}
}
$TMPL['categories_menu'] .= "</select>";
if (!isset($TMPL['url'])) { $TMPL['url'] = 'http://'; }
if (!isset($TMPL['banner_url'])) { $TMPL['banner_url'] = 'http://'; }
if (isset($TMPL['url'])) { $TMPL['url'] = stripslashes($TMPL['url']); }
if (isset($TMPL['title'])) { $TMPL['title'] = stripslashes($TMPL['title']); }
if (isset($TMPL['description'])) { $TMPL['description'] = stripslashes($TMPL['description']); }
if (isset($TMPL['category'])) { $TMPL['category'] = stripslashes($TMPL['category']); }
if (isset($TMPL['banner_url'])) { $TMPL['banner_url'] = stripslashes($TMPL['banner_url']); }
if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }
$TMPL['content'] = $this->do_skin('join_form');
}
function process() {
global $CONF, $DB, $FORM, $LNG, $TMPL;
$TMPL['username'] = $DB->escape($FORM['u'], 1);
$TMPL['url'] = $DB->escape($FORM['url'], 1);
$TMPL['title'] = $DB->escape($FORM['title'], 1);
$FORM['description'] = str_replace(array("rn", "n", "r"), ' ', $FORM['description']);
$TMPL['description'] = $DB->escape($FORM['description'], 1);
$TMPL['category'] = $DB->escape($FORM['category'], 1);
$TMPL['banner_url'] = $DB->escape($FORM['banner_url'], 1);
$TMPL['email'] = $DB->escape($FORM['email'], 1);
$TMPL['title'] = $this->bad_words($TMPL['title']);
$TMPL['description'] = $this->bad_words($TMPL['description']);
if ($this->check_input('join')) {
$password = md5($FORM['password']);
require_once("{$CONF['path']}/sources/in.php");
$short_url = in::short_url($TMPL['url']);
$join_date = date('Y-m-d', time() + (3600*$CONF['time_offset']));
$DB->query("INSERT INTO {$CONF['sql_prefix']}_sites (username, password, url, short_url, title, description, category, banner_url, email, join_date, active, openid)
VALUES ('{$TMPL['username']}', '{$password}', '{$TMPL['url']}', '{$short_url}', '{$TMPL['title']}', '{$TMPL['description']}', '{$TMPL['category']}', '{$TMPL['banner_url']}', '{$TMPL['email']}', '{$join_date}', {$CONF['active_default']}, 0)", __FILE__, __LINE__);
$DB->query("INSERT INTO {$CONF['sql_prefix']}_stats (username) VALUES ('{$TMPL['username']}')", __FILE__, __LINE__);
if ($CONF['google_friendly_links']) {
$TMPL['verbose_link'] = "";
}
else {
$TMPL['verbose_link'] = "index.php?a=in&u={$TMPL['username']}";
}
$TMPL['link_code'] = $this->do_skin('link_code');
$LNG['join_welcome'] = sprintf($LNG['join_welcome'], $TMPL['list_name']);
if ($CONF['active_default']) {
$TMPL['approve_message'] = '';
}
else {
$TMPL['approve_message'] = $LNG['join_approve'];
}
$join_email = new skin('join_email');
$join_email->send_email($TMPL['email']);
if ($CONF['email_admin_on_join']) {
$join_email_admin = new skin('join_email_admin');
$join_email_admin->send_email($CONF['your_email']);
}
$TMPL['content'] = $this->do_skin('join_finish');
}
else {
$this->form();
}
}
}
?>
[/code]
et en dessous le formulaire join_form.html se script sous LICENSE GNU
[code]
<form action="index.php?a=join" method="post" name="join_form">
<fieldset>
<legend>{$lng->join_user}</legend>
<div class="{$error_style_username}"><label>{$lng->g_username}<br />
<input type="text" name="u" size="20" value="{$username}" />
{$error_username}
</label></div><br />
<div class="{$error_style_password}"><label>{$lng->g_password}<br />
<input type="password" name="password" size="20" value="{$password}" />
{$error_password}
</label></div>
</fieldset>
<fieldset>
<legend>{$lng->join_website}</legend>
<div class="{$error_style_url}"><label>{$lng->g_url}<br />
<input type="text" name="url" size="50" value="{$url}" />
{$error_url}
</label></div><br />
<div class="{$error_style_title}"><label>{$lng->g_title}<br />
<input type="text" name="title" size="50" value="{$title}" />
{$error_title}
</label></div><br />
<label>{$lng->g_description}<br />
<textarea cols="40" rows="5" name="description">{$description}</textarea><br /><br />
</label>
<label>{$lng->g_category}<br />
{$categories_menu}<br /><br />
</label>
<div class="{$error_style_banner_url}"><label>{$lng->g_banner_url}<br />
<input type="text" name="banner_url" size="50" value="{$banner_url}" />
{$error_banner_url}
</label></div><br />
<div class="{$error_style_email}"><label>{$lng->g_email}<br />
<input type="text" name="email" size="50" value="{$email}" />
{$error_email}
</label></div><br />
{$join_captcha}
<input name="submit" type="submit" value="{$lng->join_header}" />
</fieldset>
</form>
[/code]
dans la base j ai 9 tables les enregistrement des sites se font dans la table _sites
la table _site est composé des champs suivant
username / password / url / short_url / title / description / category / banner_url / email / fichier / join_date / active