Stefano Mtangoo 455 Senior Poster

Well you could argue that, but PDO, as its OOP, can be a little difficult to grasp - especially if your trying to get to grips with basic SQL. However, I would recommend moving to PDO asap.

Yeah, PDO is OOP and OOP is not that hard ;)
If they find it hard, MySQLi have non OOP way also of doing param queries

Stefano Mtangoo 455 Senior Poster

If my guess is right, we can use a Dot notation array access class. In addition, an array can be nested within an array deeper than what we can normally do without the dot notation class.

Then we can implement the loop the way twig and smarty implement their loops.

I have not understood what you have said. can you elaborate?

Stefano Mtangoo 455 Senior Poster

Agree Ev - I prefer PDO via binding parameters. But coders starting out usually begin with vanilla mysql.

Which I always don't like as it becomes their behaviour :)

Stefano Mtangoo 455 Senior Poster

If using DBs, the standard cleaner is mysql_real_escape_string().

Moving to MySQLi or PDO and do parametric queries is the recommended way !

Stefano Mtangoo 455 Senior Poster

you could tune the codes to make it become safer, faster and generic
as your need, if there are bugs, please tell me, I will try my best to
fix it

size_t *remove_adjacent(size_t *first, size_t *last, std::vector<size_t> &result)
{
  if(first == last) return 0;

  size_t *next = first + 1;
  if(next == last) result.push_back(*first);
  while(next != last)
  {
    if(*first <= *next)
    {
      std::cout<<*first<<", "<<*next<<std::endl;

      result.push_back(*first);
      ++first; ++next;
      if(next == last)
      result.push_back(*first);
    }
    else if(*first > *next)
    {
      std::cout<<*first<<", "<<*next<<std::endl;
      result.push_back(*first);
      if(last - next > 1)
      {
        first += 2;
        next  += 2;
      }
      else
      {
        return last;
      }
    }
  }
}

void case_03()
{
  size_t A[] = { 1, 2, 3, 4, 2, 1, 6, 9 };
  std::vector<size_t> result;
  remove_adjacent(A, A + sizeof(A) / sizeof(*A), result);
  std::copy(result.begin(), result.end(), std::ostream_iterator<size_t>(std::cout, "\n") );
}

This is bad!!!!

Stefano Mtangoo 455 Senior Poster

I changed line 12 like u said but it still isn't working.

"isn't working" does not convey anything useful!

Stefano Mtangoo 455 Senior Poster

Apart from w3schools my fav is PHP 101. It is crash course

Stefano Mtangoo 455 Senior Poster

may be screenshot will help explaining what you are saying. I have not understood what you have just said!

Stefano Mtangoo 455 Senior Poster

Hi,
I was reading on the net and could not find how to implement as loop something like
twig's

<ul id="navigation">
        {% for item in navigation %}
            <li><a href="{{ item.href }}">{{ item.caption }}</a></li>
        {% endfor %}
  </ul>

I want to have idea of what is going on!

Stefano Mtangoo 455 Senior Poster

Use Bcc and put it in the additional header. See an example in the documentation.

In the context of correspondence, blind carbon copy (abbreviated Bcc) refers to the practice of sending a message to multiple recipients in such a way that conceals the fact that there may be additional addressees from the complete list of recipients. This concept originally applied to paper correspondence and now also applies to email.
Source

Stefano Mtangoo 455 Senior Poster

Sorry, I must gave the impression I'm an expert :)
Would you kindly write the code that will do the trick? I don't know much about php and mysql :(
Thank you!

to secure a web app from XSS, validate input against whitelist and discard anything not in white list. Also escape output in case something was missed and got through your line of defense!
implementation differs and that is programming!

Stefano Mtangoo 455 Senior Poster

.please solve my problem.

So what is your problem?

Stefano Mtangoo 455 Senior Poster

Save on server WAMP/LAMP and give it php extension!

Stefano Mtangoo 455 Senior Poster

Enjoy!

Stefano Mtangoo 455 Senior Poster

$encoded = base64_encode("<script> or <scripting>");
//work with $encoded

If it is client side then you need to encode using JS. See
http://stackoverflow.com/questions/246801/how-can-you-encode-to-base64-using-javascript

Stefano Mtangoo 455 Senior Poster

