wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] Weird error... undefined function mysql_connect()
wildteen88 replied to shlomikalfa's topic in PHP Coding Help
No dont unistall WAMP. Its not a wamp issue. It has to do with how Zend is setup. I am not experienced with Zend but I think it comes with its own PHP setup. You'll need to configure Zend to point to WAMPs PHP setup. -
In login.php change $password = $_POST['password']; to $password = md5($_POST['password']); In register.php change $newpass = $password; to $newpass = md5($password); Before running the following script, I advise you to backup your existing database first. Now you'll need to run the following script ONLY ONCE in order for existing members logins to work: include 'header.php'; while(list($username, $password) = mysql_fetch_assoc(mysql_query('SELECT username, password FROM members')) { mysql_query('UPDATE members SET password='.md5($password).' WHERE username="'.$username.'"'); } echo 'Passwords reset. DELETE THIS SCRIPT NOW DONOT RERUN.'; Do not run the above script more than once otherwise you'll break existing password.s
-
[SOLVED] Data disappearing in my sessions
wildteen88 replied to Guardian-Mage's topic in PHP Coding Help
Do you have anther variable called limit in your code or perhaps a form field called limit which is any array and does your have have register_globals enabled echoing $_SESSION['limit'] or $limit in your second page should not return "array" -
When checkboxes are checked your browser will include it in the $_POST data (or $_GET date depending on your forms submit method). So just check to make your checkbox field exists eg: if(isset($_POST['chk_box_name']) && !empty($_POST['chk_box_name'])) { echo 'chk_box_name was checked!'; }
-
If you post parts of your script which logs users in then we maybe able to help you. In order for your existing passwords in your database to become md5 encrypted you'll have to do this with a MySQL query.
-
WHat! You are making no sense. md5() is a core PHP function. Are you trying to implement md5 passwords in your existing script as currently your not using any type of encryption. Also what do you mean by: What did you buy? The PHP script?
-
[SOLVED] Weird error... undefined function mysql_connect()
wildteen88 replied to shlomikalfa's topic in PHP Coding Help
If you have WAMP installed you should not need to configure anything. WAMP sets everything up for you. If you have had a previous installation of PHP before you installed WAMP then the problem could be to do with older php binaries/extensions being left behind after your removed your older PHP setup. All php binaries/extension must be of the same version as the version of PHP you have installed. If your newer PHP installation finds older binaries/extensions then you'll experience the kind of problems you're having now. This is why your should not move any files outside of the PHP Installation folder, if you do move any files then always make sure you keep track of which files you have moved and where to. Make sure you delete those files before installing a newer version of PHP. To see if PHP is loading the mysql extension create a new file and call it info.php and place the folloiwng code in it: <?php phpinfo(); ?> Save info.php to WAMPs www folder (should be C:\wamp\www). Now go to http://localhost/info.php You should get a page displayed providing information about PHP's setup. Scroll down the page and see if you can find a mysql heading/section if you do PHP is setup correctly and so the issue is down to Zend. If you can't find a Mysql heading/section and you have enabled the PHP extension via WAMPs control panel, then I'd recommend you to do the following. Go to Start > Search and search for the following files on at a time: libmysql.dll php_mysql.dll php5ts.dll Windows should only find once instance of each of the above files (they should only be located somewhere in C:\wamp), If you find more than one of instance of the above files either rename them or delete them Now restart WAMP and run info.php. You should now find a MySQL heading/section. -
replace .htaccess file with php function please
wildteen88 replied to woocha's topic in PHP Coding Help
Umm nloding and rarebit please read the OP question. We're not use mod_rewrite. The OP wanted to do this with just PHP. -
replace .htaccess file with php function please
wildteen88 replied to woocha's topic in PHP Coding Help
I'd do it like this <?php if(isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '/' && count($_GET) == 0) { // get the full url. $path = $_SERVER['PATH_INFO']; // explode the url into pieces. // eg filename.php/piece1/piece2/etc $path_bits = explode('/', $path); // remove the file name from $path_bits array array_shift($path_bits); // loop throught the remaining values in the $path_bits array // we'll automaticlly populatue the $_GET superglobal array foreach($path_bits as $bit) { // each piece contains both the key and the value eg: // filename.php/key1-value1/key2-value2/etc list($key, $value) = explode('-', $bit); // populate the $_GET superglobal array $_GET[$key] = $value; } } echo '<pre>' . print_r($_GET, true) . '</pre>'; ?> <hr /> TESTS <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>/id-1">TEST1 Clean</a> | <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?id=1">TEST1 Default</a><br /> <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>/somevar-hello/anotherver-abc123">TEST2 Clean</a> | <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?somevar=hello&anotherver=abc123">TEST2 Default</a><br /> -
replace .htaccess file with php function please
wildteen88 replied to woocha's topic in PHP Coding Help
Why don't you create a core function in your app which will generate either clean urls or default messy urls if users want to use mod rewrite. This is how most PHP apps are set up. However you can do friendly clean urls with just PHP but the file name must be present. The cleanest url you'll be able to get is: filename.php/clean/url/here -
Not the best approach but it works: <?php $file_data = file_get_contents('file.txt'); $file_data = str_replace('" "', ',', $file_data); $file_data = preg_replace('|(\s+){2,}|', '', $file_data); $file_data = preg_replace('|"([a-z0-9]+)"\{"|i', "$1|", $file_data); $file_data = str_replace('""', '|', $file_data); $file_data = str_replace('"}', "\n", $file_data); $datas = explode("\n", $file_data); foreach($datas as $data) { $pieces = explode('|', $data); $idcode = array_shift($pieces); foreach($pieces as $attrs) { list($key, $value) = explode(',', $attrs); $codes[$idcode][$key] = $value; } } echo '<pre>' . print_r($codes, true) . '</pre>'; ?> The above code converts, the following line blocks such as: "IDCode2" { "name" "Users Name2" "zomkh" "5" "onekh" "6" "humk1" "4" "humkz" "7" } to: IDCode2|name,Users Name2|zomkh,5|onekh,6|humk1,4|humkz,7 Then uses a few simple loops to generate the $codes associative array
-
Those websites that "decrypt" md5 hashes do not actually decrypt the md5 hash. Instead they have a database set-up which stores the md5 hash to the word that corresponds to it. So when you enter your md5 hash to your very secret password, all they do is see if the hash your provided is in the database already, if it is it'll return the actual word for the hash. This is one of the the many reasons why you should also not use simple passwords. When setting a password include as many different characters as possible. For example @p1Em9C is more secure than applemac. Passwords should not be meaningful. MD5 hashes are one way encryption only. Your could use a technique called salt to make your encryptions more secure.
-
This is an Apache problem. You'll want to add index.php to your DirectoryIndex directive
-
Why does foreach create a new variable if there is none set?
wildteen88 replied to david-king's topic in PHP Coding Help
robos you are incorrect. foreach loops do not initiate variables/array keys if they don't exist. If I run the following code: <?php $arr = array(); foreach($arr['test'] as $v) { echo $v; } echo '<pre>' . print_r($arr, true) . '</pre>'; ?> I get the following output: Notice: Undefined index: test in C:\Server\www\test.php on line 3 Warning: Invalid argument supplied for foreach() in C:\Server\www\test.php on line 3 Array ( ) -
Your code still makes not sense. $image_t holds an array which holds the width and height for the image in $img_path
-
Change this code: if (isset($_POST['submit'])){ $Cnumber=$_POST['Cnumber']; foreach($_POST as $key => $val){ $invoice= array($key => $val); } to: if (isset($_POST['submit']) && is_numeric($_POST['Cnumber'])) { $Cnumber = $_POST['Cnumber']; $invoice = mysql_real_escape_string(serialize($_POST)); include '../../../../connect.php'; mysql_query("INSERT INTO invoices (Cnumber, invoice) VALUES ('$Cnumber', '$invoice')"); }
-
Can you post details of how you have installed PHP. Did you read some guide on the internet or have you used an AMP package such as WAMP. Looking at your php.ini you have a heck of alot of extensions enabled. Are you sure you want that many extensions? You should only enable extensions that your are going to use in your PHP applications.
-
Your code wont output anything as you're not telling it to. All you're doing is passing the width and height of the uploaded file to your imageResize function. imageResize then returns the a string defining the new width/height.
-
Remove: position: absolute left: 12.5% From your .container class.
-
I am familiar with mybb. myBB uses eval() to parse the variables from the templates stored in the database. The variables are defined from the mybb core system and other places such as the mybb settings file/table. Thier template system is rather complex.
-
Yes it seem your array is not being made correctly. Can you post more code of your form. And explain what information gets provided in the form and where the form gets submitted too. Then post the PHP code which process the form.
-
Unless the page you are wanting to use the variable is included in the file that the variable was defined in then you do this: $myvar = 'some value'; include 'some_file.php'; <?php echo $myvar; ?> If its not then either set a cookie or use sessions.
-
Have read of the following Basic JOINS tutorial. The following article goes more in depth
-
Your blog must have its own template system which parses the code you have posted with the generated top 10 list. In order for it to show up in your index.html file you'll first have to rename it to index.php then include the relevant code from your blog for parsing the code to get your top 10 list.
-
It looks like you havn't setup any keys in your serialized array. If you haven't defined any keys you'll have to use $arr[0] to get the first item from the array $arr[1] to get the second ... etc... $arr[5] to get the sixth item. Remember arrays start at zero and not one