custom cms problema!

Σε αυτή την περιοχή μπορείτε να βρείτε ή να αναζητήσετε πληροφορίες σχετικές με την PHP

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
Άβαταρ μέλους
nackgr
Δημοσιεύσεις: 1444
Εγγραφή: 22 Ιαν 2006 20:02
Τοποθεσία: Αθηνα
Επικοινωνία:

custom cms problema!

Δημοσίευση από nackgr » 06 Δεκ 2011 14:37

Με αυτο το κωδικα προσθετης τον gameserver σου στην σελιδα το κανω αλλα στο τελευταιο στάδιο κολαει και με ξαναγυρναει στην ιδια σελιδα , και δεν προσθετη τιποτα στην βαση

Κώδικας: Επιλογή όλων

<?php
if &#40;$forum_user&#91;'is_guest'&#93;&#41;
&#123;
    echo "You must a register, before add a server";
&#125;
else
&#123;
?>
	<div class="clearline"></div>
	<p><b>Rules&#58;</b></p>
	<p>If you are NOT the server admin. DO NOT add the server.</p>
	<hr class="addhr"/>
	<p>Do not delete a server and re-add it.</p>
	<p>Edit and use existing listing.</p>
	<hr class="addhr"/>
	<p>1&#41; <b>Server must be online to be approved.</b></p>
	<p>2&#41; No testing servers allowed. &#40;closed beta&#41;</p>
	<p>3&#41; Do not add server version in the servername when you fill the form.</p>
	<p>4&#41; Servers must be FREE public servers. &#40;You can have any registration method, but the public <p>must be allowed to play for free&#41;</p></p>
	<p>5&#41; No illegal or crap info allowed in the listing form. &#40;Those things are checked before they <p>arrive in the list&#41;</p></p>
	<p>6&#41; No links to files are allowed.</p>
	<p>7&#41; The server will be deleted if it is found to be offline for less than 30% in 5 days. &#40;And no, <p>votes will NOT be restored&#41;</p></p>
	<p>8&#41; You must have a working website or a forum for users to CONTACT you. &#40;Invalid or <p>no website link will cause server deletion&#41;</p></p>
	<p>9&#41; You are required to keep the submitted information up to date. &#40;This includes removal of your <p>server if you close&#41;</p></p>
	<p>10&#41; Vote link must be on your homepage.&#40;See Adding a server Rules&#41;</p><br/>
	<p>If you don`t follow these rules the data you enter in the below form will be junk and it`ll not <p>even get into the dbase.</p></p>

<form action="" method="post">
    <?php
		if&#40;!$_GET&#91;'step'&#93; == 2&#41;
		&#123;
			$title="Add server | Step 1";
	?>
			<div id="astep1back">
				<p>Server Name&#58; <input type="text" name="name" maxlength="20" class="form_field" id="snameinput" /> <span>*</span><br /></p>
				<p><i>maximum 20 Chars &#91;a-Z 0-9 and .&#58;,&#40;&#41;_ &#93;</i></p>
				<div class="clearline"></div>
				<div align="center"> 
					<fieldset style="width&#58; 350px;"><legend>Important server info</legend> 
							<table width="260" border="0" cellspacing="4" cellpadding="0"> 
							  <tr> 
								<td width="102"><p>Loginserver ip</p></td> 
								<td width="96"><p>Loginserver port</p></td> 
							  </tr> 
							  <tr> 
								<td><input name="lip" type="text" class="form_field" id="lip" size="17" alt="alnum|3|a|1|0|.-" emsg="Only IP or Hostname" /></td> 
								<td><input name="lport" type="text" class="form_field" id="lport" value="2106" size="8" maxlength="8" alt="numeric|2" emsg="This is not a port number" /> 
							  </tr> 
							  <tr> 
								<td><p>Gameserver ip</p></td> 
								<td><p>Gameserver port</p></td> 
							  </tr> 
							  <tr> 
								<td><input name="gip" type="text" class="form_field" id="gip" size="17" alt="alnum|3|a|1|0|.-" emsg="Only IP or Hostname" /></td> 
								<td><input name="gport" type="text" class="form_field" id="gport" value="7777" size="8" maxlength="8" alt="numeric|2" emsg="This is not a port number" /> 
							  </tr> 
						  </table> 
					</fieldset> 
					<div class="clearline"></div>
					<div class="clearline"></div>
				</div>
				<div class="clearline"></div>
				<input type="submit" style="border-width&#58;1px; font-family&#58; Tahoma; font-size&#58; 10px;" value="Check Server before you proceed further" name="submit" id="" />
			</div>
	<?
