Jump to content
php.lv forumi

Notification's par darbību


daGrevis

Recommended Posts

Sveiki,

 

Jebkura darbība Manos skriptos notiek caur diviem failiem, piemēram:

 

[*] add-news.php (ziņu pievienošana),

[*] do__add-news.php (doto datu validācija, pievienošana datubāze utml. lietas);

 

 

Pēc veiksmīgas otrā faila izpildīšanas notiek sekojošais...

 

$_SESSION['notification'] = 'Ziņa pievienota.';
$_SESSION['back_link'] = 'news.php';

exit( header( "Location: {$root}/notification.php" ) );

 

Fails "notification.php" izvada datus un iztīra sesiju mainīgos, protams, un pārnes Jūs uz $_SESSION['back_link']. =)

 

 

Tad sanāk situācija, ka ja lietotājs pēc nonākšanas back-link'ā, ja uzspiedis "back" pogu, nonāk nevis tur, kur cerējis, bet gan notification.php. =( Risinājumi? =)

Link to comment
Share on other sites

$_SESSION['notification'] = 'Ziņa pievienota.';
$_SESSION['back_link'] = 'news.php';

exit( header( "Location: {$root}/{$_SESSION['back_link']}" ) );

 

failā news.php

echo $_SESSION['notification'];
unset($_SESSION['notification']);

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.

Loading...
×
×
  • Create New...