Uploads form help

11 posts by 3 authors in: Forums > CMS Builder
Last Post: August 2, 2013   (RSS)

By thenetgirl - July 29, 2013

http://montereyscambusters.com/storyform2_add.php  it wont  add my iframe not sure why.

THanks

Patricia

www.thenetgirl.com

By gregThomas - July 29, 2013

Hi,

When I go to the page I'm redirected to the login screen, so I can't see what the issue is. Would it be possible to give me a bit more information? Is the iframe HTML not displaying? Are you getting a 404 page inside of the iframe? Or is it another issue.

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By thenetgirl - July 29, 2013

Sorry didnt think of that

 error is No 'tablename' value specified in url!

//
$table = @$_REQUEST['stories'];
$field = @$_REQUEST['field'];
$recordNum = intval( @$_REQUEST['num'] );
$preSaveTempId = @$_REQUEST['preSaveTempId'];
$submittedForm = @$_REQUEST['REQUEST_METHOD'] == 'POST' || @$_REQUEST['submitForm'];
$errorsAndAlerts = '';

// SECURITY WARNING: BE SURE TO ADD SECURITY CHECKS BELOW TO ENSURE USERS CAN'T
// ADD OR MODIFY UPLOADS FROM ANY RECORDS THEY ARE NOT SUPPOSE TO.
$allowedTables = array('stories');
$allowedFields = array('uploads');

if ($recordNum) { // if a $recordNum was supplied, ensure that the user owns it before doing anything!
if (!@$CURRENT_USER) { die("You must login to modify a record!"); }
$record = mysql_query_fetch_row_assoc("SELECT * FROM {$TABLE_PREFIX}$table WHERE num = '$recordNum'");
if (!$record || $record['createdByUserNum'] != $CURRENT_USER['num']) { die("Invalid recordNum"); }
}

// error checking
if (!$table) { die("No 'tablename' value specified in url!"); }

Patricia

www.thenetgirl.com

By gregThomas - July 30, 2013

Thanks for the extra details. 

I think I can see what the problem is, you need to change the line highlighted in green in your iframe php file:

//
$table = @$_REQUEST['table'];
$field = @$_REQUEST['field'];
$recordNum = intval( @$_REQUEST['num'] );
$preSaveTempId = @$_REQUEST['preSaveTempId'];
$submittedForm = @$_REQUEST['REQUEST_METHOD'] == 'POST' || @$_REQUEST['submitForm'];
$errorsAndAlerts = '';

So in uploadform2_add.php you're passing the tablename into the URL in the table URL like this: ?table=<?php echo $tableName ?>. So the iframe gets the tablename from the URL using the @$_REQUEST['table'] variable. 

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By thenetgirl - July 30, 2013 - edited: July 30, 2013

YOU FREAKING RULE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 

now I am scared to add some of the other stuff cuz I am afraid I will mess it  up-  And here we go !

ok now I am having NEW  issues - shouldn't it be as simple as adding these fields below?

I went back to check and  I wasn't posting everything into a record so started with the simple form  for news added only to 2 lines in red and boom nothing will display 

uploaded good form and bad form what am I doing that is so wrong???????

// error checking
if (!@$_REQUEST['title']) { $errorsAndAlerts .= "Please specify title!<br/>\n"; }
if (!@$_REQUEST['webaddress']) { $errorsAndAlerts .= "Please specify webaddress!<br/>\n"; }

// update record
if (!@$errorsAndAlerts) {
mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
$query = "INSERT INTO `{$TABLE_PREFIX}$tableName` SET
createdDate = NOW(),
createdByUserNum = '" .intval( @$CURRENT_USER['num'] ). "',
updatedDate = NOW(),
updatedByUserNum = '" .intval( @$CURRENT_USER['num'] ). "',

title = '".mysql_escape( $_REQUEST['title'] )."'";
webaddress = '".mysql_escape( $_REQUEST['webaddress'] )."'";

Patricia

www.thenetgirl.com

By gregThomas - July 31, 2013

Hi,

From what you've posted your code looks fine, would it be possible to attach the good and bad form to a post so I can take a closer look at what is causing the problem?

Cheers

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By thenetgirl - August 1, 2013

For some reason my post don't seem to go  on here sometimes ------must be me. Thanks again for your help Greg!

Anyway I got everything working and then I realized I cant  deal with pdf and image uploads in the same upload so tried to make a new  iframe page for just docs and pdfs.

getting a  little error not sure how to deal with it 


Notice: Undefined variable: record in /home/scambust/public_html/uploadForm3_iframe.php on line 166 Warning: Invalid argument supplied for foreach() in /home/scambust/public_html/uploadForm3_iframe.php on line 166

which is 

<?php foreach ($record['pdf'] as $index => $upload): ?>
<font size="2"> <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?>
<?php echo htmlencode($upload['info1']) ?></font></a>

<?php echo $upload['filename'] ?>
<a href="#" onclick="eraseUploadNum('<?php echo $upload['num'] ?>');">remove</a><br/><br/>
<?php endforeach ?>

uploading the files just in case

Patricia

www.thenetgirl.com

By thenetgirl - August 2, 2013

 Now I have the weirdest error - started running test for the site found a weird error I redid every form and look all through the back end but cant figure it out.

a new user can post a "story" it  adds a record and posts to everything every where perfectly

but when any one but admin post to "news" it adds the record but nobody can see it expect the in backend it wont post to anything on the web site.

I dont know where to go from here its just so odd!

Here are 2 screen shots.

Patricia

www.thenetgirl.com
Attachments:

image1_001.jpg 168K

image3.jpg 142K

By thenetgirl - August 2, 2013

ok sent

Patricia

www.thenetgirl.com