Advertisement:

Author Topic: SimplePortal  (Read 1572250 times)

Offline Angelina Belle

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,586
Re: SimplePortal - 2.3.3 Released!
« Reply #3880 on: April 21, 2011, 08:00:02 AM »
My version of the code works fine for me. I'm not sure why it does not work fine for you. Perhaps we are using different versions of php?
Perhaps if ( isset($_FILES) && isset($_FILES['uploadedfile']) && isset($_FILES['uploadedfile']['name']) ) would work better for you?

The "<>" appear on your page because they are are in the code. For the code I posted, I simply showed how the code you posted would look with the one line changed. You are in no way required to use the version of code you posted here, or to use the change I suggested.

I can see that you are a little lost in the customization discussion. If you desire to use custom php in your blocks, you may feel more comfortable if you go through a simple php tutorial, like the one at w3schools.org. Then, you might like to look up the php function isset at php.net, in order to understand the change I suggested.

Good Luck!
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3881 on: April 21, 2011, 08:14:05 AM »
I tried again, and this time it worked.   :D 

THANKS for all the help, now to fix about 10 more pages.

EDIT: I found something weird.....if I click "Edit Page" just under the code it gives the error, but if I go all the way to the bottom "Edit Page" it works.



« Last Edit: April 21, 2011, 08:29:00 AM by ACAMS »

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3882 on: April 21, 2011, 07:37:56 PM »
I changed the code in all my uploaders and they all work fine, but this one still gives me the error in my error log.


It is a little different than the others as it gives users the link to the file.


I hope you can see what is throwing the error.




Code: [Select]

<?
$target_path = "../uploads/files/"; /// upload folder
$allowedExtentions = "rar,zip,7Z,7z"; // allowed extentions
// Upload File
if( isset($_FILES['uploadedfile']['name']) ){
// Check file extention
$ext = substr($_FILES['uploadedfile']['name'], strrpos($_FILES['uploadedfile']['name'], '.') + 1);
$chechextentions = explode(",", $allowedExtentions);
$isallowed = 0;
foreach($chechextentions as $key => $name){
if($name==$ext){$isallowed = 1;}
}
if($isallowed == 0){ die("Sorry that filetype [$ext] is not allowed, Please use ($allowedExtentions)");}

// See if filename exists
// if it exists rename it
if (file_exists($target_path.$_FILES['uploadedfile']['name'])) {
    $random_digit=rand(0000,9999);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path.$random_digit.basename( $_FILES['uploadedfile']['name']))) {
    echo "The file ".  $random_digit.basename( $_FILES['uploadedfile']['name']). " has been uploaded <br>";
$fileurl= "http://".$_SERVER['SERVER_NAME']. "/".$target_path.$random_digit.basename( $_FILES['uploadedfile']['name']);?>
 
  <div align="center">
    <input name="textfield" type="text" id="textfield" value="[url=<?=$fileurl?>]<?=$fileurl?>[/url]" size="105"  />
    <? } else{
    echo "There was an error uploading the file, please try again!";
}

// other wise just upload
} else {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path.basename( $_FILES['uploadedfile']['name']))) {
echo "The file ".  $random_digit.basename( $_FILES['uploadedfile']['name']). " has been uploaded <br>";
$fileurl= "http://".$_SERVER['SERVER_NAME']. "/".$target_path.$random_digit.basename( $_FILES['uploadedfile']['name']);?>
    <input name="textfield" type="text" id="textfield" value="[url=<?=$fileurl?>]<?=$fileurl?>[/url]" size="105"  />
    <? } else{
    echo "There was an error uploading the file, please try again!";
}
}
// Ask for upload info
}else{ ?>
    <>
 
<form enctype="multipart/form-data" action="index.php?page=page4749" method="POST">
              <div align="center">
                <p>
            <input type="hidden" name="MAX_FILE_SIZE" value="5000000000" />
            <BR />
          Choose a file to upload .zip, 7Zip or .rar ONLY<BR />
          <BR />
          <input name="uploadedfile" type="file" />
           <input type="submit" value="Upload File" />
                </p>
              <>
</form>
            <div align="center"><br />
                <? } ?>             
            <>
           <BR><div align="center">
<BR><strong>TERMS OF SERVICE</strong><><BR>
<div align="center">
gametechmods.com file host is a free file hosting service, we allow you to upload your files onto our server for free.<BR>
These files can be linked to forums or friends and can not be seen by anyone without the file name.<BR>
We reserve the right to ban any individual  or website from using our services for any reason.<BR>
<strong>Do not upload copywrited or illegal content.</strong><>

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 13,082
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • What's Ur Beef
Re: SimplePortal - 2.3.3 Released!
« Reply #3883 on: April 21, 2011, 11:14:25 PM »
What is the error in the error log. ???

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3884 on: April 22, 2011, 08:09:45 AM »
What is the error in the error log. ???




I have SMF 2.0 RC3 with the RC4 security patch and Simpleportal 2.3.2

