Jump to content

Recommended Posts

The problem is that it submits the image to the database but the header location command isn't working can anyone tell me why? Usually it redirects without a problem on all my other pages?

???

 

 

<? 
session_start();
error_reporting(7);
require("../global/admin_functions.php");
$sid = $_SESSION['LOGINID'];

    if ((($_FILES["form_data"]["type"] == "image/gif")
|| ($_FILES["form_data"]["type"] == "image/jpeg")
|| ($_FILES["form_data"]["type"] == "image/pjpeg"))
&& ($_FILES["form_data"]["size"] < 250000))
  {
  if ($_FILES["form_data"]["error"] > 0)
    {
    echo "Error: " . $_FILES["form_data"]["error"] . "<br />";
    }
  else
    {

$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data))); 
$result=MYSQL_QUERY("INSERT INTO uploads (description, data,filename,filesize,filetype) ". "VALUES 

('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')"); 
$id= mysql_insert_id(); 

header("Location:viewad.php");
exit;
    }
  }
else
  {
  echo "You can only upload JPEG or GIF images that are 250KB or less.";
  }


?>  

Link to comment
https://forums.phpfreaks.com/topic/137931-page-not-redirecting/
Share on other sites

mm doesn't work the page doesn't go anywhere just stays on the same page submits the image to the database ok but doesn't redirect shows the error if i upoad the wrong file usually i would have a statement like this.

 

$DB_site->query($insertsql);
header("Location:viewad.php");
exit;

 

but i get a report saying invalid sql thre $insertsql is the wrong statement to use in this instance $data doesn't work either?? :(

Link to comment
https://forums.phpfreaks.com/topic/137931-page-not-redirecting/#findComment-720879
Share on other sites