&#125;
else
&#123;
    $title="Add server | Step 2";
    if&#40;!$_SERVER&#91;'HTTP_REFERER'&#93; == "../add"&#41;&#123;
        header&#40;"Location&#58; ../add"&#41;;
    &#125;
    ?>
    <div id="astep1back">
		<div align="center"> 
			<fieldset style="width&#58; 300px;"><legend>Game type</legend> 
				<select name="type">
                <option selected="selected" value="">-select-</option>
                <option value="C1">Chronicle 1</option>
                <option value="C2">Chronicle 2</option>
                <option value="C3">Chronicle 3</option>
                <option value="C4">Chronicle 4</option>
                <option value="C5">Chronicle 5</option>
                <option value="Interlude">Interlude</option>
                <option value="Kamael">Kamael</option>
                <option value="Hellbound">Hellbound</option>
                <option value="Gracia">Gracia</option>
                <option value="Gracia2">Gracia 2</option>
                <option value="Gracia3">Gracia Final</option>
                <option value="Epilogue">Epilogue</option>
                <option value="Freya">Freya</option>
				<option value="Hfive">High Five</option>
				</select>
			</fieldset> 

			<fieldset style="width&#58; 300px;"><legend>Server rates</legend> 
				
				<div class="centered"><table>
				<tr><td><p><span>Xp rate&#58;</span> </td>
				<td><select name="xprate">
						<option selected="selected" value="0">-select-</option>
						<option>1x</option><option>2x</option><option>3x</option><option>4x</option><option>5x</option><option>6x</option><option>7x</option><option>8x</option><option>9x</option><option>10x</option><option>11x</option><option>12x</option><option>13x</option><option>14x</option><option>15x</option><option>16x</option><option>17x</option><option>18x</option><option>19x</option><option>20x</option><option>21x</option><option>22x</option><option>23x</option><option>24x</option><option>25x</option><option>26x</option><option>27x</option><option>28x</option><option>29x</option><option>30x</option><option>40x</option><option>50x</option><option>60x</option><option>70x</option><option>80x</option><option>90x</option><option>91x</option><option>92x</option><option>93x</option><option>94x</option><option>95x</option><option>96x</option><option>97x</option><option>98x</option><option>99x</option><option>100x</option><option>200x</option><option>300x</option><option>400x</option><option>500x</option><option>600x</option><option>700x</option><option>800x</option><option>900x</option><option>1000x</option><option>2000x</option><option>3000x</option><option>4000x</option><option>5000x</option><option>6000x</option><option>7000x</option><option>8000x</option>
					</select></p></td>
				</tr>
				<tr><td><p><span>Sp rate&#58;</span> 
				<td><select name="sprate">
					<option selected="selected" value="0">-select-</option>
					<option>1x</option><option>2x</option><option>3x</option><option>4x</option><option>5x</option><option>6x</option><option>7x</option><option>8x</option><option>9x</option><option>10x</option><option>11x</option><option>12x</option><option>13x</option><option>14x</option><option>15x</option><option>16x</option><option>17x</option><option>18x</option><option>19x</option><option>20x</option><option>21x</option><option>22x</option><option>23x</option><option>24x</option><option>25x</option><option>26x</option><option>27x</option><option>28x</option><option>29x</option><option>30x</option><option>40x</option><option>50x</option><option>60x</option><option>70x</option><option>80x</option><option>90x</option><option>91x</option><option>92x</option><option>93x</option><option>94x</option><option>95x</option><option>96x</option><option>97x</option><option>98x</option><option>99x</option><option>100x</option><option>200x</option><option>300x</option><option>400x</option><option>500x</option><option>600x</option><option>700x</option><option>800x</option><option>900x</option><option>1000x</option><option>2000x</option><option>3000x</option><option>4000x</option><option>5000x</option><option>6000x</option><option>7000x</option><option>8000x</option>
				</select></p></td>
				</tr>
				
				<tr><td><p><span>Drop rate&#58;</span> 
				<td><select name="droprate">
					<option selected="selected" value="0">-select-</option>
					<option>1x</option><option>2x</option><option>3x</option><option>4x</option><option>5x</option><option>6x</option><option>7x</option><option>8x</option><option>9x</option><option>10x</option><option>11x</option><option>12x</option><option>13x</option><option>14x</option><option>15x</option><option>16x</option><option>17x</option><option>18x</option><option>19x</option><option>20x</option><option>21x</option><option>22x</option><option>23x</option><option>24x</option><option>25x</option><option>26x</option><option>27x</option><option>28x</option><option>29x</option><option>30x</option><option>40x</option><option>50x</option><option>60x</option><option>70x</option><option>80x</option><option>90x</option><option>91x</option><option>92x</option><option>93x</option><option>94x</option><option>95x</option><option>96x</option><option>97x</option><option>98x</option><option>99x</option><option>100x</option><option>200x</option><option>300x</option><option>400x</option><option>500x</option><option>600x</option><option>700x</option><option>800x</option><option>900x</option><option>1000x</option><option>2000x</option><option>3000x</option><option>4000x</option><option>5000x</option><option>6000x</option><option>7000x</option><option>8000x</option>
				</select></p></td>
				</tr>
				
				<tr><td><p><span>Adena rate&#58;</span>
				<td><select name="adenarate">
					<option selected="selected" value="0">-select-</option>
					<option>1x</option><option>2x</option><option>3x</option><option>4x</option><option>5x</option><option>6x</option><option>7x</option><option>8x</option><option>9x</option><option>10x</option><option>11x</option><option>12x</option><option>13x</option><option>14x</option><option>15x</option><option>16x</option><option>17x</option><option>18x</option><option>19x</option><option>20x</option><option>21x</option><option>22x</option><option>23x</option><option>24x</option><option>25x</option><option>26x</option><option>27x</option><option>28x</option><option>29x</option><option>30x</option><option>40x</option><option>50x</option><option>60x</option><option>70x</option><option>80x</option><option>90x</option><option>91x</option><option>92x</option><option>93x</option><option>94x</option><option>95x</option><option>96x</option><option>97x</option><option>98x</option><option>99x</option><option>100x</option><option>200x</option><option>300x</option><option>400x</option><option>500x</option><option>600x</option><option>700x</option><option>800x</option><option>900x</option><option>1000x</option><option>2000x</option><option>3000x</option><option>4000x</option><option>5000x</option><option>6000x</option><option>7000x</option><option>8000x</option>
				</select></p></td>
				</tr>
				
				<tr><td><p><span>Safe enchant&#58;</span>  
				<td><select name="saferate">
					<option selected="selected" value="0">-select-</option>
					<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option><option>21</option><option>22</option><option>23</option><option>24</option><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>40</option><option>50</option>
				</select></p></td>
				</tr>
				
				<tr><td><p><span>Max enchant&#58;</span>  
				<td><select name="maxrate">
					<option selected="selected" value="0">-select-</option>
					<option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>13</option><option>14</option><option>15</option><option>16</option><option>17</option><option>18</option><option>19</option><option>20</option><option>21</option><option>22</option><option>23</option><option>24</option><option>25</option><option>26</option><option>27</option><option>28</option><option>29</option><option>30</option><option>40</option><option>50</option><option>60</option><option>70</option><option>80</option><option>90</option><option>91</option><option>92</option><option>93</option><option>94</option><option>95</option><option>96</option><option>97</option><option>98</option><option>99</option><option>100</option>
				</select></p></td>
				</tr>
				
				</table>
				</div>

			</fieldset> 
	
			
			<fieldset style="width&#58; 300px;"><legend>Other info</legend> 
				<p><span>Server location&#58;</span>
				<select name="location">
					<?php
						$q = mysql_query&#40;"SELECT SQL_CACHE `Name` FROM `countrylist`"&#41;;
						while&#40;$r = mysql_fetch_assoc&#40;$q&#41;&#41;&#123;
							echo "<option value=\"".$r&#91;'Name'&#93;."\">".$r&#91;'Name'&#93;."</option>";
						&#125;
					?>
				</select></p>
				<p><span>Description&#58;</span></p> <textarea name="description" cols="30" rows="5"></textarea><br />
				<p><span>Server webpage or forum link. &#40;must have http&#58;//&#41;</span></p>
				<input type="text" name="link" id="linkinput" value="http&#58;//" />
			</fieldset> 
			<br/>
			<p style="margin-left&#58; 1px; float&#58; center;">By adding a server/website to our lists you agree that you are the representative</p>
			<p style="margin-left&#58; 1px; float&#58; center;"> of that server/website and you take all the responsabilities for it's legality.</p>
			<br/>
			<p style="margin-left&#58; 10px; float&#58; center;">
			<input type="checkbox" name="tagree" value="y">I have read the <a href="terms"><span>Terms and Conditions</span></a> and i agree to the contents<br />
			<input name="submit2" type="submit" class="form_field" id="" value="Add server!" /> 
			</p>
		</div>
    </div>
