Upload script mist nog het zetten van rechten
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?
require("global.php");
session_start();
if($susername=="")
echo("<script language='javascript'>alert('Sorry..You are not logged in as our member...Please Login');location.href = 'login.php'; </script>");
//echo $suserid;
$articleprice = $articleprice1.",".$articleprice2;
$sql1= "select max(articleid) from articles";
$result1=mysql_query($sql1,$connection) or die("something is wrong");
$row1=mysql_fetch_array($result1);
$inc = $row1[0]+1;
echo $inc;
$sql2= "select noofads from newuser where userid='$suserid'";
$result2=mysql_query($sql2,$connection) or die("something is wrong");
$row2=mysql_fetch_array($result2);
$sql3= "select count(*) from articles where userid='$suserid' and active='1'";
$result3=mysql_query($sql3,$connection) or die("something is wrong");
$total3=mysql_fetch_array($result3);
if($total3[0]<$row2[0])
{
$path = "articles/$inc.jpg";
if (is_uploaded_file($HTTP_POST_FILES['articlefoto']['tmp_name']))
{
move_uploaded_file($_FILES['articlefoto']['tmp_name'], $path);
}
$sql= "INSERT INTO articles(articleid,userid,articlename,articleinfo,articlefoto,articleprice,active)
values('$inc', '$suserid', '$articlename', '$articleinfo', '$path', '$articleprice', '1')";
$result=mysql_query($sql,$connection) or die("something is wrong1");
echo("<script language='javascript'>alert('Uw nieuwe aanbieding is toegevoegd');location.href = 'addarticle.php'; </script>");
}
else if($total3[0]>=$row2[0])
{
echo("<script language='javascript'>alert('Article can not be added because it will exceed the maximum amount of articles for this user');location.href = 'addarticle.php'; </script>");
}
?>
require("global.php");
session_start();
if($susername=="")
echo("<script language='javascript'>alert('Sorry..You are not logged in as our member...Please Login');location.href = 'login.php'; </script>");
//echo $suserid;
$articleprice = $articleprice1.",".$articleprice2;
$sql1= "select max(articleid) from articles";
$result1=mysql_query($sql1,$connection) or die("something is wrong");
$row1=mysql_fetch_array($result1);
$inc = $row1[0]+1;
echo $inc;
$sql2= "select noofads from newuser where userid='$suserid'";
$result2=mysql_query($sql2,$connection) or die("something is wrong");
$row2=mysql_fetch_array($result2);
$sql3= "select count(*) from articles where userid='$suserid' and active='1'";
$result3=mysql_query($sql3,$connection) or die("something is wrong");
$total3=mysql_fetch_array($result3);
if($total3[0]<$row2[0])
{
$path = "articles/$inc.jpg";
if (is_uploaded_file($HTTP_POST_FILES['articlefoto']['tmp_name']))
{
move_uploaded_file($_FILES['articlefoto']['tmp_name'], $path);
}
$sql= "INSERT INTO articles(articleid,userid,articlename,articleinfo,articlefoto,articleprice,active)
values('$inc', '$suserid', '$articlename', '$articleinfo', '$path', '$articleprice', '1')";
$result=mysql_query($sql,$connection) or die("something is wrong1");
echo("<script language='javascript'>alert('Uw nieuwe aanbieding is toegevoegd');location.href = 'addarticle.php'; </script>");
}
else if($total3[0]>=$row2[0])
{
echo("<script language='javascript'>alert('Article can not be added because it will exceed the maximum amount of articles for this user');location.href = 'addarticle.php'; </script>");
}
?>
einde script >>
Ik kan hier echt wel wat hulp bij gebruiken ik kom er niet meer uit..
alvast bedankt.
alvast bedankt