Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Too lazy to read everything, but I noticed:
PHP Code:
if(isset($_SESSION['M_USER'] = $username;) == "1")
quite fast.. you did $username; in a if statement.... take away that semi-colon :P
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
PHP Code:
<?php
include ('global.php');
if(isset($_SESSION['M_USER'] = $username;) == "1")
{
echo 'You are already logged in';
}
else
{
if(isset($_POST['login']))
{
$username = strip_tags(mysql_real_escape_string($_POST['username']));
$password = md5($_POST['password']);
if (empty ($username)||empty($password))
{
echo 'Please enter both fields and try again';
}
else
{
$userQ = mysql_query ("SELECT * FROM users WHERE `username` = $username ");
if (mysql_num_rows ($userQ)==0)
{
echo 'Please enter a valid username and try again';
}
else
{
$userA = mysql_fetch_array( $userQ );
if ( $password !== $userA["password"] )
{
echo 'This user exists but the password is incorrect please try again';
}
else
{
$_SESSION['M_USER'] = $username;
Header("Location: me.php");
define('LOGGED_IN', true);
}
}
}
}
}
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
Seano2o6
Very nice Luc :)
Posted via Mobile Device
Ok, I'm stuck on the login system.
PHP Code:
<?php
include ('global.php');
if(isset($_SESSION['M_USER'] = $username;) == "1") /*Error in this line, replace with: if(isset($_SESSION['M_USER'])) OR if(isset($_SESSION['M_USER']) && $_SESSION['M_USER'] === $username). I'd use the first example, second one is silly. */
{
echo 'You are already logged in';
}
else
{
if(isset($_POST['login']))
{
$username = strip_tags(mysql_real_escape_string($_POST['username']));
$password = md5(strip_tags(mysql_real_escape_string($_POST['password'])));
if (empty ($username)||empty($password))
{
echo 'Please enter both fields and try again';
}
else
{
$userQ = mysql_query ("SELECT * FROM users WHERE `username` = '{$username}' ");
if (mysql_num_rows ($userQ)==0)
{
echo 'Please enter a valid username and try again';
}
else
{
$userA = mysql_fetch_array( $userQ );
if ( $password !== $userA["password"] )
{
echo 'This user exists but the password is incorrect please try again';
}
else
{
$_SESSION['M_USER'] = $username;
Header("Location: me.php");
define('LOGGED_IN', true);
}
}
}
}
}
What is wrong with that?
I don't think this dev should've been approved. You need to learn before making such a project.
PS: I edited code, check it out.
PS2 For noobs: Sorry if anything else won't work, coding in a textbox is weird.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
MOD Close thread please, Didn't realise me trying to learn and do something for the community is a bad thing.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
Seano2o6
MOD Close thread please, Didn't realise me trying to learn and do something for the community is a bad thing.
Don't be so sarcastic, kryptos was right, I never made a thread for MacroCMS/quoCMS, until I knew I could do it.
Posted via Windows 8 Hacker Edition
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
@Seano2o6 You can enable errors in php.ini to see what's wrong with your code when you get a white page.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
PowahAlert
Don't be so sarcastic, kryptos was right, I never made a thread for MacroCMS/quoCMS, until I knew I could do it.
Posted via Windows 8 Hacker Edition
He wanted to make a thread to show people how he is doing, what is wrong with that? He posts a snippet, someone shows him how he could improve a section of code inside that. I see nothing wrong with this, everyone needs to start somewhere.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
Hejula
He wanted to make a thread to show people how he is doing, what is wrong with that? He posts a snippet, someone shows him how he could improve a section of code inside that. I see nothing wrong with this, everyone needs to start somewhere.
He's not asking how it can be better, he's asking what's the error in the code... Developments have to be approved for a reason, so someone who can't even do an if statement correctly doesn't have a development.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
Kryptos
He's not asking how it can be better, he's asking what's the error in the code... Developments have to be approved for a reason, so someone who can't even do an if statement correctly doesn't have a development.
So you tell him what the error is, and he knows for next time.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Thanks Hejula for supporting me, I'm resuming it in private development and will just release it eventually.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Looks good ;3. My design seems to be used a little more now! :P:
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Good luck Sean! I'd be interested in co-developing this with you.
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
zTriick
Good luck Sean! I'd be interested in co-developing this with you.
Your PHP isn't that good either so I suggest you team up. :thumbup1:
Re: [Dev] TrentCMS [MySQL, Phoenix Compatible]
Quote:
Originally Posted by
Livar
Your PHP isn't that good either so I suggest you team up. :thumbup1:
pfft. My PHP is waay better than Sean's. Only reason I am helping him is because I have nothing better to do.
http://screensnapr.com/e/v4obNJ.png