</form>
<?php
&#125;
    echo "<div style=\"padding-top&#58; 5px; width&#58; 530px; color&#58; red; float&#58; left; text-align&#58; center;\">";
    if&#40;isset&#40;$_POST&#91;'submit'&#93;&#41;&#41;&#123;
        $name=trim&#40;htmlspecialchars&#40;$_POST&#91;'name'&#93;&#41;&#41;;
        $_SESSION&#91;'sname'&#93; = $name;
        $lip=trim&#40;htmlspecialchars&#40;$_POST&#91;'lip'&#93;&#41;&#41;;
        $_SESSION&#91;'lip'&#93; = $lip;
        $lport=trim&#40;htmlspecialchars&#40;$_POST&#91;'lport'&#93;&#41;&#41;;
        $_SESSION&#91;'lport'&#93; = $lport;
        $gip=trim&#40;htmlspecialchars&#40;$_POST&#91;'gip'&#93;&#41;&#41;;
        $_SESSION&#91;'gip'&#93; = $gip;
        $gport=trim&#40;htmlspecialchars&#40;$_POST&#91;'gport'&#93;&#41;&#41;;
        $_SESSION&#91;'gport'&#93; = $gport;
        if&#40;empty &#40;$name&#41; || empty &#40;$lip&#41; || empty &#40;$lport&#41; || empty &#40;$gip&#41; || empty &#40;$gport&#41;&#41;&#123;
            echo "Don't leave any empty fields!";
        &#125;
        else&#123;
            $q=mysql_query&#40;"SELECT SQL_CACHE name, ip, gip FROM `s_servers` WHERE `name`='$name' || `ip`='$lip' || `gip`='$gip'"&#41;;
            $b = mysql_fetch_assoc&#40;mysql_query&#40;"SELECT SQL_CACHE `count` FROM `s_scount` WHERE `ip`='$lip'"&#41;&#41;;
            if&#40;mysql_num_rows&#40;$q&#41; != 0&#41;&#123;
                echo "Already is added this server";
            &#125;
            else if&#40;$b&#91;'count'&#93; == 3&#41;&#123;
            echo "This server is added 3 times";
            &#125;
            else&#123;
                if &#40;! $sock = @fsockopen&#40;$lip, $lport, $errnum, $errstr, 1&#41;&#41;&#123;
                echo "You can only add servers that are online!";
                &#125;
                else&#123;
                    header&#40;"Location&#58; add/step2.html"&#41;;
                    fclose&#40;$sock&#41;;
                &#125;
            
        &#125;
        &#125;
    &#125;
    elseif&#40;isset&#40;$_POST&#91;'submitstep2'&#93;&#41;&#41;&#123;
        $name = $_SESSION&#91;'sname'&#93;;
        $ip = $_SESSION&#91;'lip'&#93;;
        $port = $_SESSION&#91;'lport'&#93;;
        $gip = $_SESSION&#91;'gip'&#93;;
        $gport = $_SESSION&#91;'gport'&#93;;
        $type=trim&#40;htmlspecialchars&#40;$_POST&#91;'type'&#93;&#41;&#41;;
        $xp=trim&#40;htmlspecialchars&#40;$_POST&#91;'xprate'&#93;&#41;&#41;;
        $sp=trim&#40;htmlspecialchars&#40;$_POST&#91;'sprate'&#93;&#41;&#41;;
        $drop=trim&#40;htmlspecialchars&#40;$_POST&#91;'droprate'&#93;&#41;&#41;;
        $adena=trim&#40;htmlspecialchars&#40;$_POST&#91;'adenarate'&#93;&#41;&#41;;
        $safe=trim&#40;htmlspecialchars&#40;$_POST&#91;'saferate'&#93;&#41;&#41;;
        $max=trim&#40;htmlspecialchars&#40;$_POST&#91;'maxrate'&#93;&#41;&#41;;
        $location=trim&#40;htmlspecialchars&#40;$_POST&#91;'location'&#93;&#41;&#41;;
        $desc=mysql_real_escape_string&#40;trim&#40;htmlspecialchars&#40;$_POST&#91;'description'&#93;&#41;&#41;&#41;;
        $link=trim&#40;htmlspecialchars&#40;$_POST&#91;'link'&#93;&#41;&#41;;
        $tagree=trim&#40;htmlspecialchars&#40;$_POST&#91;'tagree'&#93;&#41;&#41;;
        $time = time&#40;&#41;;
        $user = $forum_user&#91;'username'&#93;;
        if&#40;$tagree != "y"&#41;&#123;
            echo "You must agree \"Terms and Conditions\" and legaly on the server!";
        &#125;
        else if&#40;empty &#40;$type&#41; || empty &#40;$xp&#41; || empty &#40;$sp&#41; || empty &#40;$drop&#41; || empty &#40;$adena&#41; || empty &#40;$safe&#41; || empty &#40;$max&#41; || empty &#40;$location&#41; || empty &#40;$desc&#41; || empty &#40;$link&#41;&#41;&#123;
            echo "Don't leave any empty fields!";
        &#125;
        else if&#40;substr&#40;$link, 0, 7&#41; != "http&#58;//"&#41;&#123;
            echo "You must enter 'http&#58;//' in your site";
        &#125;
        else&#123;
                $b = mysql_fetch_assoc&#40;mysql_query&#40;"SELECT `count` FROM `s_scount` WHERE `ip`='$ip'"&#41;&#41;;
                if&#40;$b&#91;'count'&#93; == 1&#41;&#123;
                    $count = $b&#91;'count'&#93;+1;
                    $q = mysql_query&#40;"UPDATE `s_scount` SET `count`='$count' WHERE `ip`='$ip'"&#41;;
                &#125;
                else if&#40;$b&#91;'count'&#93; == 2&#41;&#123;
                    $count = $b&#91;'count'&#93;+1;
                    $q = mysql_query&#40;"UPDATE `s_scount` SET `count`='$count' WHERE `ip`='$ip'"&#41;;
                &#125;
                else&#123;
                    $q = mysql_query&#40;"INSERT INTO `s_scount` &#40;`ip`, `count`&#41; VALUES &#40;'$ip', '1'&#41;"&#41;;
                &#125;
            $q=mysql_query&#40;"INSERT INTO `s_servers` &#40;`id`, `name`, `ip`, `gip`, `port`, `gport`, `type`, `xp`, `sp`, `drop`, `adena`, `safe`, `max`, `location`, `desc`, `site`, `time`, `addedby`&#41; VALUES &#40;'', '$name', '$ip', '$gip', '$port', '$gport', '$type', '$xp', '$sp', '$drop', '$adena', '$safe', '$max', '$location', '$desc', '$link', '$time', '$user'&#41;"&#41;;
            if&#40;$q&#41;&#123;
            echo "You successful added a server";
            header&#40;'Refresh&#58; 2; URL=http&#58;//l2servers.info/myhome'&#41;;
            &#125;
        &#125;
    &#125;
    echo "</div>";
