Jump to content

Redirection after execution?


shadysaiyan

Recommended Posts

How would i go about making my php script redircet to a different page after its executed?

 

My Code

<?

$db_host = "db_host";

$db_user = "db_user";

$db_pass = "db_pass";

$db_name = "db_name";

$db = mysql_connect($db_host,$db_user,$db_pass);

mysql_select_db ($db_name) or die ("Cannot Connect To Database");

 

$result = mysql_query("SELECT * from ibf_members");

$result1 = mysql_query("SELECT * from ibf_pfields_content");

$result2 = mysql_query("SELECT * from ibf_profile_portal");

while($row = mysql_fetch_array($result) AND $row1 = mysql_fetch_array($result1) AND $row2 = mysql_fetch_array($result2))

  {

 

header("Content-type: image/png");

$imagename = $row['members_display_name'] . ".png";

$imgpath = $_SERVER['DOCUMENT_ROOT'] . "/forums/signatures/" . $row['members_display_name'] . ".png";

$im = imagecreatefrompng($row1['field_3']);

$black = imagecolorallocate($im, 0,12,47);

$white = ImageColorAllocate($im,255,255,255);

$orange = ImageColorAllocate($im,255,180,0);

$red = ImageColorAllocate($im,255,0,0);

$font = 'fonts/EuropeExt_Bold.ttf';

imagettftext($im, 8, 0, 280, 146, $black, $font, "ANIMEDESTINATION.COM");

imagettftext($im, 8, 0, 281, 145, $white, $font, "ANIMEDESTINATION.COM");

imagettftext($im, 10, 0, 5, 143, $white, $font, $row['members_display_name']);

imagettftext($im, 7.5, 0, 265, 50, $black, $font, "Gender: " . $row2['pp_gender']);

imagettftext($im, 7.5, 0, 265, 62, $black, $font, "Member No: " . $row['id']);

imagettftext($im, 7.5, 0, 265, 74, $black, $font, "Posts: " . $row['posts']);

imagettftext($im, 7.5, 0, 265, 86, $black, $font, "Profile Views: " . $row['members_profile_views']);

imagettftext($im, 7.5, 0, 266, 96, $black, $font, "Currently Watching: ");

imagettftext($im, 7.5, 0, 265, 108, $red, $font, $row1['field_1']);

imagettftext($im, 7.5, 0, 265, 120, $black, $font, "Anime Watched: " . $row1['field_2']);

imagepng($im, $imgpath);

imagedestroy($im);

 

}

?>

Link to comment
https://forums.phpfreaks.com/topic/108337-redirection-after-execution/
Share on other sites

As far as I can tell with a quick glance of your script, you haven't outputted anything to the browser (other than a header, which is ok). So you should be able to add this to the end of your script:

header ("Location: www.example.com");

 

And it will redirect to that page.

Archived

This topic is now archived and is closed to further replies.

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