Jump to content
MakeWebGames

Hellpp!!!!


Shahed3639

Recommended Posts

Everythink works with player shop apart from when you want to make a shop

When I press create shop nothink happens.

 

Pleassee can someone help me out.

 

 

 

<?php

session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();

if($ir[hospital]>0)
{
die("You are in the hospital for {$ir[hospital]} minutes.");
}
if($ir[jail]>0)
{
die("You are in jail for {$ir[jail]} minutes.");
}
$getshops=mysql_query("select * from usershops where userid=$userid");
if(mysql_num_rows($getshops)!=0)
{
echo ("Sorry, but you already own a shop!");
exit($h->endpage());
}


if($_POST['submit'])
{

//shop cost based on how many shops are already made (default)
$f=mysql_query("SELECT id FROM usershops");
$shops=mysql_num_rows($f);
$shopcost=(($shops*1000)+1000);

//fixed shop cost (not default - uncomment the line below, and delete/comment the 3 lines above to use fixed)
//$shopcost=100;


if($ir['money'] < $shopcost)
{
echo("<center>You don't have enough money to open a shop!
You need at least $$shopcost.</center>");
exit($h->endpage());
}
$name=mysql_real_escape_string($_POST['name']);
$description=mysql_real_escape_string($_POST['description']);
$image=mysql_real_escape_string($_POST['image']);

mysql_query("INSERT INTO usershops VALUES('','$userid','$name','$description','$image','5','0','0')") or die(mysql_error());
$i=mysql_insert_id($c);
mysql_query("update users set money=money-$shopcost where userid=$userid");
print "You have successfully created your own shop!<br><a href='myshop.php'>Click here to manage your shop</a>";
}
else
{
print "

<div class='generalinfo_txt'>
<div><img src='images/info_left.jpg' alt='' /></div>
<div class='info_mid'><h2 style='padding-top:10px;'> Create Shop</h2></div>
<div><img src='images/info_right.jpg' alt='' /></div> </div>
<div class='generalinfo_simple'><br> <br><br>

<table align=center class=table><tr><th colspan=2>Creating your Own Shop</th></tr>
<tr><td width=60%>Shop Name:</td><td><form action=createshop.php?method=post><input type=hidden  name=submit value=1><input type=text STYLE='color: black;  background-color: white;' name=name></td></tr>
<tr><td width=60%>Shop Description:</td><td><textarea STYLE='color: black;  background-color: white;' name=description rows=5 cols=20></textarea></td></tr>
<tr><td width=60%>Shop Sign:<br><font size=1>direct url to image</font></td><td><input type=text STYLE='color: black;  background-color: white;' name=image></td>
<tr><td colspan=2><input type=submit STYLE='color: black;  background-color: white;' value='Create your Shop!'></form></td></tr>
</table> </div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div>

";
}
$h->endpage();
?>
Edited by Shahed3639
Made a mistake.
Link to comment
Share on other sites

  • 2 weeks later...

Wow 2 weeks and no help yet? I believe your issue lies with your form at the bottom of the page. Try something like this

<table align=center class=table><tr><th colspan=2>Creating your Own Shop</th></tr>
<form action='createshop.php' method='post'>
<input type='hidden'  name='submit' value=''>
<tr><td width=60%>Shop Name:</td><td><input type=text STYLE='color: black;  background-color: white;' name=name></td></tr>
<tr><td width=60%>Shop Description:</td><td><textarea STYLE='color: black;  background-color: white;' name=description rows=5 cols=20></textarea></td></tr>
<tr><td width=60%>Shop Sign:<font size=1>direct url to image</font></td><td><input type=text STYLE='color: black;  background-color: white;' name=image></td>
<tr><td colspan=2><input type=submit STYLE='color: black;  background-color: white;' value='Create your Shop!'></form></td></tr>
</table> </div><div><img src='images/generalinfo_btm.jpg' alt='' /></div></div></div></div></div></div>
Edited by KyleMassacre
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...