I am getting an error in my error log whenever anybody clicks a link to one of my PHP pages, it does not give an error for BBC, or HTML.


http://gametechmods.com/forums/index.php?/page,page2096.html

8: Undefined index: uploadedfile

File: /home/gametechmods/gametechmods.com/forums/Sources/Subs-Portal.php(1155) : eval()'d code
Line: 5


you will see that line 5 has nothing to do with anything.


Offline Angelina Belle

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,586
Re: SimplePortal - 2.3.3 Released!
« Reply #3885 on: April 22, 2011, 09:23:52 AM »
Isn't line 5 of your eval'd code
Code: [Select]
if( isset($_FILES['uploadedfile']['name']) ){
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3886 on: April 22, 2011, 10:15:55 AM »

Isn't line 5 of your eval'd code
Code: [Select]
if( isset($_FILES['uploadedfile']['name']) ){

Yes, it is.



EDIT: it is...


Code: [Select]
if( isset($_FILES['uploadedfile']['name']) ){
« Last Edit: April 22, 2011, 10:27:54 AM by ACAMS »

Offline Angelina Belle

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,586
Re: SimplePortal - 2.3.3 Released!
« Reply #3887 on: April 22, 2011, 11:03:47 AM »
Then that is your problem.

Perhaps you can see if isset($_FILES) works better for you, and/or you can try one of my earlier suggestions, to see if that works:
Perhaps if ( isset($_FILES) && isset($_FILES['uploadedfile']) && isset($_FILES['uploadedfile']['name']) ) would work better for you?
Quote

At this point, I think we are confident that this is not a SimplePortal-specific problem. I feel that I am not solving your problem quickly and efficiently.  You might find more and better help than I have been able to provide in a custom coding board. You can ask there about the correct way to check this php Variable without creating php errors.
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3888 on: May 07, 2011, 01:48:11 PM »
I am having trouble again......I have a page linking to another page, here is the code
Code: [Select]
<p><a href="index.php?page=page4106"" target="_blank" >Play your uploaded MP3's</a></p>
<p><a href="index.php?page=page4107"" target="_blank" >Classic Rock Player</a></p>
<p><a href="index.php?page=page4108"" target="_blank" >Country Music Player</a></p>
The line ---  <p><a href="index.php?page=page4106"" target="_blank" >Play your uploaded MP3's</a></p> works just fine in my block linking to my player, but when I make a page linking the player, it ends up with an extra /index.php
Code: [Select]
http://gametechmods.com/forums/index.php/index.php?page=page4106
I have changed it to EVERYTHING I can think of, and cleared my cache a thousand times....is this a bub, or am I stupid?
I even tried
Code: [Select]
<p><a href="page=page4106"" target="_blank" >Play your uploaded MP3's</a></p>....BUT it still came out
Code: [Select]
http://gametechmods.com/forums/index.php/index.php?page=page4106
 
What do I do, how can I link to my player without it adding the extra index.php
 
 
 

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3889 on: May 07, 2011, 03:40:38 PM »
OK, I changed my code to this...AND IT STILL wont work......it keeps adding the extra index.php.....and pisssssssing me offfffff!


Code: [Select]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MP3 Players</title>
</head>


<body>
<table width="23%" height="178" border="2" align="center" cellpadding="4px" bordercolor="#000000">
<tr>
       <td width="57%" height="170" valign="top">
       <p><a href="index.php?page=page4106">Play your uploaded MP3's</a></p>
       <p><a href="index.php?page=page4107">Classic Rock Player</a></p>
       <p><a href="index.php?page=page4108">Country Music Player</a></p>
   </td></tr></table>
<br />
</body>
</html>




EDIT:  The only way it will take the code is HTML, php gives an error


An Error Has Occurred!

Syntax error in block code. Please check the code.
« Last Edit: May 07, 2011, 03:44:06 PM by ACAMS »

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,317
  • Gender: Male
  • The Quest is the Quest
    • Underdog-01 on GitHub
    • WebDev.ca
Re: SimplePortal - 2.3.3 Released!
« Reply #3890 on: May 07, 2011, 03:49:01 PM »
.. so do not include index.php in your code. Also only include what is in the body of the html you just posted.

Quote
EDIT:  The only way it will take the code is HTML, php gives an error
Code: [Select]

echo '<table width="23%" height="178" border="2" align="center" cellpadding="4px" bordercolor="black">
<tr>
       <td width="57%" height="170" valign="top">
       <p><a href="index.php?page=page4106">Play your uploaded MP3s</a></p>
       <p><a href="index.php?page=page4107">Classic Rock Player</a></p>
       <p><a href="index.php?page=page4108">Country Music Player</a></p>
   </td></tr></table>
<br />';

.. it gave an error because of the apostrophe. If you want it to show you can use a character code

ie.
Code: [Select]
echo '<table width="23%" height="178" border="2" align="center" cellpadding="4px" bordercolor="black">
<tr>
       <td width="57%" height="170" valign="top">
       <p><a href="index.php?page=page4106">Play your uploaded MP3&#39;s</a></p>
       <p><a href="index.php?page=page4107">Classic Rock Player</a></p>
       <p><a href="index.php?page=page4108">Country Music Player</a></p>
   </td></tr></table>';

\\Edit -> I change to character code.
« Last Edit: May 07, 2011, 05:45:10 PM by -Underdog- »

My SMF Mods & Plug-Ins

WebDev

“Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune.” - Noam Chomsky

Offline ACAMS

  • Full Member
  • ***
  • Posts: 607
  • HEY, watch this....here, hold my beer
    • gametechmods.com
Re: SimplePortal - 2.3.3 Released!
« Reply #3891 on: May 07, 2011, 04:09:40 PM »
I removed the apostrophe and another page linking the player and saved as php and IT WORKS  :D


THANKS!!!
« Last Edit: May 07, 2011, 04:27:45 PM by ACAMS »

Offline teos55

  • Jr. Member
  • **
  • Posts: 373
  • Gender: Male
    • Culturel heritage photography blog
Re: SimplePortal - 2.3.3 Released!
« Reply #3892 on: May 17, 2011, 01:16:53 PM »
Running SMF 1.1.13  default theme  Simple Portal 2.3.3

  As mentioned in topic :http://www.simplemachines.org/community/index.php?topic=434341.0

this is a clean system with no errors systemwise.

I'm not sure when this error happened but the problem is:

- Create a BBC custom block and put :

Code: [Select]
[img]https://picasaweb.google.com/teos1955/Cambodia?authkey=Gv1sRgCOWM-5PfuqS0lgE#5607733418829291538[/img]
 Result :  image not shown  and [/img] tag is sticked to the link data and blue.

    Consequently 404 not found error.  picasaweb album is public not private. In fact it doesnt matter which link
you put there, always [/img] is sticked to the link

Any guidance ?

nb.  After posting noticed that, same failure happens here in code path of the topic. Strange !!

Offline Angelina Belle

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,586
Re: SimplePortal - 2.3.3 Released!
« Reply #3893 on: May 17, 2011, 01:38:10 PM »
In http://www.simplemachines.org/community/index.php?topic=434341.0 you mentioned that you re-installed SMF 1.1.13 from scratch, then began re-installing mods.

I don't think I understand the problem. I'd like to start with an image that ought to work, instead of an HTML page. How about
Code: [Select]
[img width=300]https://lh4.googleusercontent.com/_se0aqm-n1iA/TdKr1VhoIBI/AAAAAAAAGL4/JV_DOCz3EyQ/s720/_MG_3162.jpg[/img]
Please show a picture of what it looks like to edit this block, like this:
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Offline teos55

  • Jr. Member
  • **
  • Posts: 373
  • Gender: Male
    • Culturel heritage photography blog
Re: SimplePortal - 2.3.3 Released!
« Reply #3894 on: May 17, 2011, 01:54:22 PM »
 My settings below ...

Offline teos55

  • Jr. Member
  • **
  • Posts: 373
  • Gender: Male
    • Culturel heritage photography blog
Re: SimplePortal - 2.3.3 Released!
« Reply #3895 on: May 17, 2011, 01:59:18 PM »
And this is output of your recommendation. I'm not familiar but can it related to hotlinks ?
Previously it was working with no hassle.

This is same error in topic : http://www.simplemachines.org/community/index.php?topic=433264.0
« Last Edit: May 17, 2011, 02:02:27 PM by teos55 »

Offline teos55

  • Jr. Member
  • **
  • Posts: 373
  • Gender: Male
    • Culturel heritage photography blog
Re: SimplePortal - 2.3.3 Released!
« Reply #3896 on: May 17, 2011, 04:02:00 PM »
  I dont know whether it is clue or not but when I logged out, I can see the photos on main page of
guest screen :-)  The blocks permission includes guest view. Not only as admin user also tested with
a regular member.

  I tested this with opera, firefox and chrome. As soon as the users logs in, the problem starts.

Offline Angelina Belle

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,586
Re: SimplePortal - 2.3.3 Released!
« Reply #3897 on: May 18, 2011, 08:00:08 AM »
But [img] tag works OK in topics? Do you have any errors in your SMF error log?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor

Offline teos55

  • Jr. Member
  • **
  • Posts: 373
  • Gender: Male
    • Culturel heritage photography blog
Re: SimplePortal - 2.3.3 Released!
« Reply #3898 on: May 18, 2011, 10:17:21 AM »
Yes AngelinaBelle,  [img] tag in topics works as designed. It's only fails when used in BBC custom block.
No erros in the errorlog unfortunately. Even this happens if I put an image from my site.

Offline Angelina Belle

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,586
Re: SimplePortal - 2.3.3 Released!
« Reply #3899 on: May 18, 2011, 11:00:39 AM »
It looks like the BBC parser has gotten confused and included the [/img] tag in the URL. Could you provide me a link to your site?

This is a puzzling little problem. What other mods do you have installed? What other mods have you uninstalled?
Never attribute to malice that which is adequately explained by stupidity. -- Hanlon's Razor