what exactly you want to encode? Following links there are examples

Stefano Mtangoo 455 Senior Poster

enjoy!

Stefano Mtangoo 455 Senior Poster

the auto detect solved the problem, thanks a lot

Mark it so then!

Stefano Mtangoo 455 Senior Poster

you can use PHP url encode or just encode/decode using base 64 encode

Stefano Mtangoo 455 Senior Poster
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = FALSE;

and

var_dump($this->config->item("global_xss_filtering"));
           exit;

result

bool(false)

When I put in a

<script> or <Scripting>

nothing shows! just blank...
Can you try and see if you have the same issue?

Thanks

Global might be off but you can specify it during sending. Please post your form code

Stefano Mtangoo 455 Senior Poster

global_xss_filtering is False… by default…

No solution found…

Anyone with the system and a form can u try submiting the word

<script>

or

<scripting>

and see if it gives you a blank page?

Thanks…

Tried in every form I have and it gives the same blank page… I thougth it could be my code… but every single form, thats just a bit too much…

Check again. That sounds to me XSS filtering is enabled. can you post your code?

Stefano Mtangoo 455 Senior Poster
else
(

is supposed to be

else
{

line 157

Stefano Mtangoo 455 Senior Poster

if you study how it works and explain here, we will easily help. No body can translate it for you!

Stefano Mtangoo 455 Senior Poster

Are you sure XSS filtering is not enabled?

Stefano Mtangoo 455 Senior Poster

awesome. thank you. I'll look more into it tonight after work. see what I can do since this guy is using xampp and I am using wamp. not sure how big the differences are. Also, are you a Christian? Just curious. :)

Me in nutshell:A man that loves Jesus and explores science & technology
for anything else PM me!

Stefano Mtangoo 455 Senior Poster

wand I just realized that phpmyadmin won't let me in cause it said my username and password were incorrect. :(

Check the this

Stefano Mtangoo 455 Senior Poster

C:\wamp\WWW\dynamic maps to http://localhost/dynamic not http://localhost/dynamic website/welcome7.php. That is why bing redirects you. if Bing was not active you woulf get page not found

Stefano Mtangoo 455 Senior Poster

dealing with mime can be dirty so I suggest you go PHPMailer!

Stefano Mtangoo 455 Senior Poster

Here you go..
http://www.microsoft.com/web/platform/server.aspx
See, its free :D

Thanks!

Stefano Mtangoo 455 Senior Poster

Well, I use Smarty. I have predefined blocks for the backed ($MENU, $FOOTER, $CONTENT), which can be used in my theme template, if that's what you mean. That way, it is no longer dependant on CSS only (you can choose to not render stuff, instead of hiding it).

cool! thanks you!

Stefano Mtangoo 455 Senior Poster

I may have to go the route of a reinstall. I managed to get it to "work", but I have to go to http://localhost and then navigate to the file from that page. kinda annoying

what do you mean?

Stefano Mtangoo 455 Senior Poster

A CSS only theme can get you quite far I think. Just make sure your building blocks can be accessed by id's, and similar items by classes.

Thanks.
Is there a way to make blocks accessible to backend where by I can assign block to something (article, links, menu et al) so that in combination to CSS I can change layout of the theme?

Thanks for great tip I didn't think of :)

Stefano Mtangoo 455 Senior Poster

Seems to me like you need this to get up

Stefano Mtangoo 455 Senior Poster

Hi friends,
it is weeks now I'm trying to figure out how to make simple custome theme engine for my custom PHP CMS. I want to use it for my projects. It is based on custom framework too. So I checked how Drupal does it and Joomla. They are complex but gave me little Idea.

What do I need to make a theme engine so that one can make a theme without knowing internal flow of the site articles, menus et al? Any article that talks of generic theme engine (not some specific CMS based)

I hope I have made clear myself.
Thanks

Stefano Mtangoo 455 Senior Poster

you can mark thread solved :)

Stefano Mtangoo 455 Senior Poster

@evstevemd: I'm not clear about it but I'm pretty sure I read somewhere in the Microsoft website that "IIS is free" although not available for download. And as per my observation it is free, you can just use add/remove components menu to add IIS. In windows 7, control panel>programs>turn on and off features and add it. I have a feeling that there might be some commercial addons but do tell if you know more regarding it.

Can you link me to article?

Stefano Mtangoo 455 Senior Poster

did you try google?
here is one of the link teaching to do just that. Follow tutorial and if you fail anywhere tell us
http://woork.blogspot.com/2009/05/how-to-implement-post-to-wall-facebook.html

Stefano Mtangoo 455 Senior Poster

html pages can't display php unless you stipulate this in .htaccess. Change .html to .php and it should work (if your code is OK).

I just tested code blow and it didn't work!

<html>
<head> </head>
<body>
<?php echo "It works!"; ?>
</body>
<html>

adding this line in htaccess file worked:

AddType application/x-httpd-php .html .htm
Stefano Mtangoo 455 Senior Poster

I have no problem helping others..I'm not a teacher.

doing for them is not helping them it is making them more lame and dependant on somebody

Stefano Mtangoo 455 Senior Poster

also "it does not work" is not better way to explain problem. Say what and how exactly it does not work!

Stefano Mtangoo 455 Senior Poster

I hope we are not seers. We cannot peep in your machine and look at your code!

Stefano Mtangoo 455 Senior Poster

are using phpmail to deal with mime? Why not give try to PHPMailer/SwiftMailer?
As adviced above please post relevant code (not whole thing)

Stefano Mtangoo 455 Senior Poster

Did you install wampserver or xampp? Did you start it well? do http://localhost work?
Bing redirects you to search once it fails to locate url. it seems your apache server have issues. Try restarting services or backup your data and reinstall the whole thing

Stefano Mtangoo 455 Senior Poster

if the file is on the server-

if (file_exists("folder/myfile.xlsx"))
			unlink("folder/myfile.xlsx");

Give Op Something to work on instead of straight code. That way they won't learn.
That being said, I would suggest you check SPL's directory iterator. There are couple of examples under comments

Stefano Mtangoo 455 Senior Poster

there are couple of security issues to deal with
1. Prevent unauthorized logins. Here you will meet th greatest threat, SQL injection. Once you deal with that thru data validation, whitelisting and preparedstatements you are ready for next challenge.

2. You need to prevent your authentication data mostly session from being hijacked and used against system. Here you will meet jargons like session fixation et al. This can be fixed using differen techniques already on the net if you be dilligent in searching.

3. Lastly you will need to check what you are inputting/outputting. User data are never to trust, so validation validation validation then cleaning. Also when you output data you need to escape them to prevent any XSS attacks

So in summary:
Guard against SQL injection
Protect your session from any attacks
Validate/Escape inputs and outputs from and to users/browsers

I would suggest you do it if you think your level allows you or that your site is not storing sensitive info. Else I would suggest you check ready made solutions or use something like OpenID

Stefano Mtangoo 455 Senior Poster

string implode ( string $glue , array $pieces )
string implode ( array $pieces )

from PHP Manual

<?php

$array = array('lastname', 'email', 'phone');
$comma_separated = implode(",", $array);

echo $comma_separated; // lastname,email,phone

// Empty string when using an empty array:
var_dump(implode('hello', array())); // string(0) ""

?>
Stefano Mtangoo 455 Senior Poster

Yes it is called pagination

Stefano Mtangoo 455 Senior Poster
function RemoveBad($strTemp) { 
    $strTemp = $strTemp.replace("/\<|\>|\|\|\%|\;|\(|\)|\&|\+|\-/g","");
    return $strTemp;
}

Fatal error: Call to undefined function replace() in C:\xampp\htdocs\php_exercise\receive.php on line 18

what is your programming languages background?
in PHP we do it this way

Stefano Mtangoo 455 Senior Poster

Sorry, what i ment is that the form is working just fine, but the mail is not sendt to my inbox. I tried to use the exsact same code on another domain and then i got all of the e-mails. This would suggest something is wrong with my server maybe?

can you send mails using same domain with other clients (Outlook Thunderbird et al)?
Try sending using any of those with your settings from phpmail you used above. If it don't work then contact your support/admin

Stefano Mtangoo 455 Senior Poster

something is wrong with your form as it is presenting empty variable to query. My Advice is make very tiny form and connect it to DB and make sure that it is working and transfer that to your code. I cannot help with this big chunk of code and limited time at hand. So minify your program to form and database and let us start from there