-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Why do I get this stupid furecking error? (Misspelled on purpose!)
MadTechie replied to 3raser's topic in PHP Coding Help
2nd parameter is port... it expects a long and your passing a string! just convert it to an int ie $port = (int)$_POST['port']; -
Okay let me ask a question If i was a new user, I assume I have no folder or private folder So when you do mkdir('/uploads/MadTechie/private'); /uploads/MadTechie/private can not be created because /uploads/MadTechie doesn't exists so your need to create BOTH ie mkdir('/uploads/MadTechie'); mkdir('/uploads/MadTechie/private');
-
You need to make BOTH folders, create the users folder THEN create the private folder inside
-
[SOLVED] login works for firefox but not internet explorer
MadTechie replied to silverglade's topic in PHP Coding Help
Clear cache cookies etc http://www.phpfreaks.com/forums/index.php?topic=244252.0 EDIT: a little slow!! -
Okay it seams either the database is not updating or its not pulling the correct data, first change var_dump($row,$_SESSION['loginHASH']); to var_dump($row,$_SESSION); that will check the userid, can you check the database via phpmyadmin, (or another database manager) to check the loginHASH in the Table2 table has a hash, or see if its empty
-
Okay remove the line die('We are HERE'); //<----THIS and update auth.php to the following (this is just for testing) <?php session_start(); include("connect1.php"); //Check the current users session ID and HASH with the ones in the database $result = mysql_query("SELECT loginHASH FROM table2 WHERE username = '".$_SESSION['userid']."' LIMIT 0,1"); $row = $row = mysql_fetch_assoc($result); var_dump($row,$_SESSION['loginHASH']); die(); //if not found then kick out if(mysql_num_rows($result) < 1){ $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-86400, '/'); } session_destroy(); header("location: index.php"); //redirect home } ?> you should get some array info, can you post that back
-
I assume your posting to index.php, if the details are correct it should redirect you do old.mainsite.php try adding a die just after the login (if blocks) to check the login is fine ie die('We are HERE'); //<----THIS $message = "You have been logged in"; When you login it should say "We are HERE", if it doesn't then the login part if failing, and we can debug your login code, first add this var_dump($_POST); //<---ADD if(!empty($u) && !empty($p)){ ///changed from if ($u && $p) If the login if okay then trying commenting out the include("bouncer.php"); line, if it still failed then we're look at "auth.php"
-
The "fix" isn't a fix but a work around, I would recommend you re-think the design, as this is problem is probably only the first of many.
-
Maybe in the morning i'm kinda tired and am about to shut down!
-
Okay when you have XML data the strings get encoded. so < becomes < and > becomes > the reason is simple here some invalid XML <DATA> This is some text but if i had </DATA> in here it would mess up </DATA> Now this will fail because it closes the DATA tag in the data contents (value) so to stop that they encode it valid XML <DATA> This is some text but if i had </DATA> in here it would mess up </DATA> Hope that makes sense, now when PHP is reading the data it decode it back to what it should be.. so while the XML had "> the value is "> and that's what PHP gets So to sum up.. you are looking for the HTML info ie <img to grab the img URL you could use something like this (should work) $HTML = 'la lalalalalalal <img height="400px" src="I am a URL" width="10px" > lalalal ala'; if (preg_match('/<img[^>]*src\s*=([\'"])([^\1]*?)\1[^>]*>/', $HTML, $reg)) { echo $reg[2]; } EDIT: oow forgot a ; but fixed now I am kinda tired so i may not of made sense!
-
Put the ZipArchive and open at the start and the close at the end and the add in the if blocks, so the basic logic is (1- 1. openzip 2. if 1 is valid create ZipArchive 3. start looping the file list 4. check file and change is requied 5. add the files to the ZipArchive 6. end loop 7. close the openzip 8. close the ZipArchive
-
Ahh that makes more sense now <?php $url = 'http://news.google.com/news?pz=1&cf=all&ned=ca&hl=en&geo=toronto+on&output=rss'; $pointer = new SimpleXmlElement(file_get_contents($url)); $count = 1; $limit = 5; //added foreach($pointer->channel->item as $entry) { echo "<a href='$entry->link' title='$entry->title'>" . $entry->title . "</a><br>"; //Get description $description = (string)$entry->description; //UPDATED to get the string instead of the object //updated RegEx to HTML instead of encoded HTML if (preg_match('/">([a-zA-Z0-9.:;,$\s-]*)<b>\.\.\./', $description ,$result)) { echo "<br><br>YESSSS:".$result[1]; }else{ echo "<br><br>NOOOOO".$description; } if($count>=$limit){ break; } $count++; } ?>
-
You need to pass a valid zip file, change if (($temp = zip_open($file))) { to if (is_resource($temp = zip_open($file))) {
-
Theirs a few ways of setting up a multi-choice for from a database, serialized answers would probably be my last option! But we are not getting into that.. what done is done.. okay that info you have giving doesn't help.. the part replaced with etc is the part you should be following for alterations to the serialized data, some thing is changing the serialized data, from the part where its serialized to the part its unserialized..
-
Your need to rebuild the zip, ie <?php $zip = new ZipArchive; if ($zip->open('test.zip') === TRUE) { $zip->addFile('/path/to/index.txt', 'newname.txt'); $zip->close(); echo 'ok'; } else { echo 'failed'; } ?>
-
Not the form but from where the script gets the post and until the bit where it inserts.. without more info its very hard to give any truly useful help as it going to be generic and guess work Depends on the form are they all the same validation ? need more info
-
And the problem is ?
-
welcome, if solved can you click topic solved bottom left please
-
For cleaning up, a simple solution would be this, with allowed img tags <?php $X = "<font size="-1">This is some text, has a ., comma, and : and maybe ; or whatever is normal, some numbers too $44-billion on <b>...</b>"; $X = html_entity_decode($X); $X = html_entity_decode($X); $X = preg_replace('%<br\s*/?>%', "\n", $X); $X = strip_tags($X,"img"); echo $X;
-
try if(empty($_POST['code'])) header('Location:http://www.example.php');
-
Okay find a free service that checks your site (google "free server monitoring services"), now get that to check your site X hour/day whatever, but point it to a script that runs the job (like you would with a cron job)
-
I was not suggesting using stripslashes on the serialized data, infact quite the opposite, as that would mess it up.. okay this is some data with a problem a:3:{i:0;s:22:"Lack of Communication";i:1;s:43:"Inability to be compassionate toward others";i:2;s:18:"Lack of self worth";} Now the data is missing something.. but what ? well this part Lack of Communication is too short, its missing 1 character. the problem is the database doesn't care about that the data means, but serialize does.. Now just say you have some data like this $arr = array("123","456",addslashes('It\'s a good day to die.')); Now lets play around with it <?php $arr = array("123","456",addslashes('It\'s a good day to die.')); $ser = serialize($arr); $s_ser = stripslashes($ser); echo "<pre>\n"; echo "serialized data\n"; var_dump($ser); echo "usserialized data\n"; var_dump(unserialize($ser)); echo "\n\n"; echo "serialized stripped data\n"; var_dump($s_ser); echo "unserialized stripped data\n"; var_dump(unserialize($s_ser)); Now that will return this Notice that the string(69) of the serialized stripped data is 1 short and thus invalid, this is way you need to check what changes are done to the serialized data. its likely during the insert into or select from database
-
[SOLVED] Can someone Tell me whats wrong with this script?
MadTechie replied to bgbs's topic in PHP Coding Help
Well without seeing the JS function "CloseBug" its kinda hard to say where the problem, other than $dateformat hasn't been set! First thing would be to view source and check the code from their, if its as expect then its a JS problem. for example If you got something like this (via view source) onClick=\javascript:CloseBug('')">Close bug</a> then its probably a PHP problem, (probably $dateformat is not set or wrong) however this (maybe correct) onClick=\javascript:CloseBug('10-20-2009')">Close bug</a> then it would be a JS problem