This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#76 2012-10-05 12:04:20

P110
Scratcher
Registered: 2011-04-12
Posts: 500+

Re: EternityX1 Development Topic

jvvg wrote:

trinary wrote:

jvvg wrote:


This can be fixed by simply escaping SQL data.

Something which they are currently /not/ doing.

It\'s a problem.  tongue
When I took programming at school, one of the units was in security. We learned absolutely nothing there. The whole class was a total waste of my time.  tongue

I learned real programming security through the internet, where I learned that whenever outputting HTML user-submitted data, it needs to be escaped, no matter what context. I also learned that all submitted data used in a SQL query must be escaped.

Man I suddenly hate sql


Me live on 2.0 now  sad

Offline

 

#77 2012-10-05 12:16:07

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

P110 wrote:

jvvg wrote:

trinary wrote:


Something which they are currently /not/ doing.

It\'s a problem.  tongue
When I took programming at school, one of the units was in security. We learned absolutely nothing there. The whole class was a total waste of my time.  tongue

I learned real programming security through the internet, where I learned that whenever outputting HTML user-submitted data, it needs to be escaped, no matter what context. I also learned that all submitted data used in a SQL query must be escaped.

Man I suddenly hate sql

That's why some of my older sites used files instead.  tongue


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#78 2012-10-05 13:30:05

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

jvvg wrote:

P110 wrote:

jvvg wrote:


It\'s a problem.  tongue
When I took programming at school, one of the units was in security. We learned absolutely nothing there. The whole class was a total waste of my time.  tongue

I learned real programming security through the internet, where I learned that whenever outputting HTML user-submitted data, it needs to be escaped, no matter what context. I also learned that all submitted data used in a SQL query must be escaped.

Man I suddenly hate sql

That's why some of my older sites used files instead.  tongue

yet it's still inefficient, I will fix everything.  on second thought, P110 fix everything.  (Please)


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#79 2012-10-05 14:48:52

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

jvvg wrote:

P110 wrote:


Man I suddenly hate sql

That's why some of my older sites used files instead.  tongue

yet it's still inefficient, I will fix everything.  on second thought, P110 fix everything.  (Please)

Yeah, that's why I use MySQL now.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#80 2012-10-05 15:37:09

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

hey, jvvg!  I was wondering where I can find the code for how you implemented the AJAX user search, I looked on the page, but there wasn't anything there that seemed like it would do what it's supposed to except outputting the user.


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#81 2012-10-05 15:38:34

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

hey, jvvg!  I was wondering where I can find the code for how you implemented the AJAX user search, I looked on the page, but there wasn't anything there that seemed like it would do what it's supposed to except outputting the user.

It's in the JS code on the page. (it isn't in the repo yet, I'm pushing changes this weekend).

The code for that specific page is...

Code:

