Jump to content
php.lv forumi

Iekrāsot pēdējo pievienoto ierakstu


Psycke

Recommended Posts

Nū... tiek iedrukāts datubāzē. Un es domāju, ka tad tur, lai viņš saliek visu to, bet ja to nevar izdarīt pie ievades, tad lūk izvades skripts:

elseif($action=="newfile") {
// ADMINACTIONS
$adminactions='<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="left">';
$adminactions.= '<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=files\');return document.MM_returnValue" value="files"> ';
if(isfileadmin($userID)) {
	$adminactions.='</td><td align="right"><input type="button" class="button" onClick="MM_openBrWindow(\'admin/admincenter.php?site=filecategorys\',\'News\')" value="new category"></td></tr></table>';
	$rubrics=safe_query("SELECT * FROM ".PREFIX."files_categorys ORDER BY name");
	while($dr=mysql_fetch_array($rubrics)) {
		$filecats.='<option value="'.$dr[filecatID].'">'.$dr[name].'</option>';
	}

$access='<option value="0">All</option><option value="1">Registered</option><option value="2">Clanmember</option>';

	$bg1=BG_1;

	if(!isset($filecats)) redirect('index.php?site=files', 'You have to create a file-category first!', '3');
	else {
		echo $adminactions;
		eval ("\$files_new = \"".gettemplate("files_new")."\";");
		echo $files_new;
  }
}
else redirect("index.php?site=files", "no access!", "3");
}

Nu tā lūk. Vajag arī formu? Nu jā/nē, ielikšu.

<form action="index.php?site=files&action=save" method="post" enctype="multipart/form-data" onSubmit="return chkFormular()">
<input type="hidden" name="poster" value="$userID">
 <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="$border">
<tr> 
  <td class="title" align="center" bgcolor="$bghead" height="20">new file</td>
</tr>
<tr> 
  <td bgcolor="$pagebg"></td>
</tr>
<tr>
  <td bgcolor="$bg1"><table align="center" cellpadding="2" cellspacing="0" class="formtable">
	  <tr> 
		<td colspan="2"><b>File-Information:</b></td>
	  </tr>
	  <tr>
		<td>Category:</td>
		<td><select name="filecat">$filecats</select></td>
	  </tr>
	  <tr> 
		<td width="30%">Filename:</td>
		<td width="70%"><input type="text" name="filename" size="30" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'"></td>
	  </tr>
	  <tr> 
		<td valign="top">Info/Description:</td>
		<td><textarea name="info" cols="44" rows="7" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'"></textarea></td>
	  </tr>
	  <tr>
		<td>Accesslevel:</td>
		<td><select name="accesslevel">$access</select></td>
	  </tr>
	  <tr>
		<td valign="top">File-Upload:</td>
		<td><input type="file" name="upfile" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'"> 
	  <tr> 
		<td valign="top">Extern Link:</td>
		<td><input type="text" name="fileurl" size="40" value="http://" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'"></td>
	  </tr>
	  <tr> 
		<td valign="top">File-Size (only for extern files):</td>
	  <td><input name="filesize" type="text" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'" maxsize="4" size="4"> <select name="unit"><option value="b">Byte</option><option value="kb">KByte</option><option value="mb" selected>MByte</option><option value="gb">GByte</option></select>
	  <tr> 
		<td colspan="2"> </td>
	  </tr>
	  <tr> 
		<td colspan="2"><b>File-Mirrors:</b></td>
	  </tr>
	  <tr> 
		<td valign="top">Mirror #2:</td>
					<td><input type="text" name="mirror2" size="40" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'"></td>
	  </tr>
	  <tr> 
		<td valign="top">Mirror #3:</td>
					<td><input type="text" name="mirror3" size="40" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'"></td>
	  </tr>
	  <tr> 
		<td> </td>
		<td><input type="submit" name="submit" value="upload"></td>
	  </tr>
	</table></td>
</tr>
 </table>
</form>

Link to comment
Share on other sites

nu risinājumi ir tiešām 2:

- glabāt tabulā kolonnu `last record` (kas var arī nebūt pēdējais - tipa custom-a-ļa-kruto)

- pie izvades fetčot pēdējā ieraksta ID un pie izdrukas salīdzināt/iekrāsot.

 

PS: ja jau tu vienreiz lieto paste.php.lv, lieto arī turpmāk, nevis piedrāzo forumu

Edited by Delfins
Link to comment
Share on other sites

×
×
  • Create New...