$result=mysql_query("INSERT INTO uploads (description, data,filename,filesize,filetype) ". "VALUES

('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')") OR DIE(mysql_error());
$id= mysql_insert_id(); 

 

Change that part and report back the mysql_error.

Link to comment
https://forums.phpfreaks.com/topic/137931-page-not-redirecting/#findComment-720897
Share on other sites

mm no errors showing just goes to that page and freezes on it does not redirect writes to the database though.

 

when i change the header to this

$DB_site->query($insertsql);

header("Location:viewad.php");

exit;

 

i get an error message automatically saying if i put $result or $data instead of $insertsql i get the same message but not saying the query was empty  i have put the errors below

 

with $insertsql

 

Database error in hmtcompany.com: Invalid SQL:

mysql error: Query was empty

mysql error number: 1065

Date: Sunday 21st 2008f December 2008 02:59:02 PM

Script: /user/upload.php

 

with $result

 

Database error in hmtcompany.com: Invalid SQL: 1

mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1

mysql error number: 1064

Date: Sunday 21st 2008f December 2008 03:02:57 PM

Script: /user/upload.php

 

with $data

 

Database error in website.com: Invalid SQL: ÿØÿà\0JFIF\0\0\0\0\0\0ÿÛ\0C\0

 

 

%# , #&\')*)-0-(0%()(ÿÛ\0C

 

(((((((((((((((((((((((((((((((((((((((((((((((((((ÿÀ\0\05\0È\"\0ÿÄ\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÄ\0G\0 \0\0\0\0\0\0!1AQT"Ò\"VaÑ5Ut±ÁÓ#$26Rbqf"¡³ã37B''²áÿÄ\0\0\0\0\0\0\0\0\0\0\0\0\0ÿÄ\01\0 \0\0\0\0\0\0\0!1AQq'\"#Ra'±ÁÑb,f¡¢ÿÚ\0 \0\0?\0¶:êÃZíÝGã[¼!¤[F*ººßn§®Za-ZxØ pqÛµrêTè£Ða¬Nú룤lñÆëÉo ªöàÖ.r]ynXí:jãW¾ª²`çEO¦x`ÌÐIËÛ±W=uaÎÇvî£ñ¯<A¥\\5]a¹RA%Qs¢sH~YÌ gô.ϧzÓ?46ß"T,ΨÁ¸î× Ø~uµO§°ÔÁò\\\"··s¥lsZÃ-[o4@VR¾cªÙ*XƳ>\0ã-jÁ\\R­l!¥º>FzSç ëj¡fTr"¿?lor÷ÞÕ?F¹ªeNfø²[XËÚp"pyÍòÉ4ÇÐ,\0ü¿H,@?ÿ\0µEºêÃZíÝGãT-æéYy¹M_qTÓTÌssò\0p'Â["Ãë õûÍOsäý^ÓªmØò×_"ëq 0Ö6S'åcØÑ!#WpÖËýCSZu×?;ۺƵs&´öS.öÎY òs·³¤ÔÖÕôc;³î決κ°çc»wQø×ï]Xs±Ý»¨üj'ÆV#?±%e¤ÔyO"ê~SS[YvìÎ_.-õh£óÖS^?£532|³ÕÖpåÇzêTêÔæ9VfÒ{Ë﮼9ØîÝÔ~54Â-Zp·GQ-"ÄDí

v`À>B«ú+'E#?|ûÙvSm±÷!ýå ©PØãó]ÐP|'rÿ\0'÷/ZwÓÓ;ZzÝv^þ¤"} ZÒYÅÊ[£,3KSñíõÒÏ\"K­ Ù,ÑÄjGÔ¦#í¶ZöO»Rýhæí.q#îs !4î^6¼»2Zx´lØx«×eWÐzT\"¬wëKÄžèzÉo²\\+b®¹:Jzy&hsÙ'-i#?GvÅE.ȾÒIp²\\(ás[-E<°¼sHåÃj¡ú"Ä}¶ÑÞÉ÷kF&PÑóZnÉÇäyk3¾ÿ\0_>nϬª.t^S°Ï U\\¥¹OG+jbkäïs² ù´sPN¥1m´w²}ÚÙ^Eb×%¸:~=.kP¶@ì6:ÛìµPÛb駧Õ1ùOh-7Tô³ËÙÏbÖA O^Wþ!-cC\\ Ú9ýeUJb>ÛhïdûµíY¨à-:zYSê@Q¹8ø>~dÔüúOúF¬åÑn­Âxvj O´òÌú-L s>'kG6ú%Lo?

kÚQ¤¬9{LßæUã÷?ÑbÐa/λ/Ïaþ£U·¤

^±.¯ºÑU[£§¨èõ[4±µ§0Föz+YbÐýþ,÷o¬s²Ôè©ê#Tá'ÈI

p\'/C~ÅZ¼S.AKs¯ÚOzl6®7/"DPåYÄõ±I[äóZ¥¬d;z${FdmÜ>¤¢õv^þOrÞÖÚïÒÖNø. d.y,oHá"sØ7/4b?"Ù޻¾O&>íµo¡<ýÄ?ìó,Tõ¢êT¦²K4¬~rRç?sÈ>Å6¶ÐSÛá,¥.±kzNÅÙYÚv¬k

e$ouÆ­Õ8ä¹-húx­ª­á¸^Rù®Qþ.|"ãÊ¿¬ô)ãÞNþr»Ç?~é¿jû£z-áH÷ÔÐ

»"@k+~é8ìÞG¶Ä¸z®çròSw¨"ÜAÙô¯¦Â·Zj^æ,zfÈÃ~!îð¨7bå.]Z+%XY@~<ñ±é(×u&.RÚ {uúL^'ÕÙ{ù=ÉÒQú»/\'¹o«­w¹gé)n6¸è̮ɮâÍËÍå6w®÷,Ûå$\'üi1ÖFú¿é¦N­a-JH­²ÑÆA=Îìm?ñÕªÛ{,¾)++T-;s×gHãzÃÀZh¾?Ã<ÁOM?PáÄ>-ÒlÚïñ\'õ'DDT\'4\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"D\"\"DÿÙ

mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ÿØÿà\0JFIF\0\0\0\0\0\0ÿÛ\0C\0

 

 

%# ,' at line 1

mysql error number: 1064

Date: Sunday 21st 2008f December 2008 03:04:20 PM

Script: /user/upload.php

Referer: http://hmtcompany.com/user/submitad.php

 

Link to comment
https://forums.phpfreaks.com/topic/137931-page-not-redirecting/#findComment-720907
Share on other sites

seems to work fine there is just a problem with this bit doesnt direct and the submit stops working when it is there with

 

$DB_site->query($mysql_query);

header("Location:viewad.php");

exit;

 

or with this

 

header("Location:viewad.php");

exit; 

 

still uploads to the database but doesn't redirect??

Link to comment
https://forums.phpfreaks.com/topic/137931-page-not-redirecting/#findComment-720911
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.