<script type="text/javascript">
//<![CDATA[
function searchUser(query) {
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else {
         req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    document.getElementById('users').innerHTML = 'Working...';
    req.open("POST", "/users", true);
    req.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
    req.send("query=" + encodeURIComponent(query));
    
    req.onreadystatechange = function() {
        if (req.readyState==4 && req.status==200) {
            document.getElementById('users').innerHTML = req.responseText;
        } else {
            document.getElementById('users').innerHTML = 'Error: ' + req.status;
        }
     }
}
//]]>
</script>

Last edited by jvvg (2012-10-05 15:39:23)


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#82 2012-10-05 15:42:14

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

That would be compatible with this page, correct?  I'd just have to change references to id's


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#83 2012-10-05 15:44:22

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

That would be compatible with this page, correct?  I'd just have to change references to id's

That would work, but you also need server-side code that outputs JUST THE RETURNED RESULT.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#84 2012-10-05 15:46:17

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

jvvg wrote:

XenoK wrote:

That would be compatible with this page, correct?  I'd just have to change references to id's

That would work, but you also need server-side code that outputs JUST THE RETURNED RESULT.

I know how to do that, but could I see your code for that?


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#85 2012-10-05 15:48:40

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

jvvg wrote:

XenoK wrote:

That would be compatible with this page, correct?  I'd just have to change references to id's

That would work, but you also need server-side code that outputs JUST THE RETURNED RESULT.

I know how to do that, but could I see your code for that?

My code is just this:

Code:

function getUsers($query = false) {
    global $db;
    $result = $db->query('SELECT username,id,permission FROM users
    WHERE status<>\'disabledbyadmin\'' . ($query ? ' AND username LIKE \'' . str_replace('*', '%', $db->escape($query)) . '\'' : '') . '
    ORDER BY username ASC') or error('Failed to get users', __FILE__, __LINE__, $db->error());
    ?>
    
    <?php
    if (!$db->num_rows($result)) {
        echo '<p>Your search returned no results! :(</p>';
    }
    while ($cur_user = $db->fetch_assoc($result)) {
        echo '<p>' . parse_username($cur_user) . '</p>';
    }
}
if (isset($_POST['query'])) {
    ob_end_clean();
    getUsers($_POST['query']);
    die;
}

http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#86 2012-10-05 15:53:21

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

lets see.... I have just a bit of tweaking to do then.


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#87 2012-10-05 15:58:50

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

lets see.... I have just a bit of tweaking to do then.

Yep. I actually just copy-paste that AJAX script to use for just about everything.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#88 2012-10-05 16:28:39

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

well, I got the AJAX part to work, it just renders an error pretty wierdly...  try it out jvvg


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#89 2012-10-05 16:30:42

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

well, I got the AJAX part to work, it just renders an error pretty wierdly...  try it out jvvg

You probably put the response text in the wrong place, and the page that gets the users is returning an error.
Also, we use our own database driver for Mod Share, so you'll need to change the functions around.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#90 2012-10-05 16:32:58

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

You know what, I'm going to give you FTP later for helping us out on the ajax search, but only that, and you can look at the other files too, but mainly the only ones worth checking out are the ones that start with user_


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#91 2012-10-05 16:34:08

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

XenoK wrote:

You know what, I'm going to give you FTP later for helping us out on the ajax search, but only that, and you can look at the other files too, but mainly the only ones worth checking out are the ones that start with user_

Ok.


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#92 2012-10-05 17:46:05

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

If you want to see more Mod Share code, I just pushed our recent changes to the Assembla repo.

Last edited by jvvg (2012-10-05 21:21:21)


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#93 2012-10-05 21:22:07

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: EternityX1 Development Topic

Something's up with your database...

Errors:

Code:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in [server root]/html/includes/maintenance.php on line 13

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in [server root]/html/index.php on line 27
Could not connect: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#94 2012-10-06 11:39:15

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

should be fixed now.   P110, I just finished the ban/unban file.  I'm moving on to the next user admin file.


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#95 2012-10-06 12:27:09

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

user_admin_delete.php finished.   big_smile   I'm gonna start user_admin_edit.php tonight, hopefully finish it, and revise all the code in the users section, and if I'm lucky, I'll be able to move on to the messages section!


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#96 2012-10-06 21:29:08

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

sorry I took so long with the FTP, I was away from home almost the entire day.  It should be updating now

username: jvvgindustries
password: the one you gave me in the email
hostname: eternityinc-official.com


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#97 2012-10-07 10:03:39

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

I just finished the final admin file for the users section.   I can now start in on messaging!  But first, I may add some enhancements to the files.


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#98 2012-10-07 10:19:59

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

alright, starting to plan out messaging.


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#99 2012-10-07 10:47:18

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

implementing message_index.php now.


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

#100 2012-10-07 11:03:10

XenoK
Scratcher
Registered: 2011-09-08
Posts: 1000+

Re: EternityX1 Development Topic

message_index.php implemented.  Planning message_compose.php ...


Eternity Tasks has launched into Alpha One! http://tasks.eternityincurakai.com/EI%20projects.png

Offline

 

Board footer