&#125;

?>

demo : http://l2servers.info/add
αυταααααααααααα...
e-Byte.gr
Dafuq.gr

Άβαταρ μέλους
charavge
Δημοσιεύσεις: 378
Εγγραφή: 14 Σεπ 2006 15:47

custom cms problema!

Δημοσίευση από charavge » 16 Δεκ 2011 14:13

Έχω την αίσθηση ότι το παρακάτω:

Κώδικας: Επιλογή όλων

    echo "You must a register, before add a server"; 
&#125; 
else 
&#123; 
πρέπει να γίνει else if διότι χρησιμοποιείς πιο κάτω ξανά else:

Κώδικας: Επιλογή όλων

further" name="submit" id="" /> 
         </div> 
   <? 
&#125; 
else 
&#123; 
    $title="Add server | Step 2"; 
[/b]

Άβαταρ μέλους
nackgr
Δημοσιεύσεις: 1444
Εγγραφή: 22 Ιαν 2006 20:02
Τοποθεσία: Αθηνα
Επικοινωνία:

custom cms problema!

Δημοσίευση από nackgr » 20 Δεκ 2011 11:58

αυτο ηταν αδελφε τεν κιου
αυταααααααααααα...
e-Byte.gr
Dafuq.gr

Απάντηση

Επιστροφή στο “PHP Προγραμματισμός”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες