General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 9th, 2003, 07:41 PM
Attila Attila is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 67 Attila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Stripslashes, addslashes, and MD5 vs Password

Hello got some general questions if someone can help.

What is the purpose of stripslashes and addslashes? I write multiple things to the database and do not have any problems not using these to built in functions. I have read them at http://www.php.net/manual/en/function.stripslashes.php but still do not understand.


For my useres I have their password saved in the database as PASSWORD(pass) I have seen many people talking about MD5 is this the same? What is the difference?

Functions
PHP Code:
require "./conf_global.php";  //this is all the connection information.

//I would like to put the below in a dbconnect.php file but have not been lucky at getting it to work.
$link mysql_connect($conf['sql_host'], $conf['sql_user'], $conf['sql_pass']);
mysql_select_db($conf['sql_database'], $link) or die ("Connection Failed."); 


Thinking it would be simple I would do this.
PHP Code:
 dbconnect (); 
But when I do just that I get an error saying undefined function. So how do I fix that?

Also here is my basic page layout.

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<
html>
<
head>
<
link rel="stylesheet" type="text/css"
href="CSS%20Sheet/GnA.css" />
<
title>GnA Squad</title>
<
META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<
META HTTP-EQUIV="Expires" CONTENT="-1">

<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</
head>

<
body>
<
table class="maintables" width="100%" border="0"  bordercolor="" cellspacing="0" cellpadding="0">
  <
tr
    <
td  height="45" valign="bottom"><div align="center"><? include ("includes/header.php");?></div></td>
  </tr>
</table>

<table class="maintables" width="100%" border="0"  bordercolor="" cellspacing="0" cellpadding="0">
  <tr> 
    <td align="left" valign="bottom"><? include ("includes/numusersonline.php");?></td>
  </tr>
</table>

<table class="maintables" width="100%" border="0" cellspacing="3" cellpadding="0">
    <tr> 
           <td class="maintables" width="0%" valign="top" align="left"><? include ("includes/leftnav.php");?></td>
        <td class="maintables" width="10" align="center" valign="middle"><img src="images/spacer.gif" width="1" height="1"></td>
        
    <td class="maintables" width="100%" valign="top"><? include ("includes/indexnews.php");?></td>
        <td class="maintables" width="10" align="center" valign="middle"><img src="images/spacer.gif" width="1" height="1"></td>
        <td class="maintables" width="0%" valign="top" align="right"><? include ("includes/rightnav.php");?>
      </div></td>
    </tr>
</table>

<div align="center">
<table class="maintables" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
      <td class="maintables" height="45" align="center" valign="middle"><? include ("includes/copyright.php");?>
      </td>
  </tr>
</table>
</div>
<p>&nbsp;</p>
</body>
</html> 


If I do get a function to work to connect to the database would I just be able to add the connection to
PHP Code:
<? include ("includes/header.php");?>
the header.php or do I need to add it to all the files?
__________________
Thanks,
Attila
http://www.glorynaspiration.com
http://www.abitofthings.com

Reply With Quote
  #2  
Old January 9th, 2003, 08:39 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
ok what you wanna do is this...


PHP Code:
require "./conf_global.php";  //this is all the connection information.

//I would like to put the below in a dbconnect.php file but have not been lucky at getting it to work.
function dbconnect()
{
$link mysql_connect($conf['sql_host'], $conf['sql_user'], $conf['sql_pass']);
mysql_select_db($conf['sql_database'], $link) or die ("Connection Failed.");



then in your code, you can do this.

PHP Code:
 dbconnect(); 


Provided dbconnect() is not already a function,...I dunno,..lol


As for the Password thing. Storing passwords without some sort of encrypting can be ok...depends on what you wanna use it for and how paranoid you are.

to me it is easy enough to just md5 the password before inserting into the db. If you wanna make the length smaller you can base64_enconde the md5'd password All sorts of things you can do

PHP Code:
 $password md5($_POST['password']); 
__________________
-- Jason

Last edited by Taelo : January 9th, 2003 at 08:43 PM.

Reply With Quote
  #3  
Old January 9th, 2003, 10:47 PM
Attila Attila is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 67 Attila User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Thank you makes sence....I had that at one time just cou;dnt get it to work....I have the function burried a few layers deep the dbconnect.php function....Should it be in the same directory?

Reply With Quote
  #4  
Old January 9th, 2003, 11:53 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
up to you just make sure if it is a lower directory you include the right path,...

like ../dbconnect.php


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Stripslashes, addslashes, and MD5 vs Password


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT