Jump to content

Recommended Posts

[b]Issue:[/b] Using these two pieces of code, I take lyrics (http://d-top.org/add_lyrics.php) after a user selects how many they want to add. If they add more than two lyrics, I get an Internal Server Error. Would It be because of the second code?  Or would I be because of an .htaccess problem (.htacces at bottom)?


[size=15pt][b]Here is the form:[/b][/size]
[code]<form action="<?echo$_SERVER['PHP_SELF'];?>?add=true" method="post">
<h1>Add Lyrics</h1>
</p>
Please keep your lyrics accurate, and please don't abbreviate.<br>
Start the Artist name with a capital letter for autocomplete help.<br>
<span class="txtred">All fields in red must be completed.</span>
<?if($_SESSION['img_number'] != $_POST['num']){?>
<br><span class="txtred">The number you entered doesn't match the image.</span>
<?}?>
<p>
<table>
<?if(empty($_POST['artist'])){?>
<tr><td><span class="txtred">Artist:</span></td><td><input class="artist_info" type="text" id="artist" name="artist"></td>
<?}else{?>
<td>Artist:</td><td><input class="artist_info" type="text" id="artist" name="artist" value="<?echo stripslashes($_POST['artist']);?>"></td>
<?}?>
</tr>
<tr>
<?if(empty($_POST['album'])){?>
<td><span class="txtred">Album:</span></td><td><input class="artist_info" type="text" id="album" name="album"></td>
<?}else{?>
<td>Album:</td><td><input class="artist_info" type="text" id="album" name="album" value="<?echo stripslashes($_POST['album']);?>"></td>
<?}?>
<?for($i=0;$i < $_POST['songs'];$i++){
echo'</tr>
<tr>';
if(empty($_POST['title'])){?>
<td><span class="txtred">Title:</span></td><td><input class="artist_info" type="text" name="title[]"></td>
<?}else{?>
<td>Title:</td><td><input class="artist_info" type="text" name="title[]" value="<?echo stripslashes($_POST['title']);?>"></td>
<?}?>
</tr>
<tr>
<?if(empty($_POST['lyric'])){?>
<td><span class="txtred">Lyric:</span></td><td><textarea class="artist_info" name="lyric[]"></textarea></td>
<?}else{?>
<td>Lyric:</td><td><textarea class="artist_info" name="lyric[]"><?echo stripslashes($_POST['lyric']);?></textarea></td>
<?}
}?>
</tr>
<tr>
<td><img alt="Random Number" src="image.php"></td><td><input class="artist_info" type="text" name="num"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" class="submit" name="add_lyric" value="Submit!"></td>
</tr>
</form>[/code]


[size=15pt][b]Insert To DataBase:[/b][/size]
[code]<?php
foreach($_POST['title'] as $key => $title){
if(isset($_POST['lyric'][$key])){
$lyric = $_POST['lyric'][$key];
$dup = mysql_query("SELECT * FROM lyrics WHERE artist='".edit_name($_POST[artist])."' AND album='".edit_name($_POST[album])."' AND title='".edit_name($title)."'")or die(mysql_error());
$dup_rows = mysql_fetch_array($dup);
if($dup_rows >= 1){
echo'<b><span class="txtred">ERROR</span></b> - Already exists - '.$title.'<br>';
}else{
$sqls = mysql_query("INSERT INTO lyrics(`artist`,`album`,`title`,`lyric`) VALUES('".
edit_name($_POST['artist'])."','".
edit_name($_POST['album'])."','".
edit_name($title)."','".
nl2br(htmlspecialchars($lyric))."')")or die(mysql_error());
echo'<b><span class="txtgreen">COMPLETE</span></b> - Successful - '.stripslashes($title).'<br>';
}
}
}?>[/code]


[size=15pt][b].htaccess[/b][/size]
[code]Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)-fr$ http://www.google.com/translate_c?hl=fr&sl=en&u=http://d-top.org/$1 [r,nc]
RewriteRule ^(.*)-de$ http://www.google.com/translate_c?hl=de&sl=en&u=http://d-top.org/$1 [r,nc]
RewriteRule ^(.*)-es$ http://www.google.com/translate_c?hl=es&sl=en&u=http://d-top.org/$1 [r,nc]
RewriteRule ^(.*)-it$ http://www.google.com/translate_c?hl=it&sl=en&u=http://d-top.org/$1 [r,nc]
RewriteRule ^(.*)-pt$ http://www.google.com/translate_c?hl=pt&sl=en&u=http://d-top.org/$1 [r,nc]
RewriteRule ^artist/(.*)/(.*)/(.*)$ display.php?artist=$1&album=$2&title=$3 [nc]
RewriteRule ^artist/(.*)/(.*)$ display.php?artist=$1&album=$2 [nc]
RewriteRule ^images/(.*)$ /artist_images.php?artist=$1 [nc]
RewriteRule ^artist/(.*)$ display.php?artist=$1 [nc]
RewriteRule ^(.*)/$ /search_results.php?art=$1 [nc][/code]
Link to comment
https://forums.phpfreaks.com/topic/27249-internal-server-error/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.