Hallo. ich hoffe Ihr könnt mir helfen?
Also es handelt sich um ein Linklisten Script.
Ist das Eingabe Formular.
Diese angaben werden dann an :
Gesendet.
Das bedeutet wenn also zum zweiten mal ein link mit dem Namen “ich” erstellt wird der erste überschrieben.
Laut einer Idee müsste also:
Abfragen ob es “ich” schon gibt und wenn nicht, dann erst die Kategorie erstellen?
Wenn ja wie?
Ich denke es hat etwas mit:
REPLACE INTO ".$prefix."_links (title) VALUES ('$title')
oder:
INSERT IGNORE INTO ".$prefix."_links (title) VALUES ('$$title')
zu tun?
Welches ich irgendwo einfügen müsste?
Aber wie und wo?
Also es handelt sich um ein Linklisten Script.
PHP Code:
<?php
include("inc/config.inc.php");
include("inc/header.inc.php");
include("lang/$language.php");
?>
<? echo $lang_link_add; ?><p><form name="form1" method="post" action="save.php">
<table class=table width="40%" border="0">
<tr>
<td width="25%"><b><? echo "$lang_name"; ?></b></td>
<td width="75%"><input type="text" name="title"></td>
</tr>
<tr>
<td width="25%"><b>URL: </b>(ohne http://!)</td>
<td width="75%"><input type="text" name="url"></td>
</tr>
<tr>
<td width="25%"><b><? echo $lang_desc;?>:</b></td>
<td width="75%"><textarea name="description" cols="30" rows="5"></textarea></td>
</tr>
<tr>
<td width="25%"><b><? echo $lang_lang; ?>:</b></td>
<td width="75%"><input type="text" name="lang"></td>
</tr>
<tr>
<td width="25%"><b><? echo $lang_category; ?>:</b></td>
<td width="75%">
<select name="cat">
<?php
$conn = mysql_connect($mysqlhost,$mysqluser,$mysqlpw) or die("$lang_no_conn");
mysql_select_db($database,$conn) or die ("$lang_no_conn");
$query = "select name from ".$prefix."_categories";
$result = mysql_query($query);
while($row=mysql_fetch_array($result))
{
$cat = $row['name'];
echo "<option value='$cat'>$cat</option>";
}
?>
</select></td>
</tr>
</table><br><? echo $lang_not_release; ?><br>
<table class=table width="40%" border="0">
<tr>
<td width="25%"><b><?php echo $lang_yourname; ?>:</b></td>
<td width="75%"><input type="text" name="name"></td>
</tr>
<tr>
<td width="25%"><b><?php echo $lang_youremail;?>:</b></td>
<td width="75%"><input type="text" name="email"></td>
</tr>
<tr>
<td width="25%"><b><?php echo $lang_yourpassword; ?>:</b></td>
<td width="75%"><input type="password" name="password"></td>
</tr>
</table>
<input type="hidden" name="link" value="add">
<input type="submit" name="submit" value="Abschicken">
</form>
<?php
include("inc/footer.inc.php");
?>
Diese angaben werden dann an :
PHP Code:
<?php
include("inc/config.inc.php");
include("lang/$language.php");
$conn = mysql_connect($mysqlhost,$mysqluser,$mysqlpw) or die("$lang_no_conn");
mysql_select_db($database,$conn) or die("$lang_no_conn");
switch($link)
{
case "add":
if($title=="" or $url=="" or $description=="" or $lang=="" or $cat=="" or $name=="" or $email=="" or $password=="")
{
include("inc/header.inc.php");
echo "$lang_forget_field";
include("inc/footer.inc.php");
}
else
{
$title = str_replace("'"," (--) ",$title);
$date = time();
$query = "insert into ".$prefix."_links (title,active,url,description,lang,date,visits,rating,votes,category,name,email,password) values ('$title','yes','$url','$description','$lang','$date','0','0','0','$cat','$name','$email','$password')";
$result = mysql_query($query);
if(!$result)
{
include("inc/header.inc.php");
echo "$lang_error";
include("inc/footer.inc.php");
}
else
{
include("inc/header.inc.php");
echo "$lang_link_added";
include("inc/footer.inc.php");
$query = "select email from ".$prefix."_admins";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$wmmail = $row['email'];
mail($email,$subject,$mailbody,"FROM:$wmmail");
mail($wmmail,$subject1,$mailbody1,"FROM:$vswl_title");
echo "<a href='$base_url/'>$lang_back</a>";
}
}
break;
case "update":
if($title=="" or $url=="" or $description=="" or $lang=="" or $cat=="" or $name=="" or $email=="" or $password=="")
{
include("inc/header.inc.php");
echo "$lang_forget_field";
include("inc/footer.inc.php");
}
else
{
$title = str_replace("'"," (--) ",$title);
$query = "update ".$prefix."_links set title='$title',url='$url',description='$description',lang='$lang',category='$cat',name='$name',email='$email',password='$password',active='no' where id = '$id'";
$result = mysql_query($query);
if(!$result)
{
include("inc/header.inc.php");
echo "$lang_error";
include("inc/footer.inc.php");
}
else
{
include("inc/header.inc.php");
echo "$lang_link_edited";
include("inc/footer.inc.php");
$query = "select email from ".$prefix."_admins";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$wmmail = $row['email'];
mail($email,$subject2,$mailbody2,"FROM:$wmmail");
mail($wmmail,$subject3,$mailbody3,"FROM:$vswl_title");
echo "<a href='$base_url/'>Zurück</a>";
}
}
}
?>
Das bedeutet wenn also zum zweiten mal ein link mit dem Namen “ich” erstellt wird der erste überschrieben.
Laut einer Idee müsste also:
Abfragen ob es “ich” schon gibt und wenn nicht, dann erst die Kategorie erstellen?
Wenn ja wie?
Ich denke es hat etwas mit:
REPLACE INTO ".$prefix."_links (title) VALUES ('$title')
oder:
INSERT IGNORE INTO ".$prefix."_links (title) VALUES ('$$title')
zu tun?
Welches ich irgendwo einfügen müsste?
Aber wie und wo?
Comment